Dear Terrence,
Thank you so much for your reply. I, indeed, first tried to include T1 achievement and interest as covariates (of an independent variable), three mediators, and include T2 achievement and interest as outcomes. However, for the three partial mediation models, this approach did not work. Later, I used the same model only one mediator and they did not work either. That's why I tried to use residuals.
The longitudinal mediation models had low fit indices and I received the following warning:
Warning message:
In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, :
lavaan WARNING:
The variance-covariance matrix of the estimated parameters (vcov)
does not appear to be positive definite! The smallest eigenvalue
(= -6.950311e-13) is smaller than zero. This may be a symptom that
the model is not identified.
One example syntax of those mediation models were as follows:
Model_indirect_cog_long <-
'
level: 1
sqa_usecogact ~ a1*sqa_cogdisc
sqa_usetot ~ b1*sqa_cogdisc
sqa_useselfdet ~ c1*sqa_cogdisc
sqb_ach ~ d1*sqa_usecogact + e1*sqa_usetot + f1*sqa_useselfdet
sqb_pint ~ g1*sqa_usecogact + h1*sqa_usetot + j1*sqa_useselfdet
sqb_ach ~ k1*sqa_cogdisc
sqb_pint ~ l1*sqa_cogdisc
sqb_ach ~ p1*sqa_ach
sqb_pint ~ r1*sqa_interest
sqa_usecogact ~~ sqa_useselfdet + sqa_usetot
sqa_useselfdet ~~ sqa_usetot
sqa_ach ~~ sqa_cogdisc
sqa_interest ~~ sqa_cogdisc
sqa_ach ~~ sqa_interest
a1d1 := a1*d1
a1g1 := a1*g1
b1e1 := b1*e1
b1h1 := b1*h1
c1f1 := c1*f1
c1j1 := c1*j1
level: 2
sqa_usecogact ~ a2*sqa_cogdisc
sqa_usetot ~ b2*sqa_cogdisc
sqa_useselfdet ~ c2*sqa_cogdisc
sqb_ach ~ d2*sqa_usecogact + e2*sqa_usetot + f2*sqa_useselfdet
sqb_pint ~ g2*sqa_usecogact + h2*sqa_usetot + j2*sqa_useselfdet
sqb_ach ~ k2*sqa_cogdisc
sqb_pint ~ l2*sqa_cogdisc
sqb_ach ~ p2*sqa_ach
sqb_pint ~ r2*sqa_interest
sqa_usecogact ~~ sqa_useselfdet + sqa_usetot
sqa_useselfdet ~~ sqa_usetot
sqa_ach ~~ sqa_cogdisc
sqa_interest ~~ sqa_cogdisc
sqa_ach ~~ sqa_interest
a2d2 := a2*d2
a2g2 := a2*g2
b2e2 := b2*e2
b2h2 := b2*h2
c2f2 := c2*f2
c2j2 := c2*j2
'
fitModel_indirect_cog_long <- sem(Model_indirect_cog_long, data = mydata, cluster="IDTEACHER", se = "robust.huber.white")
summary(fitModel_indirect_cog_long, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE)
Do I miss something or do you suggest any other ideas for this model? Thanks a lot in advance!
Best,
Ayşenur