Hi, I'm trying to specify a RI-CLPM (Hamaker et al., 2015; Mulder et al. 2021) as a state-space model, but I don't know how to specify the two random intercepts used to capture stable between-individual differences in change. I've tried different ways of including them but none of them worked. Could you please help me identify which matrices should I modify to include the effect of the random intercepts? I leave my code below. Thank you very much for your attention!
### Drift matrix Amat <- mxMatrix(name="A", nrow=2, ncol=2, free = c(T,T,T,T), values = c(.5, 0, 0, .5), labels = c("a11","a21","a12","a22") ) ### Input effects on the latent variables Bmat <- mxMatrix(name = "B", "Zero", 2, 1) ### Measurement model Cmat <- mxMatrix(name = "C", "Full", 2, 2, free = FALSE, values = c(1,0,0,1), dimnames = list(c("Y1", "Y2"), c("y1", "y2")) ) ### Input effects on the observed variables Dmat <- mxMatrix("Zero", 2, 1, name = "D") ### Dynamic error Qmat <- mxMatrix("Full", 2, 2, name = "Q", free = c(T,T,T,T), values = c(.6,0,0,.6), labels = c("y1der","dercv","dercv","y2der")) ### Measurement error Rmat <- mxMatrix("Zero", 2, 2, F, name = "R") ### Mean vector x0mat <- mxMatrix("Zero", name='x0', nrow=2, ncol=1) ### Covariance matrix P0mat<- mxMatrix(name='P0', nrow=2, ncol=2, free = TRUE, values=c(1,0,0,1), labels=c("y1v","y12cv","y12cv","y2Av")) ### Covariates Umat <- mxMatrix("Zero", 1, 1, name = "u") ### Specification of the time index Tmat <- mxMatrix('Full', 1, 1, name='time', labels='data.time') References: Hamaker, E. L., Kuiper, R. M., & Grasman, R. P. (2015). A critique of the cross-lagged panel model. Psychological methods, 20(1), 102. Mulder, J. D., & Hamaker, E. L. (2021). Three extensions of the random intercept cross-lagged panel model. Structural Equation Modeling: A Multidisciplinary Journal, 28(4), 638-648.
The general idea is to add "dummy" latent variables to the latent state vector that do not change over time. In discrete time, these "dummy" variables take the form
x_t = 1*x_{t-1} + 0
. In continuous time, these "dummy" variables take the formdx/dt = 0*x + 0
.I've attached an R script I have laying around that does some random intercept models.
I've also attached a (slightly reduced form) presentation I gave at M3 around six years ago that shows a bunch of "longitudinal" model are easier to understand as state space models.
Hunter, M.D. (2016). That's a State Space Model too! Talk presented at the Modern Modeling Methods (M3) Conference; Storrs, CT; May 24-25, 2016.
Aha! I understand. I included the random intercepts in the drift matrix as latent states with 0 dynamics and that did the trick. Thanks a lot for the explanation and the examples.