This website is the supplementary materials to “Joint effects in cross-lagged panel research using structural nested mean models” by Mulder, Usami, and Hamaker (2024). It contains:
fully annotated R code for replicating analyses from the empirical example in the main paper;
fully annotated R code to test if the modeling procedure in R works as intended using simulated data; and
answers to Frequently Asked Questions (FAQ) that reach us via email.
For the analyses, we relied on functions from the following R packages: foreign (version 0.8-83) by R core Team (2022); dplyr (version 1.1.4) by Wickham et al. (2023); tidyr (version 1.3.1) by Wickham, Vaughan, and Girlich (2024); purrr (version 1.0.2) by Wickham and Henry (2023); mice (version 3.16.0) by Buuren and Groothuis-Oudshoorn (2011); ggplot2 (version 3.4.4) by Wickham (2016); lavaan (version 0.6.16) by Rosseel (2012); geeM (version 0.10.1) by McDaniel, Henderson, and Rathouz (2013); and boot (version 1.3-28) by Canty and Ripley (2022). They can be loaded into an R session using the below code:
# Packages: Data library(foreign) # Read data stored by SPSSlibrary(dplyr) # Data wranglinglibrary(tidyr)library(purrr)library(mice)# Packages: Visualizationlibrary(ggplot2)# Packages: Analyseslibrary(lavaan) # Structural equation modelinglibrary(geeM) # GEElibrary(boot) # Bootstrap
References
Buuren, Stef van, and Karin Groothuis-Oudshoorn. 2011. “Mice: Multivariate Imputation by Chained Equations in R.”Journal of Statistical Software 45 (3): 1–67. https://doi.org/10.18637/jss.v045.i03.
Canty, A., and B. D. Ripley. 2022. “Boot: BootstrapR (S-Plus) Functions.”
Mulder, Jeroen D., Satoshi Usami, and Ellen L. Hamaker. 2024. “Joint Effects in Cross-Lagged Panel Research Using Structural Nested Mean Models.”Structural Equation Modeling: A Multidisciplinary Journal. https://doi.org/https://doi.org/10.1080/10705511.2024.2355579.
Rosseel, Yves. 2012. “Lavaan: AnR Package for Structural Equation Modeling.”Journal of Statistical Software 48 (2). https://doi.org/10.18637/jss.v048.i02.
Wickham, Hadley. 2016. Ggplot2: ElegantGraphics for DataAnalysis. New York: Springer-Verlag. https://ggplot2.tidyverse.org.
Wickham, Hadley, Romain François, Lionel Henry, Kirill Müller, and Davis Vaughan. 2023. “Dplyr: A Grammar of Data Manipulation.”https://CRAN.R-project.org/package=dplyr.