Dynamic Structural Equation Model - Cross-Lagged in Lavaan

700 views
Skip to first unread message

Borja Del Pozo Cruz

unread,
Mar 9, 2019, 8:12:46 PM3/9/19
to lavaan
Hello all,

My name is Borja, I am new to lavaan and structural equation modelling. 
I want to run a multilevel cross-lagged panel model with 7 waves for two variables (x1-x7; y1-y7). 

I have come across this syntax from MPLUS. 
VARIABLE: 

NAMES ARE 
ID day  v_day
v_min cpm Sedentary
light life mod vig lightlife
mvpa mvpab sed10 sed30 sed60 sedp
lightlifep modp vigp mvpap totalPA totalPAp Sleep Sleep2
sex age eth;
Cluster = ID; !Specifies the person ID
Usevar = Sleep Sedentary;
Lagged = Sedentary(1) Sleep(1) ; !lags sedentary & sleep by 1
MISSING ARE ALL(-999);
Analysis:
 TYPE = twolevel Random;
 Estimator = Bayes; !DSEM requires Bayes
 Proc= 2;
 Biter= (5000);
 bseed = 526;
 thin = 10;
Model:
 %WITHIN%
 !Random Slopes;
 SED_Lag | Sedentary ON Sedentary&1; !autoregressive path for sedentary
 SED_Sle | Sedentary ON Sleep&1; !Crosslagged predicting sedentary
 SLE_Sed | Sleep ON Sedentary; !Crosslagged predicting sleep
 SLE_lag | Sleep ON Sleep&1; !autoregessive path for sleep

 %Between% ! Allowing for correlated error terms
 Sedentary WITH Sleep;
 Sed_Lag WITH SED_Sle SLE_sed SLE_lag Sedentary Sleep;
 SED_sle WITH SLE_sed SLE_lag Sedentary Sleep;
 SLE_sed WITH SLE_lag Sedentary Sleep;
 SLE_lag WITH Sedentary Sleep;

OUTPUT: STDYX; !Standardized output to compare cross lagged effects

I wonder if it possible to eplicate this in lavaan, and if so, what the code would looks like? or is there a better way of doing it? 

Thanks so much in advance for your help. 

Borja del Pozo 
Senior Research Fellow -ACU

Mauricio Garnier-Villarreal

unread,
Mar 9, 2019, 10:56:08 PM3/9/19
to lavaan

If you are new to lavaan and SEM in general you are jumping into the deep side quickly. You could probably be able to estimate a cross-lagged 2 level panel model in lavaan, which would be a longitudinal model but not dynamic.

If you want to apply "dynamic" models you should look at ctsem (https://cran.r-project.org/web/packages/ctsem/index.html) which runs continuous time dynamic models with stochastic differential equations, or dynr (https://cran.r-project.org/web/packages/dynr/index.html) which do dynamic models from the framework of state space modeling.

Either ctsem and dynr do continuous time dynamic models, on the other side the code you shared is from Mplus which is limited to discrete time dynamic models. You should look in more depth this area to see which is the right model for your research, you could look at https://www.springer.com/us/book/9783319772189

Borja Del Pozo Cruz

unread,
Mar 10, 2019, 12:14:55 AM3/10/19
to lav...@googlegroups.com
Dear Mauricio,
Thanks for this information.
Do you know where could I find an example of syntax for the cross-lagged 2 level panel model? 
Thanks,
Borja

--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages