Linear Latent Growth Curve Model with 4 Timepoints

Ben Kite, Center for Research Methods and Data Analysis, University of Kansas <bakite@ku.edu>

Please visit http://crmda.ku.edu/guides

Keywords: Structural Equation Modeling, Latent Growth Curve Model, R, lavaan


2019 February 01

Abstract

This guide outlines how to specify and fit a basic latent growth curve model in R using the lavaan package. The estimation results can be compared to the same model fitted with Mplus.

The Mplus Example

The Mplus Example Link

Package and Data

Load the lavaan package.

library(lavaan)
This is lavaan 0.6-3
lavaan is BETA software! Please report any bugs.

Load the data, give the columns names.

dat <- read.table("../../data/anxiety.dat", header = F)
names(dat) <- c("a1", "a2", "a3", "a4")

LGC in lavaan

Build the LGC model with lavaan syntax. Here we are specifying a linear slope. Notice how the manifest variable intercepts are fixed to 0, and the last two lines request the means for the intercept and slope latent variables.

model <-
' intercept =~ 1*a1 + 1*a2 + 1*a3 + 1*a4
  slope =~ 0*a1 + 1*a2 + 2*a3 + 3*a4

  a1 ~ 0*1
  a2 ~ 0*1
  a3 ~ 0*1
  a4 ~ 0*1

  intercept ~ 1
  slope ~ 1
'

Run the model using the sem function, request a summary of the output.

output <- sem(model, data = dat)
summary(output, standardized = TRUE, fit.measures = TRUE)
lavaan 0.6-3 ended normally after 45 iterations

  Optimization method                           NLMINB
  Number of free parameters                          9

  Number of observations                           485

  Estimator                                         ML
  Model Fit Test Statistic                      27.288
  Degrees of freedom                                 5
  P-value (Chi-square)                           0.000

Model test baseline model:

  Minimum Function Test Statistic             1182.102
  Degrees of freedom                                 6
  P-value                                        0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    0.981
  Tucker-Lewis Index (TLI)                       0.977

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)               -567.499
  Loglikelihood unrestricted model (H1)       -553.855

  Number of free parameters                          9
  Akaike (AIC)                                1152.997
  Bayesian (BIC)                              1190.654
  Sample-size adjusted Bayesian (BIC)         1162.089

Root Mean Square Error of Approximation:

  RMSEA                                          0.096
  90 Percent Confidence Interval          0.063  0.133
  P-value RMSEA <= 0.05                          0.013

Standardized Root Mean Square Residual:

  SRMR                                           0.053

Parameter Estimates:

  Information                                 Expected
  Information saturated (h1) model          Structured
  Standard Errors                             Standard

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  intercept =~                                                          
    a1                1.000                               0.388    0.833
    a2                1.000                               0.388    0.906
    a3                1.000                               0.388    0.911
    a4                1.000                               0.388    0.903
  slope =~                                                              
    a1                0.000                               0.000    0.000
    a2                1.000                               0.083    0.193
    a3                2.000                               0.166    0.389
    a4                3.000                               0.249    0.578

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  intercept ~~                                                          
    slope            -0.011    0.003   -3.472    0.001   -0.349   -0.349

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .a1                0.000                               0.000    0.000
   .a2                0.000                               0.000    0.000
   .a3                0.000                               0.000    0.000
   .a4                0.000                               0.000    0.000
    intercept         0.698    0.020   35.050    0.000    1.796    1.796
    slope            -0.062    0.006  -10.513    0.000   -0.753   -0.753

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .a1                0.067    0.007    8.910    0.000    0.067    0.306
   .a2                0.048    0.004   11.119    0.000    0.048    0.264
   .a3                0.048    0.004   11.383    0.000    0.048    0.265
   .a4                0.040    0.006    6.658    0.000    0.040    0.215
    intercept         0.151    0.013   11.871    0.000    1.000    1.000
    slope             0.007    0.001    4.790    0.000    1.000    1.000

Session Info

R version 3.5.1 (2018-07-02)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lavaan_0.6-3        stationery_0.98.5.7

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0      digest_0.6.18   MASS_7.3-51.1   plyr_1.8.4     
 [5] xtable_1.8-3    magrittr_1.5    stats4_3.5.1    evaluate_0.12  
 [9] zip_1.0.0       stringi_1.2.4   pbivnorm_0.6.0  openxlsx_4.1.0 
[13] rmarkdown_1.11  tools_3.5.1     stringr_1.3.1   foreign_0.8-71 
[17] kutils_1.59     yaml_2.2.0      xfun_0.4        compiler_3.5.1 
[21] mnormt_1.5-5    htmltools_0.3.6 knitr_1.21     

Available under Created Commons license 3.0 CC BY