Hello,
I am fitting an RI-CLPM model (3 constructs x 3 waves) with cluster data and received a warning:
Warning: lavaan->lav_object_post_check():
covariance matrix of latent variables is not positive definite
; use lavInspect(fit, "cov.lv") to investigate.
Here is my model (autoregressive, cross-lagged, and within-time covariances are constrained to be equal):
RICLPM_ARCLcovconstrained <- '
# Create between-person random intercepts
ki_x =~ 1*x12 + 1*x13 + 1*x14
ki_y =~ 1*y12 + 1*y13 + 1*y14
ki_z =~ 1*z12 + 1*z13 + 1*z14
# Estimate indicator intercepts
x12 ~ ix1*1
x13 ~ ix2*1
x14 ~ ix3*1
y12 ~ iy1*1
y13 ~ iy2*1
y14 ~ iy3*1
z12 ~ iz1*1
z13 ~ iz2*1
z14 ~ iz3*1
# Variances and covariance between random-intercepts
ki_x ~~ ki_x
ki_y ~~ ki_y
ki_z ~~ ki_z
ki_x ~~ ki_y
ki_x ~~ ki_z
ki_y ~~ ki_z
# Create within-person latent variables for AR & cross-lagged effects
wp_x12 =~ 1*x12
wp_x13 =~ 1*x13
wp_x14 =~ 1*x14
wp_y12 =~ 1*y12
wp_y13 =~ 1*y13
wp_y14 =~ 1*y14
wp_z12 =~ 1*z12
wp_z13 =~ 1*z13
wp_z14 =~ 1*z14
# Autoregressive and cross-lagged paths - Constrained to be equal across ages
wp_x13 ~ a*wp_x12 + d*wp_y12 + g*wp_z12
wp_y13 ~ b*wp_x12 + e*wp_y12 + h*wp_z12
wp_z13 ~ c*wp_x12 + f*wp_y12 + i*wp_z12
wp_x14 ~ a*wp_x13 + d*wp_y13 + g*wp_z13
wp_y14 ~ b*wp_x13 + e*wp_y13 + h*wp_z13
wp_z14 ~ c*wp_x13 + f*wp_y13 + i*wp_z13
# Estimate variances of within-person latent variables
wp_x12 ~~ wp_x12
wp_x13 ~~ wp_x13
wp_x14 ~~ wp_x14
wp_y12 ~~ wp_y12
wp_y13 ~~ wp_y13
wp_y14 ~~ wp_y14
wp_z12 ~~ wp_z12
wp_z13 ~~ wp_z13
wp_z14 ~~ wp_z14
# Contemporaneous covariances between within-person latent variables (Constrained to be equal)
wp_x12 ~~ cov1*wp_y12 + cov2*wp_z12
wp_y12 ~~ cov3*wp_z12
wp_x13 ~~ cov1*wp_y13 + cov2*wp_z13
wp_y13 ~~ cov3*wp_z13
wp_x14 ~~ cov1*wp_y14 + cov2*wp_z14
wp_y14 ~~ cov3*wp_z14
'
# Fit the model
RICLPM_ARCLcovconstrained.fit <- lavaan(model = RICLPM_ARCLcovconstrained,
data = mydata,
cluster = "cluster_id",
estimator = "MLR",
missing = "ML",
meanstructure = T,
int.ov.free = F,
int.lv.free = F,
auto.fix.first = F,
auto.fix.single = F,
auto.cov.lv.x = F,
auto.cov.y = F,
auto.var = F)
I inspected the correlation matrix and found that the correlation between ki_x and ki_y (2 random intercept factors) is 1.457 - which is impossible.
I also generated the eigenvalues, but it doesn't flag any errors to me. None of the eigenvalues >= 1.
eigen() decomposition
$values
[1] 0.2960114748 0.1152952343 0.0955074614 0.0628551346
[5] 0.0570728002 0.0308214889 0.0165498005 0.0057375243
[9] 0.0043353855 0.0040800265 -0.0001153656 -0.0215088293
$vectors
[,1] [,2] [,3] [,4] [,5]
[1,] 0.00000000 0.7575137 0.00000000 0.00000000 0.00000000
[2,] 0.00000000 0.6419019 0.00000000 0.00000000 0.00000000
[3,] 0.00000000 -0.1188899 0.00000000 0.00000000 0.00000000
[4,] 0.02479592 0.0000000 -0.30724302 0.57651069 -0.01354384
[5,] -0.01298830 0.0000000 0.03793736 0.35288065 0.56770984
[6,] -0.02378166 0.0000000 0.30951152 0.67612021 -0.02408936
[7,] 0.55885964 0.0000000 -0.63130890 0.12563192 -0.30955145
[8,] 0.60928551 0.0000000 0.04433828 -0.18874432 0.62578904
[9,] 0.55103392 0.0000000 0.61161814 0.06248243 -0.38594543
[10,] -0.05263089 0.0000000 0.11120439 -0.12321960 -0.01491726
[11,] -0.07299283 0.0000000 -0.02370108 -0.04971485 -0.19249639
[12,] -0.05797950 0.0000000 -0.14437239 -0.11404227 0.05724093
[,6] [,7] [,8] [,9] [,10]
[1,] 0.000000000 0.0000000 0.22803428 0.000000000 0.000000000
[2,] 0.000000000 0.0000000 -0.08953398 0.000000000 0.000000000
[3,] 0.000000000 0.0000000 0.96952774 0.000000000 0.000000000
[4,] 0.624589745 -0.4194399 0.00000000 0.001999482 0.017397087
[5,] 0.140289521 0.6747338 0.00000000 0.108507205 0.236986485
[6,] -0.625735539 -0.2297541 0.00000000 0.039000893 0.007723251
[7,] -0.278850054 0.2552680 0.00000000 -0.026197071 0.166987415
[8,] -0.093832878 -0.3866024 0.00000000 -0.080899081 -0.066909617
[9,] 0.318445293 0.1595524 0.00000000 0.204580394 0.026558954
[10,] 0.009527082 -0.2231539 0.00000000 -0.142944223 0.940673609
[11,] -0.070143218 0.0311011 0.00000000 -0.020258660 0.116930786
[12,] -0.075374621 -0.1586582 0.00000000 0.957482934 0.108942091
[,11] [,12]
[1,] 0.000000000 0.6116971
[2,] 0.000000000 -0.7615416
[3,] 0.000000000 -0.2141989
[4,] 0.078038427 0.0000000
[5,] 0.093218333 0.0000000
[6,] -0.002361006 0.0000000
[7,] -0.077648468 0.0000000
[8,] 0.174015294 0.0000000
[9,] 0.002011089 0.0000000
[10,] -0.119455774 0.0000000
[11,] 0.966754006 0.0000000
[12,] 0.004138870 0.0000000
The model still converges but the fit indices suggest conflicting results, very likely due to the non-existence correlations.
lavaan 0.6-21 ended normally after 166 iterations
Estimator ML
Optimization method NLMINB
Number of model parameters 51
Number of equality constraints 15
Used Total
Number of observations 970 1482
Number of clusters [nofamill] 743
Number of missing patterns 1
Model Test User Model:
Standard Scaled
Test Statistic 730.821 471.704
Degrees of freedom 18 18
P-value (Chi-square) 0.000 0.000
Scaling correction factor 1.549
Yuan-Bentler correction (Mplus variant)
Model Test Baseline Model:
Test statistic 8240.138 4616.626
Degrees of freedom 36 36
P-value 0.000 0.000
Scaling correction factor 1.785
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.913 0.901
Tucker-Lewis Index (TLI) 0.826 0.802
Robust Comparative Fit Index (CFI) 0.914
Robust Tucker-Lewis Index (TLI) 0.829
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) 3430.886 3430.886
Scaling correction factor 1.375
for the MLR correction
Loglikelihood unrestricted model (H1) 3796.296 3796.296
Scaling correction factor 1.815
for the MLR correction
Akaike (AIC) -6789.771 -6789.771
Bayesian (BIC) -6614.189 -6614.189
Sample-size adjusted Bayesian (SABIC) -6728.525 -6728.525
Root Mean Square Error of Approximation:
RMSEA 0.202 0.161
90 Percent confidence interval - lower 0.190 0.151
90 Percent confidence interval - upper 0.215 0.171
P-value H_0: RMSEA <= 0.050 0.000 0.000
P-value H_0: RMSEA >= 0.080 1.000 1.000
Robust RMSEA 0.200
90 Percent confidence interval - lower 0.184
90 Percent confidence interval - upper 0.217
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 0.108 0.108
My question is: What should I do to resolve the problem in this situation? I'm learning to do this, so any suggestions (and resources) would be much appreciated.
Thanks in advance!