RI-CLPM within-centered variables

328 views
Skip to first unread message

Nina -

unread,
Apr 4, 2024, 9:22:59 AM4/4/24
to lavaan
Hi everyone,

I'm working on a RI-CLPM and/or basic CLPM (without the random intercept) based on this code https://jeroendmulder.github.io/RI-CLPM/lavaan.html#The_RI-CLPM. I am a bit confused why he creates within-centered variables in which he creates these new variables, which are basically all variables times 1. His code:
# 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
What is the meaning or purpose of this code and is this needed for my (RI)-cross-lagged panel model? 

Thank you in advance!

Best,
Nina 

Chesnut, Ryan

unread,
Apr 4, 2024, 9:37:48 AM4/4/24
to lav...@googlegroups.com
Hi Nina,

In the RI-CLPM, a latent factor is created for each observed variable across time. The multiplication of 1 by the variable is for identification purposes when constructing the latent factor. There are also some constraints you have to place on residuals, which is also reflected in the code from that website. From an analysis standpoint, you are interested in the relationships among the latent factors; that is where you specify your autoregressive and cross-lagged paths.

Hope that helps.

Best,

Ryan

Ryan P. Chesnut, PhD

Assistant Research Professor

Clearinghouse for Military Family Readiness

The Pennsylvania State University

402 Marion Place

University Park, PA 16802

 

Phone: 814-865-9637

Email: rpc...@psu.edu

Website: www.militaryfamilies.psu.edu

 


From: lav...@googlegroups.com <lav...@googlegroups.com> on behalf of Nina - <nienn...@gmail.com>
Sent: Thursday, April 4, 2024 9:22 AM
To: lavaan <lav...@googlegroups.com>
Subject: RI-CLPM within-centered variables
 
You don't often get email from nienn...@gmail.com. Learn why this is important
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/b9082109-2a98-41cb-bcad-44080d13e992n%40googlegroups.com.

Nina -

unread,
Apr 9, 2024, 2:52:15 AM4/9/24
to lavaan
Hi Ryan,

Thank you for your explanation and response.
My RI-CLPM does not converge when I I add these within-centered variables by multiplying my variables by 1, but does converge when I remove them. Why do you think that is and are they absolutely necessary for my model? Thus could I simplify the model by removing these within-centered variables in my code, or is it better to simplify in other ways in my model, for example by removing the random intercepts?

Best,
Nina 
Op donderdag 4 april 2024 om 15:37:48 UTC+2 schreef rpc...@psu.edu:

Chesnut, Ryan

unread,
Apr 9, 2024, 8:40:19 AM4/9/24
to lav...@googlegroups.com
Hi Nina,

Could you share your complete syntax including the call you use to fit the model (e.g., model.fit <- sem(...))? That would help me and others in this group to potentially identify peculiarities that might be going on.

Also, if you haven't done so already, I would definitely recommend that you read the Mulder and Hamaker (2021) article that describes the RI-CLPM and extensions of that model. The authors do a nice job of explaining complex things in an accessible way.

Thanks,

Ryan

Ryan P. Chesnut, PhD

Assistant Research Professor

Clearinghouse for Military Family Readiness

The Pennsylvania State University

402 Marion Place

University Park, PA 16802

 

Phone: 814-865-9637

Email: rpc...@psu.edu

Website: www.militaryfamilies.psu.edu

 


Sent: Tuesday, April 9, 2024 2:52 AM
To: lavaan <lav...@googlegroups.com>
Subject: Re: RI-CLPM within-centered variables
 
Message has been deleted

Nina -

unread,
Apr 17, 2024, 5:59:22 AM4/17/24
to lavaan

Hi Ryan,

 

Thank you, I looked at the paper again and it is helpful.

If I understand correctly a RI-CLPM differs from a CLPM by addition as both the within-centered variables as the between-centered variables (the RI). 

 

My code for the RI-CLPM is this with the variables diet (DHD) and depression (EPDS) at 3 waves (18 weeks of pregnancy, 32 weeks of pregnancy and 12 weeks postpartum) 

RICLPM1 <- '
# Create between components (random intercepts)
RIx =~ 1*EPDS_pre_18_win_sqr + 1*EPDS_pre_32_win_sqr + 1*EPDS_post_12_win_sqr
RIy =~ 1*DHD_total_pre_18s + 1*DHD_total_pre_32s + 1*DHD_total_post_12_wins


# Create within-person centered variables

EPDS1 =~ 1*EPDS_pre_18_win_sqr
EPDS2 =~ 1*EPDS_pre_32_win_sqr
EPDS3 =~ 1*EPDS_post_12_win_sqr
DHD1 =~ 1*DHD_total_pre_18s
DHD2 =~ 1*DHD_total_pre_32s
DHD3 =~1*DHD_total_post_12_wins

# Estimate lagged effects between within-person centered variables
EPDS2 ~ EPDS1 + DHD1
EPDS3 ~ EPDS2 + DHD2
DHD2 ~ DHD1 + EPDS1
DHD3 ~ DHD2 + EPDS2

# Estimate covariance between within-person centered variables at first wave
EPDS1 ~~ DHD1 # Covariance

# Estimate covariances between residuals of within-person centered variables
# (i.e., innovations)
EPDS2 ~~ DHD2
EPDS3 ~~ DHD3

# Estimate variance and covariance of random intercepts
RIx ~~ RIx
RIy ~~ RIy
RIx ~~ RIy

# Estimate (residual) variance of within-person centered variables
EPDS1 ~~ EPDS1 # Variances
DHD1 ~~ DHD1
EPDS2 ~~ EPDS2 # Residual variances
DHD2 ~~ DHD2
EPDS3 ~~ EPDS3
DHD3 ~~ DHD3
'
# fit the model to the data
fit1 <- sem(RICLPM1, missing = "ML",data = df)

# view the model results
summary(fit1, standardized = TRUE, fit.measures = TRUE,  ci = TRUE)

I get these warnings, which indicates this code cannot run on our data, maybe because our sample is too small (N=160 wave 1, N=150 wave 2 and N=145 wave 3): 

In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, :

lavaan WARNING: Could not compute standard errors! The information matrix could not be inverted. This may be a symptom that the model is not identified. In lav_object_post_check(object) 

lavaan WARNING: some estimated lv variances are negative

 

The model for the traditional CLPM is quite simplified and does run and I used this code instead:

CLPM1c <- '

# Estimate lagged effects

EPDS_pre_32_win_sqr  ~ EPDS_pre_18_win_sqr + DHD_total_pre_18s

EPDS_post_12_win_sqr ~ EPDS_pre_32_win_sqr  + DHD_total_pre_32s

DHD_total_pre_32s ~ DHD_total_pre_18s+ EPDS_pre_18_win_sqr

DHD_total_post_12_wins ~ DHD_total_pre_32s + EPDS_pre_32_win_sqr

# Estimate covariances

EPDS_pre_18_win_sqr ~~ DHD_total_pre_18s# Covariance

EPDS_pre_32_win_sqr  ~~ DHD_total_pre_32s

EPDS_post_12_win_sqr ~~ DHD_total_post_12_wins

'

# fit the model to the data

fit1c <- sem(CLPM1c, missing = "ML", data = df)

# view the model results

summary(fit1c, standardized = TRUE, fit.measures = TRUE,  ci = TRUE)

Is it now best to simplify the models by using the second code and just go on with a traditional CLPM, without the random intercepts and within-centered variables? Or could I add something to this code to keep in mind also within-person change, but still make my model run? 

Thank you for your help!!

 

Kind regards,

Nina 


Op dinsdag 9 april 2024 om 14:40:19 UTC+2 schreef rpc...@psu.edu:

Chesnut, Ryan

unread,
Apr 17, 2024, 7:46:26 AM4/17/24
to lav...@googlegroups.com
Hi Nina,

I think the issue might be that you are using the “sem” function to run the model. Try using “lavaan” instead, so fit1 <- lavaan(RICLPM1, missing = “ML”, data - df). The “sem” function is a wrapper function that has several built-in defaults that do not work for the RI-CLPM, which I believe is causing the warning message you are receiving about the model possibly not being identified. The “lavaan” function is “default-light” and should be able to run the model you are trying to estimate. 

Best,

Ryan

Sent from my iPad

On Apr 17, 2024, at 5:59 AM, Nina - <nienn...@gmail.com> wrote:


Message has been deleted

Nina -

unread,
Apr 18, 2024, 7:51:18 AM4/18/24
to lavaan
Hi Ryan,

Yes thank you, that fixed the error for my RI-CLPM. The model runs now without warnings, however the fit estimates are bad (see below the output).
This does not seem acceptable. Should I change my model based on this or could it be the fault of something else in my model 1?

Kind regards,
Nina 

lavaan 0.6.15 ended normally after 111 iterations Estimator ML Optimization method NLMINB Number of model parameters 20 Used Total Number of observations 161 165 Number of missing patterns 9 Model Test User Model:
Test statistic 291.446 Degrees of freedom 7 P-value (Chi-square) 0.000 Model Test Baseline Model: Test statistic 464.721 Degrees of freedom 15 P-value 0.000 User Model versus Baseline Model: Comparative Fit Index (CFI) 0.368 Tucker-Lewis Index (TLI) -0.355 Robust Comparative Fit Index (CFI) 0.450 Robust Tucker-Lewis Index (TLI) -0.179 Loglikelihood and Information Criteria: Loglikelihood user model (H0) -1181.668 Loglikelihood unrestricted model (H1) -1035.945 Akaike (AIC) 2403.336 Bayesian (BIC) 2464.965 Sample-size adjusted Bayesian (SABIC) 2401.650 Root Mean Square Error of Approximation: RMSEA 0.502 90 Percent confidence interval - lower 0.454 90 Percent confidence interval - upper 0.553 P-value H_0: RMSEA <= 0.050 0.000 P-value H_0: RMSEA >= 0.080 1.000 Robust RMSEA 0.508 90 Percent confidence interval - lower 0.456 90 Percent confidence interval - upper 0.562 P-value H_0: Robust RMSEA <= 0.050 0.000 P-value H_0: Robust RMSEA >= 0.080 1.000 Standardized Root Mean Square Residual: SRMR 1.731 Parameter Estimates: Standard errors Standard Information Observed Observed information based on Hessian

Op woensdag 17 april 2024 om 13:46:26 UTC+2 schreef rpc...@psu.edu:

Chesnut, Ryan

unread,
Apr 19, 2024, 10:13:15 AM4/19/24
to lav...@googlegroups.com
Hi Nina,

It is definitely possible that the RI-CLPM is not the most appropriate model for the data you have. That said, I would recommend you inspect the parameter estimates in your output to see if there is anything that looks off. That could signal the model is doing something you don't want or intend, and you should modify your syntax. Another check is to request modification indices (i.e., modindices; https://lavaan.ugent.be/tutorial/modindices.html). This is a data-driven way to see if there is something not estimated in the model that "should" be estimated. Lots of people have lots of different opinions about modification indices, but from a purely diagnostic standpoint, I think they can help you catch unintended omissions.

Best,

Ryan

Ryan P. Chesnut, PhD

Assistant Research Professor

Clearinghouse for Military Family Readiness

The Pennsylvania State University

402 Marion Place

University Park, PA 16802

 

Phone: 814-865-9637

Email: rpc...@psu.edu

Website: www.militaryfamilies.psu.edu

 


Sent: Thursday, April 18, 2024 7:51 AM
Message has been deleted

Chesnut, Ryan

unread,
Apr 25, 2024, 11:28:56 AM4/25/24
to lav...@googlegroups.com
Hi Nina,

The modification index is suggesting that you estimate the mean, or intercept, of RIx. I have one additional idea to try out. When you estimate the model, add meanstructure = TRUE and int.ov.free=TRUE. Together, these commands will bring the intercepts of the observed variables into the model and freely estimate them. I believe this is what is missing from the syntax, and it is why the modification indices are suggesting that you estimate the mean of RIx. So, your call would now look like:

fit1 <- lavaan(RICLPM1, missing = “ML”, data = df, meanstructure = TRUE, int.ov.free = TRUE)

Best,

Ryan

Ryan P. Chesnut, PhD

Assistant Research Professor

Clearinghouse for Military Family Readiness

The Pennsylvania State University

402 Marion Place

University Park, PA 16802

 

Phone: 814-865-9637

Email: rpc...@psu.edu

Website: www.militaryfamilies.psu.edu

 


Sent: Thursday, April 25, 2024 9:03 AM

To: lavaan <lav...@googlegroups.com>
Subject: Re: RI-CLPM within-centered variables
 
Hi Ryan,

That is a great tip. I looked at the modindices and for my model it wanted me to add this: 
lhs op rhs mi epc sepc.lv sepc.all sepc.nox 45 RIx ~1 122.689 1.833 0.925 0.925 0.925 47 EPDS1 ~1 38.697 0.644 0.859 0.859 0.859

It thus really wanted to put my random intercept of my x variable (depression) to 1. But does that not change the whole interpretation of my random-intercept model?

Best,
Nina
Op vrijdag 19 april 2024 om 16:13:15 UTC+2 schreef rpc...@psu.edu:
Reply all
Reply to author
Forward
0 new messages