RI-CLPM - Time-invariant standardized lagged effects - lavaan ERROR: unknown label(s) in variable definition(s): a c b d

Skip to first unread message

Korbi

unread,
Aug 26, 2022, 10:23:44 AM8/26/22
to lavaan
Hello there,

I want to model my data with a Random Intercept Cross-Lagged Panel model according to Moulder's & Hamaker's website.
The basic model produces no error. However, for complexity reduction, I want to constrain the model for "Time-invariant standardized lagged effects" (syntax by clicking on the folder after "The RI-CLPM") produces the following error message:

Error in lav_partable_constraints_def(partable, con = LIST, debug = debug) :
  lavaan ERROR: unknown label(s) in variable definition(s): a c b d

However, I had to do some adaptations to my model syntax, because unlike Moulder's & Hamaker's syntax, I have only four measurement time points (my syntax is below and data is attached).
My adaptation procedure was such that I deleted any line that referred to a variable at t5.

The error message refers probably to the lower two batches of code, in which " correlations of within-components" are computed and " residual variances of within-components" are constrained.
In there, the ":=" operator ought to define additional parameters (a, b, c, d), but this does not work, as the error message tells.
Maybe one needs fewer additional parameters for four time points?

I would be very happy for any thoughts about this :)

best regards,
Korbinian
 

My adapted syntax is as follows:
RICLPM <- '
  # Create within-components with freely estimated factor loading
  wx1 =~ NA*x1
  wx2 =~ NA*x2
  wx3 =~ NA*x3
  wx4 =~ NA*x4
  wy1 =~ NA*x1
  wy2 =~ NA*x2
  wy3 =~ NA*x3
  wy4 =~ NA*x4
 
  # Set variances of within-components at first wave to 1
  wx1 ~~ 1*wx1
  wy1 ~~ 1*wy1
 
  # Estimate correlation between within-components at first wave
  wx1 ~~ cor1*wy1
 
    # Label the residual covariances
  wx2 ~~ rcov2*wy2
  wx3 ~~ rcov3*wy3
  wx4 ~~ rcov4*wy4
 
  # Label the residual variances
  wx2 ~~ rvx2*wx2
  wy2 ~~ rvy2*wy2
  wx3 ~~ rvx3*wx3
  wy3 ~~ rvy3*wy3
  wx4 ~~ rvx4*wx4
  wy4 ~~ rvy4*wy4
 
    # Compute correlations of within-components at each wave
  cor2 := a*c + b*d + a*d*cor1 + b*c*cor1 + rcov2
  cor3 := a*c + b*d + a*d*cor2 + b*c*cor2 + rcov3
 
  #! Contrain residual variances of within-components such that variance of each within-component equals 1
  rvx2 == 1 - (a*a + b*b + 2*a*b*cor1)
  rvy2 == 1 - (c*c + d*d + 2*c*d*cor1)
  rvx3 == 1 - (a*a + b*b + 2*a*b*cor2)
  rvy3 == 1 - (c*c + d*d + 2*c*d*cor2)
  rvx4 == 1 - (a*a + b*b + 2*a*b*cor3)
  rvy4 == 1 - (c*c + d*d + 2*c*d*cor3)
'
RICLPM.fit <- lavaan(RICLPM, data = ep_pr, missing = 'ML', meanstructure = T, int.ov.free = T)
summary(RICLPM.fit, standardized = T)
RICLPM_unknown_label(s)

Nickname

unread,
Aug 28, 2022, 9:16:09 AM8/28/22
to lavaan
Korbinian,
I encounter the same error in my head when reading your code as Lavaan does.  When I get to the first constraint, I can find definitions of cor1 and rcov2 in the previous code, but I cannot find any prior reference to a, b, c and d.  I am completely out on a limb here, but there are 4 parameters and the form of the calculation looks like what one would obtain by calculating the correlation between two items in a two-factor factor analysis (sum of products of loadings on the same factor plus sums of products of loadings on different factors times the factor correlation).  If that is what you are doing, then you need to add the a-d labels to the fist block of code.  According to the model.syntax help file, you cannot use syntax like a*NA*x1 but instead need to use syntax like a*x1 + NA*x1 where 'a' is a label and 'NA' indicates a free parameter.  Caveat:  I am not seeing the use of 'NA' in the sample code that you pointed to.  I imagine that you are overriding constraints imposed by some convenience function but I am not crystal clear on what you are up to with those.  So, do not take this post as vetting your code.

I hope that helps,
Keith
------------------------
Keith A. Markus
John Jay College of Criminal Justice, CUNY
http://jjcweb.jjay.cuny.edu/kmarkus
Frontiers of Test Validity Theory: Measurement, Causation and Meaning.
http://www.routledge.com/books/details/9781841692203/

Jeroen Mulder

unread,
Aug 31, 2022, 3:55:47 AM8/31/22
to lavaan
Hi Korbinian and Keith,

I just happen to stumble on this question while searching for something else, and might as well help out. The labels a b c d refer to the lagged effects (see the "Constraints over time" tab). So I made a mistake in saying " Compared to the basic model (...)"; it should say "Compared to the previous model (with constraints over time on the unstandardized effects) (...)". I have just changed this on the website, and added a complete model syntax for the RI-CLPM with constraints on the standardized effects. I hope this is useful. Please let me know (via j.d.m...@uu.nl) if you still encounter problems here. 

Jeroen 

Korbi

unread,
Sep 2, 2022, 8:51:44 AM9/2/22
to lavaan
Thanks, Keith, for pointing at the right spots! From hindsight, I can tell now that you analyzed the code and assumed my faulty code adaptations correctly.

Thanks, Jeroen, for clearing up my issue and for providing the full Syntax on your homepage. This helps a lot and gives me some security in which Syntax to apply (especially as Syntax and hence results differ among RICLP-models, i.e., the one from John Flournoy differs from yours).
The model now runs smoothly!

In sum, thank you a lot for helping me :)




Jeroen
Reply all
Reply to author
Forward
0 new messages