I am trying to analyze three repeated measures of two outcome variables. It was recommended to use a latent growth curve model. I know in some software (SPSS) you can make growth curves with multiple measures, but it doesn't seem as straightforward in lavaan. Reading the lavaan tutorial it mentions multilevel SEM using sem() - is this appropriate for a repeated measures dataset? Or is there another package that allows multiple outcome growth curves in R?
To create a latent growth curve within lavaan
is easy, see the example bellow (with 4 timepoints):
library(lavaan)
model <- ' i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4
s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4 '
fit <- growth(model, data=Demo.growth)
summary(fit)
#> lavaan 0.6-8 ended normally after 29 iterations
#>
#> Estimator ML
#> Optimization method NLMINB
#> Number of model parameters 9
#>
#> Number of observations 400
#>
#> Model Test User Model:
#>
#> Test statistic 8.069
#> Degrees of freedom 5
#> P-value (Chi-square) 0.152
#>
#> Parameter Estimates:
#>
#> Standard errors Standard
#> Information Expected
#> Information saturated (h1) model Structured
#>
#> Latent Variables:
#> Estimate Std.Err z-value P(>|z|)
#> i =~
#> t1 1.000
#> t2 1.000
#> t3 1.000
#> t4 1.000
#> s =~
#> t1 0.000
#> t2 1.000
#> t3 2.000
#> t4 3.000
#>
#> Covariances:
#> Estimate Std.Err z-value P(>|z|)
#> i ~~
#> s 0.618 0.071 8.686 0.000
#>
#> Intercepts:
#> Estimate Std.Err z-value P(>|z|)
#> .t1 0.000
#> .t2 0.000
#> .t3 0.000
#> .t4 0.000
#> i 0.615 0.077 8.007 0.000
#> s 1.006 0.042 24.076 0.000
#>
#> Variances:
#> Estimate Std.Err z-value P(>|z|)
#> .t1 0.595 0.086 6.944 0.000
#> .t2 0.676 0.061 11.061 0.000
#> .t3 0.635 0.072 8.761 0.000
#> .t4 0.508 0.124 4.090 0.000
#> i 1.932 0.173 11.194 0.000
#> s 0.587 0.052 11.336 0.000
However, if you want to model latent growth curve for 2 parallel processes (sleep and anxiety) you can use this approach:
library(lavaan)
#> This is lavaan 0.6-8
#> lavaan is FREE software! Please report any bugs.
model <- "
i1 =~ 1*t1 + 1*t2 + 1*t3 + 1*t4
s1 =~ 0*t1 + 1*t2 + 2*t3 + 3*t4
i2 =~ 1*c1 + 1*c2 + 1*c3 + 1*c4
s2 =~ 0*c1 + 1*c2 + 2*c3 + 3*c4
s1 ~ i2
s2 ~ i1
"
fit <- growth(model, data=Demo.growth)
#> Warning in lav_object_post_check(object): lavaan WARNING: covariance matrix of latent variables
#> is not positive definite;
#> use lavInspect(fit, "cov.lv") to investigate.
summary(fit)
#> lavaan 0.6-8 ended normally after 76 iterations
#>
#> Estimator ML
#> Optimization method NLMINB
#> Number of model parameters 20
#>
#> Number of observations 400
#>
#> Model Test User Model:
#>
#> Test statistic 156.195
#> Degrees of freedom 24
#> P-value (Chi-square) 0.000
#>
#> Parameter Estimates:
#>
#> Standard errors Standard
#> Information Expected
#> Information saturated (h1) model Structured
#>
#> Latent Variables:
#> Estimate Std.Err z-value P(>|z|)
#> i1 =~
#> t1 1.000
#> t2 1.000
#> t3 1.000
#> t4 1.000
#> s1 =~
#> t1 0.000
#> t2 1.000
#> t3 2.000
#> t4 3.000
#> i2 =~
#> c1 1.000
#> c2 1.000
#> c3 1.000
#> c4 1.000
#> s2 =~
#> c1 0.000
#> c2 1.000
#> c3 2.000
#> c4 3.000
#>
#> Regressions:
#> Estimate Std.Err z-value P(>|z|)
#> s1 ~
#> i2 6.115 3.785 1.615 0.106
#> s2 ~
#> i1 -0.011 0.017 -0.644 0.519
#>
#> Covariances:
#> Estimate Std.Err z-value P(>|z|)
#> i1 ~~
#> i2 0.101 0.062 1.632 0.103
#> .s1 ~~
#> .s2 0.021 0.017 1.205 0.228
#>
#> Intercepts:
#> Estimate Std.Err z-value P(>|z|)
#> .t1 0.000
#> .t2 0.000
#> .t3 0.000
#> .t4 0.000
#> .c1 0.000
#> .c2 0.000
#> .c3 0.000
#> .c4 0.000
#> i1 0.615 0.077 8.009 0.000
#> .s1 0.824 0.276 2.990 0.003
#> i2 0.030 0.041 0.731 0.464
#> .s2 0.002 0.024 0.063 0.950
#>
#> Variances:
#> Estimate Std.Err z-value P(>|z|)
#> .t1 0.597 0.086 6.978 0.000
#> .t2 0.673 0.061 11.056 0.000
#> .t3 0.636 0.072 8.780 0.000
#> .t4 0.507 0.124 4.095 0.000
#> .c1 0.977 0.069 14.120 0.000
#> .c2 0.892 0.064 14.016 0.000
#> .c3 0.838 0.065 12.996 0.000
#> .c4 0.803 0.080 10.010 0.000
#> i1 1.931 0.173 11.193 0.000
#> .s1 0.533 0.203 2.626 0.009
#> i2 0.001 0.006 0.246 0.806
#> .s2 0.007 0.006 1.033 0.302
Created on 2021-03-19 by the reprex package (v1.0.0)