Hi all,
I am trying to replicate models in Nestler & Humberg's (2023) article in the SEM journal. In it, they show how to estimate a series of longitudinal models in both mixed effects and SEM formulations in R (nlme and lavaan).
The model of interest is the first one, the random intercept - autoregressive panel model. The data can be downloaded at osf along with the R code. First is the mixed version in Stata:
Next is the trickier sem version, and this is where I am having trouble. The issue is that in mixed, a stationarity constraint is imposed on the variances of the timepoint specific residuals. I cannot figure out how to do this in sem. My code is below:
The sem code above was modified from some code shared by Joseph Coveney in a 2021 thread.
Again, my main question is how do I fix the residual variance of E1 to be the same as E2-E5?
I am trying to replicate models in Nestler & Humberg's (2023) article in the SEM journal. In it, they show how to estimate a series of longitudinal models in both mixed effects and SEM formulations in R (nlme and lavaan).
The model of interest is the first one, the random intercept - autoregressive panel model. The data can be downloaded at osf along with the R code. First is the mixed version in Stata:
Code:
mixed e i.time || id: , residuals(ar 1, t(time))
Code:
reshape wide e time1vsrest, i(id) j(time) sem (RI -> e1@1 e2@1 e3@1 e4@1 e5@1) /// random intercept (E1 -> e1@1) (E2 -> e2@1) (E3 -> e3@1) /// person-centered variables (E4 -> e4@1) (E5 -> e5@1) /// person-centered variables (E2 <- E1@c1) (E3 <- E2@c1) (E4 <- E3@c1) /// autoregressions (E5 <- E4@c1) , /// covstructure(e._OEn, zero) /// covstructure(_OEx, diagonal) /// covstructure(e._LEn, identity) /// covariance(RI*E1@0) /// noivstart technique(nr bhhh) /// nocnsreport nodescribe
Again, my main question is how do I fix the residual variance of E1 to be the same as E2-E5?
Comment