Dear all,
When I try to build a model including single-indicator latent variables (few of which are dummy coded albeit numeric), I keep on getting this message:
Warning message:
In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, :
lavaan WARNING:
The variance-covariance matrix of the estimated parameters (vcov)
does not appear to be positive definite! The smallest eigenvalue
(= -2.910431e-20) is smaller than zero. This may be a symptom that
the model is not identified.
Should I ignore this or is this something I have to care about?
For the sake of clarity, I am copying-pasting below a very simple CFA model that illustrates my issue:
model<-'
#LV definition
NS =~ a*T1_NS1 + b*T1_NS2 + c*T1_NS3
DA =~ d*T1_DA1 + e*T1_DA2 + f*T1_DA4
Gender =~ 1*T1_Gender #my covariate, being dummy coded 0/1 and numeric
#Scaling the LV with effect coding
a==3-b-c
d==3-e-f
#Residuals
T1_NS1~~T1_NS1
T1_NS2~~T1_NS2
T1_NS3~~T1_NS3
T1_DA1~~T1_DA1
T1_DA2~~T1_DA2
T1_DA4~~T1_DA4
T1_Gender~~0*T1_Gender #none, measured without error
#Intercepts
T1_NS1~i1*1
T1_NS2~i2*1
T1_NS3~i3*1
T1_DA1~i4*1
T1_DA2~i5*1
T1_DA4~i6*1
T1_Gender~0*1 #none, will be estimated at the LV level
#Effect coding for the means
i1==0-i2-i3
i4==0-i5-i6
#Estimations for the LV means/Intercepts
NS~1
DA~1
Gender~1
#Variance-CoVariance
NS ~~ NS + DA + Gender
DA ~~ DA + Gender
Gender ~~ Gender
'
model.fit<-lavaan(model, data.df, estimator="MLR")
Warning message:
In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, :
lavaan WARNING:
The variance-covariance matrix of the estimated parameters (vcov)
does not appear to be positive definite! The smallest eigenvalue
(= 4.825014e-15) is close to zero. This may be a symptom that the
model is not identified.
> print(summary(model.fit, fit.measures=TRUE, standardized=TRUE))
lavaan 0.6-2 ended normally after 73 iterations
Optimization method NLMINB
Number of free parameters 27
Number of equality constraints 4
Number of observations 433
Estimator ML Robust
Model Fit Test Statistic 59.380 44.499
Degrees of freedom 12 12
P-value (Chi-square) 0.000 0.000
Scaling correction factor 1.334
for the Yuan-Bentler correction (Mplus variant)
Model test baseline model:
Minimum Function Test Statistic 1349.128 729.698
Degrees of freedom 21 21
P-value 0.000 0.000
User model versus baseline model:
Comparative Fit Index (CFI) 0.964 0.954
Tucker-Lewis Index (TLI) 0.938 0.920
Robust Comparative Fit Index (CFI) 0.967
Robust Tucker-Lewis Index (TLI) 0.942
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -3225.504 -3225.504
Scaling correction factor 1.501
for the MLR correction
Loglikelihood unrestricted model (H1) -3195.814 -3195.814
Scaling correction factor 1.616
for the MLR correction
Number of free parameters 23 23
Akaike (AIC) 6497.009 6497.009
Bayesian (BIC) 6590.636 6590.636
Sample-size adjusted Bayesian (BIC) 6517.646 6517.646
Root Mean Square Error of Approximation:
RMSEA 0.095 0.079
90 Percent Confidence Interval 0.072 0.120 0.058 0.101
P-value RMSEA <= 0.05 0.001 0.012
Robust RMSEA 0.091
90 Percent Confidence Interval 0.064 0.121
Standardized Root Mean Square Residual:
SRMR 0.045 0.045
Parameter Estimates:
Information Observed
Observed information based on Hessian
Standard Errors Robust.huber.white
Latent Variables:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
NS =~
T1_NS1 (a) 0.911 0.033 28.037 0.000 0.854 0.828
T1_NS2 (b) 1.055 0.026 40.167 0.000 0.988 0.809
T1_NS3 (c) 1.033 0.029 36.027 0.000 0.968 0.920
DA =~
T1_DA1 (d) 1.112 0.086 13.003 0.000 0.706 0.801
T1_DA2 (e) 0.796 0.080 9.933 0.000 0.505 0.682
T1_DA4 (f) 1.092 0.060 18.133 0.000 0.693 0.804
Gender =~
T1_Gender 1.000 0.495 1.000
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
NS ~~
DA 0.306 0.048 6.325 0.000 0.514 0.514
Gender 0.051 0.023 2.195 0.028 0.110 0.110
DA ~~
Gender 0.066 0.017 3.870 0.000 0.209 0.209
Intercepts:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.T1_NS1 (i1) 0.452 0.126 3.573 0.000 0.452 0.438
.T1_NS2 (i2) -0.425 0.102 -4.161 0.000 -0.425 -0.348
.T1_NS3 (i3) -0.026 0.112 -0.236 0.814 -0.026 -0.025
.T1_DA1 (i4) -0.567 0.383 -1.482 0.138 -0.567 -0.643
.T1_DA2 (i5) 0.989 0.364 2.714 0.007 0.989 1.333
.T1_DA4 (i6) -0.422 0.273 -1.545 0.122 -0.422 -0.489
.T1_Gender 0.000 0.000 0.000
NS 3.734 0.048 78.068 0.000 3.987 3.987
DA 4.399 0.034 129.853 0.000 6.926 6.926
Gender 0.568 0.024 23.867 0.000 1.147 1.147
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.T1_NS1 0.333 0.062 5.400 0.000 0.333 0.314
.T1_NS2 0.515 0.058 8.883 0.000 0.515 0.345
.T1_NS3 0.169 0.033 5.075 0.000 0.169 0.153
.T1_DA1 0.279 0.066 4.247 0.000 0.279 0.359
.T1_DA2 0.295 0.058 5.114 0.000 0.295 0.536
.T1_DA4 0.263 0.069 3.827 0.000 0.263 0.354
.T1_Gender 0.000 0.000 0.000
NS 0.877 0.075 11.683 0.000 1.000 1.000
DA 0.403 0.041 9.767 0.000 1.000 1.000
Gender 0.245 0.003 75.645 0.000 1.000 1.000
Constraints:
|Slack|
a - (3-b-c) 0.000
d - (3-e-f) 0.000
i1 - (0-i2-i3) 0.000
i4 - (0-i5-i6) 0.000
NULL
> lavInspect(model.fit, "cov.all")
T1_NS1 T1_NS2 T1_NS3 T1_DA1 T1_DA2 T1_DA4 T1_Gnd NS DA Gender
T1_NS1 1.062
T1_NS2 0.844 1.492
T1_NS3 0.826 0.957 1.106
T1_DA1 0.310 0.359 0.351 0.778
T1_DA2 0.222 0.257 0.251 0.357 0.550
T1_DA4 0.304 0.352 0.345 0.490 0.351 0.744
T1_Gender 0.047 0.054 0.053 0.073 0.052 0.072 0.245
NS 0.799 0.926 0.906 0.340 0.243 0.334 0.051 0.877
DA 0.278 0.322 0.316 0.449 0.321 0.440 0.066 0.306 0.403
Gender 0.047 0.054 0.053 0.073 0.052 0.072 0.245 0.051 0.066 0.245
When I remove "Gender" from the model, everything is fine and gets back to normal....
Could you please share your thoughts with me?
Best,
Nicolas