covariance matrix of latent variables is not positive definite

3,667 views
Skip to first unread message
Message has been deleted

Aiden Loe

unread,
May 4, 2014, 10:12:12 AM5/4/14
to lav...@googlegroups.com
Hi Yves, 

Could I just check with you, a warning message suggest that the latent variables are not positive definite. After inspecting, it all seems to be positive. 
Is it because the Planning_organising and Analytical Thinking are too similar to one another? 


> modelcfa3.1 <- cfa(model=model3.1, orthogonal=F, std.lv=T, data=SJT,  group.equal=c("loadings", "thresholds"), estimator="WLSMV", ordered=c('RB1bScored', 'RB1cScored', 'RB1dScored', 'RB2aScored', 'RB2cScored', 'RB2dScored', 'RB3aScored', 'RB3bScored', 'AR2bScored', 'AR2cScored', 'AR2dScored', 'AR3bScored', 'AR3cScored', 'AR4aScored', 'AR4bScored', 'AR4cScored', 'AT2aScored', 'AT2cScored', 'AT4aScored', 'AT4bScored', 'AT4cScored', 'PO2bScored', 'PO2cScored', 'PO2dScored'))

Warning message:
In lavaan::lavaan(model = model3.1, data = SJT, orthogonal = F,  :
  lavaan WARNING: covariance matrix of latent variables is not positive definite; use inspect(fit,"cov.lv") to investigate.

> inspect(modelcfa3.1, "cov.lv")

                                       Rltn_B Achv_R Anly_T Plnn_O
Relationship_Building    1.000                      
Achieving_Results         0.647  1.000               
Analytical_Thinking        0.186  0.755  1.000        
Planning_Organising      0.168  0.540  0.978  1.000 

Thank you for helping. 
Kind regards,
Aiden

Edward Rigdon

unread,
May 4, 2014, 12:18:17 PM5/4/14
to lav...@googlegroups.com
Aiden--
     Probably.  You would need a large sample size to distinguish r = 0.978 from r = 1.000.  But remember that the 0.978 correlation itself may be only a symptom of another problem in the model.  Evaluate the model overall--don't just focus on this one number.
--Ed Rigdon

Sent from my iPad
--
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 post to this group, send email to lav...@googlegroups.com.
Visit this group at http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.

Aiden Loe

unread,
May 5, 2014, 4:50:54 AM5/5/14
to lav...@googlegroups.com
Hi Ed, 

Thanks for the heads up on evaluating the model. I set the variances to 1 on the latent factors so that I can get estimates on all the items in the model. While the model estimates are not fanastic, I don't seems to see any negative loadings. The threshold do contain negativity and I was wondering if that will influence the positivity of the matrix. 

> modelcfa3.1 <- cfa(model=model3.1, orthogonal=F, std.lv=T, data=SJT, estimator="WLSMV", ordered=c('RB1bScored', 'RB1cScored', 'RB1dScored', 'RB2aScored', 'RB2cScored', 'RB2dScored', 'RB3aScored', 'RB3bScored', 'AR2bScored', 'AR2cScored', 'AR2dScored', 'AR3bScored', 'AR3cScored', 'AR4aScored', 'AR4bScored', 'AR4cScored', 'AT2aScored', 'AT2cScored', 'AT4aScored', 'AT4bScored', 'AT4cScored', 'PO2bScored', 'PO2cScored', 'PO2dScored'))
Warning message:
In lavaan::lavaan(model = model3.1, data = SJT, orthogonal = F,  :
  lavaan WARNING: covariance matrix of latent variables is not positive definite; use inspect(fit,"cov.lv") to investigate.
> summary(modelcfa3.1, standardized=T, modindices = F, fit.measures=T)
lavaan (0.5-16) converged normally after  52 iterations

  Number of observations                          7280

  Estimator                                       DWLS      Robust
  Minimum Function Test Statistic             2353.769    2427.616
  Degrees of freedom                               246         246
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  0.974
  Shift parameter                                           11.759
    for simple second-order correction (Mplus variant)

Model test baseline model:

  Minimum Function Test Statistic             6630.419    6128.183
  Degrees of freedom                               276         276
  P-value                                        0.000       0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    0.668       0.627
  Tucker-Lewis Index (TLI)                       0.628       0.582

Root Mean Square Error of Approximation:

  RMSEA                                          0.034       0.035
  90 Percent Confidence Interval          0.033  0.036       0.034  0.036
  P-value RMSEA <= 0.05                          1.000       1.000

Weighted Root Mean Square Residual:

  WRMR                                           2.751       2.751

Parameter estimates:

  Information                                 Expected
  Standard Errors                           Robust.sem

                   Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
Latent variables:
  Relationship_Building =~
    RB1bScored        0.451    0.020   22.817    0.000    0.451    0.451
    RB1cScored        0.429    0.018   23.209    0.000    0.429    0.429
    RB1dScored        0.259    0.018   14.115    0.000    0.259    0.259
    RB2aScored        0.198    0.019   10.384    0.000    0.198    0.198
    RB2cScored        0.349    0.020   17.195    0.000    0.349    0.349
    RB2dScored        0.383    0.018   20.822    0.000    0.383    0.383
    RB3aScored        0.387    0.019   20.254    0.000    0.387    0.387
    RB3bScored        0.403    0.022   18.696    0.000    0.403    0.403
  Achieving_Results =~
    AR2bScored        0.445    0.021   20.762    0.000    0.445    0.445
    AR2cScored        0.279    0.021   13.282    0.000    0.279    0.279
    AR2dScored        0.311    0.027   11.574    0.000    0.311    0.311
    AR3bScored        0.233    0.020   11.912    0.000    0.233    0.233
    AR3cScored        0.276    0.019   14.461    0.000    0.276    0.276
    AR4aScored        0.211    0.019   11.026    0.000    0.211    0.211
    AR4bScored        0.358    0.023   15.762    0.000    0.358    0.358
    AR4cScored        0.344    0.021   16.360    0.000    0.344    0.344
  Analytical_Thinking =~
    AT2aScored        0.126    0.024    5.299    0.000    0.126    0.126
    AT2cScored        0.299    0.032    9.312    0.000    0.299    0.299
    AT4aScored        0.310    0.034    9.096    0.000    0.310    0.310
    AT4bScored        0.129    0.024    5.450    0.000    0.129    0.129
    AT4cScored        0.035    0.025    1.391    0.164    0.035    0.035
  Planning_Organising =~
    PO2bScored        0.070    0.029    2.421    0.015    0.070    0.070
    PO2cScored        0.417    0.054    7.675    0.000    0.417    0.417
    PO2dScored        0.174    0.028    6.233    0.000    0.174    0.174

Covariances:
  Relationship_Building ~~
    Achivng_Rslts     0.647    0.028   23.140    0.000    0.647    0.647
    Anlytcl_Thnkn     0.186    0.051    3.624    0.000    0.186    0.186
    Plnnng_Orgnsn     0.168    0.051    3.314    0.001    0.168    0.168
  Achieving_Results ~~
    Anlytcl_Thnkn     0.755    0.076    9.902    0.000    0.755    0.755
    Plnnng_Orgnsn     0.540    0.079    6.842    0.000    0.540    0.540
  Analytical_Thinking ~~
    Plnnng_Orgnsn     0.978    0.152    6.425    0.000    0.978    0.978

Intercepts:
    Rltnshp_Bldng     0.000                               0.000    0.000
    Achivng_Rslts     0.000                               0.000    0.000
    Anlytcl_Thnkn     0.000                               0.000    0.000
    Plnnng_Orgnsn     0.000                               0.000    0.000

Thresholds:
    RB1bScored|t1    -0.153    0.015  -10.403    0.000   -0.153   -0.153
    RB1cScored|t1    -0.681    0.016  -42.546    0.000   -0.681   -0.681
    RB1cScored|t2    -0.004    0.015   -0.305    0.761   -0.004   -0.004
    RB1dScored|t1    -0.531    0.015  -34.336    0.000   -0.531   -0.531
    RB1dScored|t2     0.613    0.016   38.975    0.000    0.613    0.613
    RB2aScored|t1    -1.299    0.020  -64.263    0.000   -1.299   -1.299
    RB2aScored|t2     0.237    0.015   15.994    0.000    0.237    0.237
    RB2cScored|t1    -0.114    0.015   -7.757    0.000   -0.114   -0.114
    RB2dScored|t1    -0.886    0.017  -52.153    0.000   -0.886   -0.886
    RB2dScored|t2    -0.053    0.015   -3.609    0.000   -0.053   -0.053
    RB3aScored|t1    -0.740    0.016  -45.536    0.000   -0.740   -0.740
    RB3aScored|t2    -0.151    0.015  -10.263    0.000   -0.151   -0.151
    RB3bScored|t1    -0.677    0.016  -42.344    0.000   -0.677   -0.677
    AR2bScored|t1    -0.334    0.015  -22.295    0.000   -0.334   -0.334
    AR2cScored|t1     0.109    0.015    7.405    0.000    0.109    0.109
    AR2dScored|t1    -1.186    0.019  -61.986    0.000   -1.186   -1.186
    AR3bScored|t1    -1.420    0.022  -65.840    0.000   -1.420   -1.420
    AR3bScored|t2    -0.004    0.015   -0.305    0.761   -0.004   -0.004
    AR3cScored|t1    -0.817    0.017  -49.177    0.000   -0.817   -0.817
    AR3cScored|t2     0.308    0.015   20.594    0.000    0.308    0.308
    AR4aScored|t1    -0.575    0.016  -36.856    0.000   -0.575   -0.575
    AR4aScored|t2     0.077    0.015    5.226    0.000    0.077    0.077
    AR4bScored|t1    -0.599    0.016  -38.179    0.000   -0.599   -0.599
    AR4cScored|t1     0.233    0.015   15.714    0.000    0.233    0.233
    AT2aScored|t1    -1.481    0.022  -66.286    0.000   -1.481   -1.481
    AT2aScored|t2     0.211    0.015   14.264    0.000    0.211    0.211
    AT2cScored|t1     0.042    0.015    2.836    0.005    0.042    0.042
    AT4aScored|t1    -0.665    0.016  -41.758    0.000   -0.665   -0.665
    AT4bScored|t1    -1.421    0.022  -65.849    0.000   -1.421   -1.421
    AT4bScored|t2     0.346    0.015   23.017    0.000    0.346    0.346
    AT4cScored|t1    -0.023    0.015   -1.594    0.111   -0.023   -0.023
    PO2bScored|t1     0.180    0.015   12.205    0.000    0.180    0.180
    PO2cScored|t1     0.111    0.015    7.569    0.000    0.111    0.111
    PO2dScored|t1    -1.536    0.023  -66.505    0.000   -1.536   -1.536
    PO2dScored|t2     0.223    0.015   15.012    0.000    0.223    0.223

Variances:
    RB1bScored        0.796                               0.796    0.796
    RB1cScored        0.816                               0.816    0.816
    RB1dScored        0.933                               0.933    0.933
    RB2aScored        0.961                               0.961    0.961
    RB2cScored        0.878                               0.878    0.878
    RB2dScored        0.853                               0.853    0.853
    RB3aScored        0.851                               0.851    0.851
    RB3bScored        0.837                               0.837    0.837
    AR2bScored        0.802                               0.802    0.802
    AR2cScored        0.922                               0.922    0.922
    AR2dScored        0.903                               0.903    0.903
    AR3bScored        0.946                               0.946    0.946
    AR3cScored        0.924                               0.924    0.924
    AR4aScored        0.956                               0.956    0.956
    AR4bScored        0.872                               0.872    0.872
    AR4cScored        0.882                               0.882    0.882
    AT2aScored        0.984                               0.984    0.984
    AT2cScored        0.911                               0.911    0.911
    AT4aScored        0.904                               0.904    0.904
    AT4bScored        0.983                               0.983    0.983
    AT4cScored        0.999                               0.999    0.999
    PO2bScored        0.995                               0.995    0.995
    PO2cScored        0.826                               0.826    0.826
    PO2dScored        0.970                               0.970    0.970
    Rltnshp_Bldng     1.000                               1.000    1.000
    Achivng_Rslts     1.000                               1.000    1.000
    Anlytcl_Thnkn     1.000                               1.000    1.000
    Plnnng_Orgnsn     1.000                               1.000    1.000

Aiden Loe

unread,
May 5, 2014, 4:55:17 AM5/5/14
to lav...@googlegroups.com
Apologises, I press the wrong key. Another possibly is that the first item for Planning_Organising construct has such low factor loading that it is not considered as being related to the model, leading to model under identification. 

I am relatively new to SEM and I am trying to make sure that my steps in the analysis aren't wrong. 

Thank you so much for helping!
Kind regards,
Aiden

Edward Rigdon

unread,
May 5, 2014, 11:15:37 AM5/5/14
to lav...@googlegroups.com
Aiden--
     I'm sorry to be negative here, but yes, the third and fourth factors especially will not be well-defined and stable, because there are few indicators and the indicators are weak.  This may well explain the factor correlation so close to 1.0.  Of course the chi-square value is poor, with n > 7,000, but CFI is also quite poor, suggesting--as the weak Loadings also suggest--that the indicators do not strongly covary.  In other words, there is not that much covariance to explain.
     The negative thresholds are not an issue--those are like standard normal cut points, so a 0 value means that the threshold falls halfway through the data, and negative values just mean that less than half the data falls to the left of the threshold.  You could generate frequencies for your observed variables and see that the threshold values make sense.
--Ed Rigdon

Sent from my iPad

Aiden Loe

unread,
May 5, 2014, 1:26:29 PM5/5/14
to lav...@googlegroups.com
Hi Edward, 

Thank you for reviewing the analysis. The assumptions I had in mind were the same as you unfortunately, less for the threshold. Helps a lot with a second opinion. 

Kind regards,
Aiden 

yrosseel

unread,
May 7, 2014, 11:25:32 AM5/7/14
to lav...@googlegroups.com
On 05/04/2014 04:12 PM, Aiden Loe wrote:
> Hi Yves,
>
> Could I just check with you, a warning message suggest that the latent
> variables are not positive definite. After inspecting, it all seems to
> be positive.

Perhaps I should clarify the meaning of positive definite. A symmetric
matrix is positive definite if all its eigenvalues are (strictly) larger
than zero. So you can test this with:

eigen( inspect(modelcfa3.1, "cov.lv") )$values

If the negative value is really, really tiny, it is probably safe, and
you can ignore the warning.

But judging from your factor correlations, it looks like the two latent
variables 'Analytical_Thinking' and 'Planning_Organising' (corr = 0.978)
are almost identical. I would remove one of the two, or rethink the
measurement model (ie the indicators) for these two latent variables.

Yves.

yrosseel

unread,
May 7, 2014, 11:27:58 AM5/7/14
to lav...@googlegroups.com
On 05/05/2014 10:50 AM, Aiden Loe wrote:
> see any negative loadings. The threshold do contain negativity and I was
> wondering if that will influence the positivity of the matrix.

No. Thresholds can be negative. They represent the 'cut-off' values of
the 'underlying' (latent) continuous response.

Yves.

Michael Paul Grosz

unread,
Aug 26, 2014, 6:48:03 AM8/26/14
to lav...@googlegroups.com
Dear Yves Rosseel,

You mentioned that we can ignore the warning if the negative value of the last eigenvalue is really tiny.
The last eigenvalue of my covariance matrix is negative:
> eigen(inspect(NARQ.NPI.fit, "cov.lv"))$values
 [1]  1.48731263  0.64165345  0.42265603  0.39206208  0.21803107  0.17784040  0.14245618  0.05661914  0.03808006 -0.0770958

I think the reason why I have this negative eigenvalue is that I have constructs in my model that are highly positively correlated. However, I would like to keep both constructs separately in my model because I want to see to what degree two personality instruments measure the same latent traits. I would like to see how strongly the latent traits of the two personality instruments correlate.
So, I would be happy to ignore the warning and interpret the summary of the output that I got.
However, I know that if the last eigenvalue is zero or negative, the determinant will be 0 or negative as well and the determinant might be used for some computations by lavaan. So, just to be on the safe side, I wonder: Does lavaan use the determinant for further computations? and is a negative eigenvalue and determinant then problematic?
My ultimate question is: can I rely on the output of the CFA even though the last eigenvalue is negative (-0.0770958)?

yrosseel

unread,
Sep 4, 2014, 1:39:45 PM9/4/14
to lav...@googlegroups.com
On 08/26/2014 12:48 PM, Michael Paul Grosz wrote:
> Dear Yves Rosseel,
>
> You mentioned that we can ignore the warning if the negative value of
> the last eigenvalue is really tiny. The last eigenvalue of my
> covariance matrix is negative:
>
>> eigen(inspect(NARQ.NPI.fit, "cov.lv"))$values
> [1] 1.48731263 0.64165345 0.42265603 0.39206208 0.21803107
> 0.17784040 0.14245618 0.05661914 0.03808006 -0.0770958

This is not tiny. Tiny would be -0.000000000001. So, this can not be
ignored.

> zero or negative, the determinant will be 0 or negative as well and
> the determinant might be used for some computations by lavaan. So,
> just to be on the safe side, I wonder: Does lavaan use the
> determinant for further computations?

It does not use the determinant of the (model-implied) covariance matrix
of the latent variables directly. But I am not sure how this affects the
quality of the remaining results.

Yves.

Amonet

unread,
Mar 25, 2018, 11:24:09 AM3/25/18
to lavaan
Hi, 

I got an EV of -0.0006818072 and hence Lavaan reported a NPD of the LV matrix. 
I was wondering if someone knows of some study / paper to find out what the implication of this may be on the remaining results? Or if he / she knows this, could give an explanation. 

Would be greatly appreciated, 

Amonet

kma...@aol.com

unread,
Mar 25, 2018, 11:36:33 PM3/25/18
to lavaan
Amonet,

  Wothke, W. (1993).  Nonpositive definite matrices in structural modeling.  In K. A. Bollen and J. S. Long (Eds), Testing structural equation models (p. 256-293).  Newbury Park, CA: Sage Publications.

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/

Amonet

unread,
Mar 26, 2018, 4:49:56 AM3/26/18
to lavaan
Thank you Keith!
Reply all
Reply to author
Forward
0 new messages