lavaan WARNING: some estimated ov variances are negative

19,302 views
Skip to first unread message

ZXM

unread,
Feb 24, 2017, 10:34:35 AM2/24/17
to lavaan
Hello, 

I'm running a CFA model in lavaan and I had a warning saying "some estimated ov variances are negative". I have no idea how to deal with it. Could you help me with it? Thank you. 

> attitude <- 'att =~att1+att2+att3'
> fit <- cfa (attitude, data=CFAm)
Warning message:
In lav_object_post_check(lavobject) :
  lavaan WARNING: some estimated ov variances are negative
> summary(fit,fit.measures=TRUE,modindices = TRUE)
lavaan (0.5-23.1026) converged normally after  45 iterations

  Number of observations                           281

  Estimator                                         ML
  Minimum Function Test Statistic                0.000
  Degrees of freedom                                 0
  Minimum Function Value               0.0000000000000

Model test baseline model:

  Minimum Function Test Statistic              488.993
  Degrees of freedom                                 3
  P-value                                        0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    1.000
  Tucker-Lewis Index (TLI)                       1.000

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)              -1076.551
  Loglikelihood unrestricted model (H1)      -1076.551

  Number of free parameters                          6
  Akaike (AIC)                                2165.103
  Bayesian (BIC)                              2186.933
  Sample-size adjusted Bayesian (BIC)         2167.907

Root Mean Square Error of Approximation:

  RMSEA                                          0.000
  90 Percent Confidence Interval          0.000  0.000
  P-value RMSEA <= 0.05                             NA

Standardized Root Mean Square Residual:

  SRMR                                           0.000

Parameter Estimates:

  Information                                 Expected
  Standard Errors                             Standard

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)
  att =~                                              
    att1              1.000                           
    att2             15.204    5.846    2.601    0.009
    att3             13.477    4.530    2.975    0.003

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .att1              0.367    0.031   11.832    0.000
   .att2             -0.100    0.425   -0.234    0.815
   .att3              0.549    0.337    1.629    0.103
    att               0.011    0.008    1.414    0.157

Modification Indices:

[1] lhs      op       rhs      mi       epc      sepc.lv  sepc.all sepc.nox
<0 rows> (or 0-length row.names)

Mark Seeto

unread,
Feb 24, 2017, 9:41:22 PM2/24/17
to lavaan

Alex Schoemann

unread,
Feb 27, 2017, 9:13:52 AM2/27/17
to lavaan
You might be seeing this error message due to a scaling issue. When variables in your model have very different variances it can cause some issues in estimation. In this case the model implied variances for your three variables are: 0.38, 2.44, and 2.56.

There are two likely possibilities here: the variables are measured on different scales, or there's a missing value code in the data (e.g. -999) that isn't being read as missing when the data are read into R. In either case it's an easy fix (rescale the variables to be in a similar metric, or check how R is reading in missing values).

Alex

Zulkhairi Azizi Zainal Abidin

unread,
Jul 27, 2018, 7:09:55 AM7/27/18
to lavaan
Hi Alex,

I conducted CFA and got the same lavaan warning = "lavaan WARNING: some estimated ov variances are negative"
The completely standardized lambda for one latent variable is negative, and the items for this latent are reverse coded.
Do you think reverse coded will have the same effect too?

Thank you,

Zul

Terrence Jorgensen

unread,
Jul 29, 2018, 7:05:54 PM7/29/18
to lavaan
The completely standardized lambda for one latent variable is negative, and the items for this latent are reverse coded.
Do you think reverse coded will have the same effect too?

No.  The explained variance is the squared factor loading, so it does not matter whether it is negative or positive.  As Mark posted, I would suggest reading the following:


Terrence D. Jorgensen
Postdoctoral Researcher, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Message has been deleted

Terrence Jorgensen

unread,
Sep 2, 2021, 3:44:59 PM9/2/21
to lavaan
Any number of past posts with the search term "negative variance" can be found that will lead you to this article:


Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

williams....@gmail.com

unread,
Sep 3, 2021, 4:45:33 AM9/3/21
to lavaan
Hi Terrence, 

I have read this article and initially did not think I could use these tests with binary data. 
I apologize for my incompetence, but I am having a hard time understanding how I can test if my model is misspecified in R and what to do if it is misspecified. 

1. I understand that if my CI includes 0, the model is not misspecified. The parameterEstimates(fit_Females_configural_complete) and parameterEstimates(fit_Females_configural_complete, level = 0.95, boot.ci.type="perc") reveal that the ci.lower and upper are the same: both are -0.018. Is this enough to suggest that my model is misspecified? 

16 Other.Substance.Abuse   |                    t1  2.524 0.009 286.534      0    2.506    2.541
17         Schizophrenia   |                    t1  2.764 0.012 236.675      0    2.742    2.787
18      Bipolar.Disorder   |                    t1  2.326 0.007 325.535      0    2.312    2.340
19            Depression  ~~            Depression  0.354 0.000      NA     NA    0.354    0.354
20      Anxiety.Disorder  ~~      Anxiety.Disorder  0.446 0.000      NA     NA    0.446    0.446
21             Self.Harm  ~~             Self.Harm  0.341 0.000      NA     NA    0.341    0.341
22                  PTSD  ~~                  PTSD  0.356 0.000      NA     NA    0.356    0.356
23                   OCD  ~~                   OCD  0.620 0.000      NA     NA    0.620    0.620
24         Alcohol.Abuse  ~~         Alcohol.Abuse  0.470 0.000      NA     NA    0.470    0.470
25 Other.Substance.Abuse  ~~ Other.Substance.Abuse  0.382 0.000      NA     NA    0.382    0.382
26         Schizophrenia  ~~         Schizophrenia  0.668 0.000      NA     NA    0.668    0.668
27      Bipolar.Disorder  ~~      Bipolar.Disorder -0.018 0.000      NA     NA   -0.018   -0.018
28         Internalizing  ~~         Internalizing  0.646 0.004 161.285      0    0.638    0.654
29         Externalizing  ~~         Externalizing  0.530 0.014  38.299      0    0.503    0.557
30     Thought_Disorders  ~~     Thought_Disorders  0.332 0.020  16.615      0    0.293    0.372
31         Internalizing  ~~         Externalizing  0.446 0.005  91.061      0    0.437    0.456
32         Internalizing  ~~     Thought_Disorders  0.233 0.011  20.550      0    0.211    0.255
33         Externalizing  ~~     Thought_Disorders  0.152 0.010  15.327      0    0.132    0.171

2. If the model is misspecified, I need to get the empirical bootstrap CI. But will this allow me to use the model?  Is there a way to do this in lavaan (I know the 2012 article says there is currently no way in R, but maybe things have changed)? 
I found the bootstrapped function but can it work for estimating variance and variance CI? (I only saw FUN = "coef"). 
> T.boot <- bootstrapLavaan(fit_Females_configural, R=10, type="ordinary",
+                           FUN=fitMeasures, fit.measures="chisq")
> T.orig <- fitMeasures(fit_Females_configural, "chisq")
> pvalue.boot <- length(which(T.boot > T.orig))/length(T.boot)
> pvalue.boot
[1] 0.8

I can't compute the bootstrapped SE with the cfa function because my variables are binary. 

Again, I apologize for my incompetence. 

Camille 

williams....@gmail.com

unread,
Sep 3, 2021, 5:12:14 AM9/3/21
to lavaan

I looked at the modindices and once I add "Depression ~~ Bipolar.Disorder" to the CFA model, my Bipolar.Disorder variance is no longer negative. In my case adding, Depression ~~ Bipolar.Disorder makes complete theoretical sense. 

> modindices(fit_Females_configural, sort = TRUE, maximum.number = 10)
                 lhs op              rhs      mi    epc sepc.lv sepc.all sepc.nox
62     Externalizing =~        Self.Harm 144.105  0.391   0.285    0.285    0.285
90         Self.Harm ~~    Alcohol.Abuse 128.873  0.093   0.093    0.257    0.257
81  Anxiety.Disorder ~~        Self.Harm 109.430 -0.069  -0.069   -0.180   -0.180
67 Thought_Disorders =~       Depression  86.457  0.113   0.115    0.115    0.115
83  Anxiety.Disorder ~~              OCD  72.094  0.122   0.122    0.214    0.214
69 Thought_Disorders =~        Self.Harm  64.681 -0.108  -0.109   -0.109   -0.109
82  Anxiety.Disorder ~~             PTSD  62.724  0.056   0.056    0.132    0.132
60     Externalizing =~       Depression  59.282 -0.238  -0.173   -0.173   -0.173
89         Self.Harm ~~              OCD  57.349 -0.121  -0.121   -0.294   -0.294
79        Depression ~~ Bipolar.Disorder  51.668  0.070   0.070    0.717    0.717

Terrence Jorgensen

unread,
Sep 17, 2021, 5:09:12 PM9/17/21
to lavaan
initially did not think I could use these tests with binary data

Oh, of course, your outcome was binary.  Sorry, I should have provided more information about that case (also posted before, but not nearly as often).  

When the negative residual variance is not estimated but implied by another model parameter, the other parameter should also be out of bounds.  Typically, I see this in factor models when an indicator has negative residual variance because the standardized loading > 1.  So an equivalent test is to check whether the CI around the standardized loading includes values < 1 (which would imply residual variance > 0).

If you are running a probit regression with multiple predictors, it is more complicated, but you could still define a function of parameters that is the total explained variance, which would be > 1.  Then you could check its CI.

But it looks like the problem was resolved by adding a sensible parameter, so that's good news.
Reply all
Reply to author
Forward
0 new messages