Lab 7 - Ten Growth Models - Simple to Advanced

Structural Equation Modeling - Instructor: Karen Nylund-Gibson

Adam Garber

May 17, 2020

University of California, Santa Barbara


Lab preparation


Creating a version-controlled R-Project with Github

Download repository here: https://github.com/garberadamc/SEM-Lab7

On the Github repository webpage:

  1. fork your own branch of the lab repository
  2. copy the repository web URL address from the clone or download menu

Within R-Studio:

  1. click “NEW PROJECT”
  2. choose option Version Control
  3. choose option Git
  4. paste the repository web URL path copied from the clone or download menu on Github page
  5. choose location of the R-Project

Let’s start modeling


Table. LSAY repeated measures
Name Labels Variable type
math_07 7th grade math score time varying covariate
math_08 8th grade math score
math_09 9th grade math score
math_10 10th grade math score
math_11 11th grade math score
math_12 12th grade math score
sci_07 7th grade science score model indicators (outcomes)
sci_08 8th grade science score
sci_09 9th grade science score
sci_10 10th grade science score
sci_11 11th grade science score
sci_12 12th grade science score

Model 01 - Fixed time effects



Load in the mplus.R functions

## [1] "Loaded rhdf5 package"

Plotting using gh5 data generated by Mplus

  1. View plots available for a given model
  2. Generate plots using the get.plot.___ function
  3. Extract data and transform to tidy format
  4. Plot with ggplot

Prepare plot data

Plot the model estimated means superimposted on the obserbed individual values

Animate the plot with {gganimate}


Model 09 - Piecewise Growth Model (type I)


Prepare plot data

Plot the model estimated means superimposted on the obserbed individual values


Model 10 - Piecewise Growth Model (type II)


Check the path diagram

## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m10_growth_Lab7.out

Compare model fit across 10 models

## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m1_growth_Lab7.out 
## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m10_growth_Lab7.out 
## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m2_growth_Lab7.out 
## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m3_growth_Lab7.out 
## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m4_growth_Lab7.out 
## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m5_growth_Lab7.out 
## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m6_growth_Lab7.out 
## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m7_growth_Lab7.out 
## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m8_growth_Lab7.out 
## Reading model:  /Users/agarber/Desktop/SEM_S20/Lab7_SEM/mplus_files/m9_growth_Lab7.out

Model fit summary

Make a table with gt::gt()

Fit Indices1
Title Parameters ChiSqM_Value CFI TLI SRMR RMSEA_Estimate RMSEA_90CI_LB RMSEA_90CI_UB
m01_fixed_time_scores 11 1064.490 0.938 0.942 0.076 0.106 0.100 0.111
m02_centering_time_scores 11 1064.492 0.938 0.942 0.076 0.106 0.100 0.111
m03_free_time_scores 15 408.801 0.977 0.971 0.063 0.075 0.069 0.081
m04_time-inv_covs 23 464.948 0.971 0.960 0.041 0.075 0.069 0.081
m05_time-varying_covs 23 1398.808 0.906 0.884 0.338 0.127 0.121 0.132
m06_time-varying_covs 18 1540.135 0.897 0.884 0.340 0.126 0.121 0.132
m07_quadratic 15 226.244 0.987 0.984 0.036 0.055 0.049 0.062
m08_parallel_process 30 3138.892 0.936 0.930 0.061 0.086 0.083 0.089
m09_piecewise_1int_2slopes 17 2405.521 0.876 0.837 0.180 0.161 0.156 0.167
m10_piecewise_1int_2slopes 20 3806.656 0.803 0.682 0.397 0.226 0.220 0.232

1 Longitudinal Survey American Youth (LSAY)


References

Hallquist, M. N., & Wiley, J. F. (2018). MplusAutomation: An R Package for Facilitating Large-Scale Latent Variable Analyses in Mplus. Structural equation modeling: a multidisciplinary journal, 25(4), 621-638.

Miller, J. D., Hoffer, T., Suchner, R., Brown, K., & Nelson, C. (1992). LSAY codebook. Northern Illinois University.

Muthén, B. O., Muthén, L. K., & Asparouhov, T. (2017). Regression and mediation analysis using Mplus. Los Angeles, CA: Muthén & Muthén.

Muthén, L.K. and Muthén, B.O. (1998-2017). Mplus User’s Guide. Eighth Edition. Los Angeles, CA: Muthén & Muthén

R Core Team (2017). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL http://www.R-project.org/

Wickham et al., (2019). Welcome to the tidyverse. Journal of Open Source Software, 4(43), 1686, https://doi.org/10.21105/joss.01686