Random Intercept Cross-Lagged Panel Model - Including time-invariant outcome

116 views
Skip to first unread message

Jeroen Mulder

unread,
Aug 20, 2020, 4:50:15 AM8/20/20
to lavaan
Dear everyone, 

I have created a website on how to run the random intercept cross-lagged panel model (RI-CLPM), and various extensions on it,  in lavaan. One of the extensions is including a time-invariant outcome (z2). Quite simple from a modeling perspective, but I can't seem to get lavaan to run the model. 

You can find the code below. The model also includes a time-invariant predictor for the observed variables (z1). The estimation terminates normally with just z1, but as soon as I add the line "z2 ~ RIx + RIy", lavaan tells me the initial model-implied matrix is not positive definite. The model, however, does run in Mplus. If you want to recreate the problem, you can find simulated data (RICLPM-Z.dat) on https://github.com/JeroenDMulder/RI-CLPM/tree/master/data

Any help/thoughts/pointers in the right direction with this seemingly small issue would be greatly appreciated :) 

RICLPM3.ext1 <- '
  # Create between components (random intercepts)
  RIx =~ 1*x1 + 1*x2 + 1*x3 + 1*x4 + 1*x5
  RIy =~ 1*y1 + 1*y2 + 1*y3 + 1*y4 + 1*y5
  
  # Estimate the variance and covariance of the random intercepts. 
  RIx ~~ RIx
  RIy ~~ RIy
  RIx ~~ RIy
  
  # Regression of time-invariant outcome z2 on random intercepts.
  z2 ~ RIx + RIy
  
  # Create within-person centered variables
  wx1 =~ 1*x1
  wx2 =~ 1*x2
  wx3 =~ 1*x3 
  wx4 =~ 1*x4
  wx5 =~ 1*x5
  wy1 =~ 1*y1
  wy2 =~ 1*y2
  wy3 =~ 1*y3
  wy4 =~ 1*y4
  wy5 =~ 1*y5
  
  # Regression of observed variables on z1 (constrained). 
  x1 + x2 + x3 + x4 + x5 ~ s1*z1 # Constrained over time. 
  y1 + y2 + y3 + y4 + y5 ~ s2*z1 # Constrained over time. 
  
  # Estimate the lagged effects between the within-person centered variables.
  wx2 + wy2 ~ wx1 + wy1
  wx3 + wy3 ~ wx2 + wy2
  wx4 + wy4 ~ wx3 + wy3
  wx5 + wy5 ~ wx4 + wy4
  
  # Estimate the covariance between the within-person centered variables at the first wave. 
  wx1 ~~ wy1 # Covariance
  
  # Estimate the covariances between the residuals of the within-person centered variables (the innovations).
  wx2 ~~ wy2
  wx3 ~~ wy3
  wx4 ~~ wy4
  wx5 ~~ wy5
  
  # Estimate the (residual) variance of the within-person centered variables.
  wx1 ~~ wx1 # Variances
  wy1 ~~ wy1 
  wx2 ~~ wx2 # Residual variances
  wy2 ~~ wy2 
  wx3 ~~ wx3 
  wy3 ~~ wy3 
  wx4 ~~ wx4 
  wy4 ~~ wy4 
  wx5 ~~ wx5
  wy5 ~~ wy5
'
RICLPM3.ext1.fit <- lavaan(RICLPM3.ext1, data = datZ, missing = 'ML', meanstructure = T, int.ov.free = T) 
summary(RICLPM3.ext1.fit, standardized = T)

Yves Rosseel

unread,
Aug 20, 2020, 9:24:11 AM8/20/20
to lav...@googlegroups.com
You are using the lavaan() function. This implies that you need to
specify each and every (free) parameter in the model. At least

z2 ~~ z2

is missing in your syntax, resulting in a zero-variance for z2 at the
starting values (hence the error). You can compare TECH1 from Mplus
against lavInspect(fit) from lavaan to ensure that you have the same set
of free paraemters.

If you still have trouble, you may contact me off-list.

Yves.
> --
> 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
> <mailto:lavaan+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/lavaan/5ccfcaab-3210-455d-90ca-e88dc8d5d2dcn%40googlegroups.com
> <https://groups.google.com/d/msgid/lavaan/5ccfcaab-3210-455d-90ca-e88dc8d5d2dcn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Jeroen Mulder

unread,
Aug 24, 2020, 8:01:17 AM8/24/20
to lavaan
Dear Dr. Rosseel, 

Thank you for your quick solution. I indeed forgot to include the residual variance of z2; added it solved the problem! 

Thanks again, I really appreciate the help.

Jeroen 

Reply all
Reply to author
Forward
0 new messages