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
You don't often get email from nienn...@gmail.com.
Learn why this is important
|
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
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
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/23832775-7434-4ade-ac5f-4041cbf938aen%40googlegroups.com.
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
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