I've been able to run mediation and latent growth curve models separately, but my attempts to to integrate those two has failed.
I would appreciate it if someone was willing to share some code they have. I have one predictor and one mediator variable (both measured at time 1), and a dependent variable measured at time 1, time 2, and time 3.
mediation.model <- '
#latent growth variables
#DV intercept
i =~ 1*CSI4.tot.1 + 1*CSI4.tot.2 + 1*CSI4.tot.3 + 1*CSI4.tot.4 + 1*CSI4.tot.5
#DV slope
s =~ 1*CSI4.tot.1 + 2*CSI4.tot.2 + 3*CSI4.tot.3 + 4*CSI4.tot.4 + 5*CSI4.tot.5
#Specifying intercept for CSI4.tot.0
CSI4.tot.0 ~ 1
#direct effect
i ~ c*BF_Ex.A
s ~ c*BF_Ex.A
# mediator
CSI4.tot.0 ~ a*BF_Ex.A
i ~ b*CSI4.tot.0
s ~ b*CSI4.tot.0
# indirect effect (a*b)
ab := a*b
# total effect
total := c + (a*b)
'
fit.growth<-growth(mediation.model, data = dset, se = "bootstrap")
summary(fit.growth)
mediation.model <- '
#latent growth variables (note: only DV is growth factor in this model)
#DV intercept
i =~ 1*CSI4.tot.1 + 1*CSI4.tot.2 + 1*CSI4.tot.3 + 1*CSI4.tot.4 + 1*CSI4.tot.5
#DV slope
s =~ 1*CSI4.tot.1 + 2*CSI4.tot.2 + 3*CSI4.tot.3 + 4*CSI4.tot.4 + 5*CSI4.tot.5
#Specifying intercept for CSI4.tot.0
CSI4.tot.0 ~ 1
#direct effect
i ~ {ic}*BF_Ex.A
s ~ {sc}*BF_Ex.A
# mediator
CSI4.tot.0 ~ a*BF_Ex.A
i ~ {ib}*CSI4.tot.0
s ~ {sb}*CSI4.tot.0
# indirect effect (a*{sb})
ab := a*{sb}
# total effect
total := {sc} + (a*{sb})
'
fit.growth<-growth(mediation.model, data = dset, se = "bootstrap")
summary(fit.growth)
lavaan (0.5-23.1097) converged normally after 47 iterations Used Total Number of observations 165 600 Estimator ML Minimum Function Test Statistic 55.211 Degrees of freedom 16 P-value (Chi-square) 0.000 Parameter Estimates: Information Observed Standard Errors Bootstrap Number of requested bootstrap draws 1000 Number of successful bootstrap draws 1000 Latent Variables: Estimate Std.Err z-value P(>|z|) i =~ CSI4.tot.1 1.000 CSI4.tot.2 1.000 CSI4.tot.3 1.000 CSI4.tot.4 1.000 CSI4.tot.5 1.000 s =~ CSI4.tot.1 1.000 CSI4.tot.2 2.000 CSI4.tot.3 3.000 CSI4.tot.4 4.000 CSI4.tot.5 5.000 Regressions: Estimate Std.Err z-value P(>|z|) i ~ BF_Ex.A (ic) 0.097 0.077 1.251 0.211 s ~ BF_Ex.A (sc) -0.005 0.022 -0.210 0.834 CSI4.tot.0 ~ BF_Ex.A (a) -0.034 0.089 -0.381 0.703 i ~ CSI4.tt.0 (ib) 0.887 0.054 16.485 0.000 s ~ CSI4.tt.0 (sb) -0.038 0.017 -2.213 0.027 Covariances: Estimate Std.Err z-value P(>|z|) .i ~~ .s -0.853 0.253 -3.365 0.001 Intercepts: Estimate Std.Err z-value P(>|z|) .CSI4.tot.0 9.028 0.657 13.737 0.000 .CSI4.tot.1 0.000 .CSI4.tot.2 0.000 .CSI4.tot.3 0.000 .CSI4.tot.4 0.000 .CSI4.tot.5 0.000 .i -0.327 0.741 -0.441 0.659 .s 1.122 0.230 4.878 0.000 Variances: Estimate Std.Err z-value P(>|z|) .CSI4.tot.1 2.569 0.555 4.631 0.000 .CSI4.tot.2 2.977 0.608 4.895 0.000 .CSI4.tot.3 4.290 0.811 5.293 0.000 .CSI4.tot.4 2.018 0.305 6.624 0.000 .CSI4.tot.5 0.728 0.489 1.487 0.137 .CSI4.tot.0 13.276 1.438 9.230 0.000 .i 7.605 1.284 5.924 0.000 .s 0.534 0.082 6.524 0.000 Defined Parameters: Estimate Std.Err z-value P(>|z|) ab 0.001 0.004 0.352 0.725 total -0.003 0.022 -0.150 0.881
Does this code and output look accurate then?