0

So, I am testing a longitudinal mediation analysis, and here is my model:

Model

JOV and NFS are continuous variables, but SS is a binary variable (0 v 1). So, I put this script in R:

modelz <- '

# Autoregressive paths

T2_JoV.23_Tot ~ T1_JoV.23_Tot

T3_JoV.23_Tot ~ T2_JoV.23_Tot

T3_JoV.23_Tot ~ T1_JoV.23_Tot

 

T2_SNeed1_Tot ~ T1_SNeed1_Tot

T3_SNeed1_Tot ~ T2_SNeed1_Tot

T3_SNeed1_Tot ~ T1_SNeed1_Tot

 

T2_SS1_Prev_2 ~ T1_SS1_Prev_2

T3_SS1_Prev_2 ~ T2_SS1_Prev_2

T3_SS1_Prev_2 ~ T1_SS1_Prev_2

 

# Cross-lagged paths

T3_SNeed1_Tot ~ T2_JoV.23_Tot

T2_SS1_Prev_2 ~ T1_SNeed1_Tot

 

# intercorrelation for control

T1_SNeed1_Tot ~~ T1_JoV.23_Tot

T1_SS1_Prev_2 ~~ T1_SNeed1_Tot

T1_SS1_Prev_2 ~~ T1_JoV.23_Tot

 

T2_SNeed1_Tot ~~ T2_JoV.23_Tot

T2_SS1_Prev_2 ~~ T2_SNeed1_Tot

T2_SS1_Prev_2 ~~ T2_JoV.23_Tot

 

T3_SNeed1_Tot ~~ T3_JoV.23_Tot

T3_SS1_Prev_2 ~~ T3_SNeed1_Tot

T3_SS1_Prev_2 ~~ T3_JoV.23_Tot

 

# Direct effect of X on Y (c path)

T3_SS1_Prev_2 ~ c*T1_JoV.23_Tot

 

# Effect of X on M (a path)

T2_SNeed1_Tot ~ a*T1_JoV.23_Tot

 

# Effect of M on Y (b path)

T3_SS1_Prev_2 ~ b*T2_SNeed1_Tot

 

#label effects with :=

direct := a

indirect := a*b

total := c + (a*b)

'

 

Fitz1 <- sem(modelz, data = jov4_sem, ordered = c("T2_SS1_Prev_2", "T3_SS1_Prev_2"), estimator = "WLSMV")

summary(fitz1, standardized = TRUE, fit.measures = TRUE, rsquare = TRUE)

parameterEstimates(fitz1, standardized = TRUE)

But it always says this warning and when I print the summary, it does not show the SE, z-value, and p value. It also shows the same warning if I put T1_SS1_Prev_2 as the ordered variable.

Warning message:

In lavaan::lavaan(model = modelz, data = jov4_sem, ordered = c("T2_SS1_Prev_2",  :

  lavaan WARNING:

    the optimizer warns that a solution has NOT been found!

However, this is not a problem if I do not specify the ordered variables:

fitz2 <- sem(modelz, data = jov4_sem)

summary(fitz2, standardized = TRUE, fit.measures = TRUE, rsquare = TRUE)

I wonder what is wrong with the first model (i.e., fitz1), and if I can do the second approach (i.e., fitz2; without specifying which are the ordered variables and WLS estimator? Any idea how should I address this?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.