# Heywood case with negative variance and calculation of CI with multiple imputations

858 views

### Burt Hatch

Nov 17, 2019, 9:57:56 PM11/17/19
to lavaan
Hi,

I have a model with negative estimated observed variance and I would like to calculate CIs for this.

I am estimating a bifactor model with ordinal data for the purpose of determining proportion of variance attributable to a general factor vs specific factors.
I am estimating the model using 100 multiply imputed data sets with a sample of 452 using the semTools cfa.mi function. The output of the model is pasted below. One Item (.CSH_S4a) has a negative estimated variance. My question is, how do I calculate the CI for this variance using any of the methods in "Savalei, V., & Kolenikov, S. (2008). Constrained versus unconstrained estimation in structural equation modeling. Psychological Methods, 13(2), 150." ?

Sorry if I am missing something obvious here and thank you in advance for your time.

Burt

Parameter Estimates:

Information                                 Expected
Information saturated (h1) model        Unstructured
Standard errors                           Robust.sem

Latent Variables:
Estimate  Std.Err  t-value       df  P(>|t|) ci.lower ci.upper
A =~
CSH_B3a           0.155    0.074    2.098      Inf    0.036    0.010    0.299
CSH_S4a           0.793    0.103    7.663      Inf    0.000    0.590    0.996
CSH_S5a           0.430    0.080    5.406      Inf    0.000    0.274    0.586
CSH_S2a           0.443    0.073    6.103      Inf    0.000    0.301    0.585
CSH_B11a          0.069    0.081    0.852      Inf    0.394   -0.090    0.229
CSH_B2a           0.071    0.087    0.815      Inf    0.415   -0.100    0.243
B =~
CSH_B8a           0.737    0.037   20.089      Inf    0.000    0.665    0.808
CSH_B13a          0.573    0.054   10.691      Inf    0.000    0.468    0.679
CSH_B4a           0.842    0.036   23.644      Inf    0.000    0.772    0.912
CSH_B5a           0.730    0.041   17.997      Inf    0.000    0.650    0.809
CSH_S10a          0.272    0.063    4.316      Inf    0.000    0.149    0.396
C =~
CSH_S19a          0.461    0.083    5.558      Inf    0.000    0.299    0.624
CSH_W2a           0.557    0.075    7.468      Inf    0.000    0.411    0.703
CSH_S7a           0.377    0.089    4.247      Inf    0.000    0.203    0.551
CSH_S8a           0.213    0.073    2.924      Inf    0.003    0.070    0.355
CSH_W1a           0.506    0.078    6.515      Inf    0.000    0.354    0.658
D =~
CSH_M7a           0.646    0.049   13.058      Inf    0.000    0.549    0.743
CSH_M6a           0.791    0.035   22.329      Inf    0.000    0.721    0.860
CSH_M4a           0.422    0.052    8.155      Inf    0.000    0.321    0.524
CSH_D3a          -0.019    0.060   -0.320      Inf    0.749   -0.137    0.098
CSH_M5a           0.861    0.030   28.740      Inf    0.000    0.802    0.919
CSH_M2a           0.909    0.031   29.240      Inf    0.000    0.848    0.970
G =~
CSH_B3a           0.536    0.050   10.613      Inf    0.000    0.437    0.635
CSH_S4a           0.711    0.053   13.491      Inf    0.000    0.608    0.814
CSH_S5a           0.487    0.065    7.438      Inf    0.000    0.359    0.615
CSH_S2a           0.710    0.043   16.345      Inf    0.000    0.625    0.796
CSH_B11a          0.673    0.044   15.246      Inf    0.000    0.587    0.760
CSH_B2a           0.645    0.054   11.932      Inf    0.000    0.539    0.751
CSH_B8a           0.486    0.052    9.266      Inf    0.000    0.383    0.589
CSH_B13a          0.514    0.055    9.325      Inf    0.000    0.406    0.622
CSH_B4a           0.526    0.052   10.144      Inf    0.000    0.424    0.627
CSH_B5a           0.447    0.057    7.893      Inf    0.000    0.336    0.558
CSH_S10a          0.449    0.057    7.898      Inf    0.000    0.337    0.560
CSH_S19a          0.403    0.067    6.024      Inf    0.000    0.272    0.534
CSH_W2a           0.607    0.054   11.214      Inf    0.000    0.501    0.713
CSH_S7a           0.313    0.070    4.466      Inf    0.000    0.176    0.451
CSH_S8a           0.569    0.048   11.885      Inf    0.000    0.475    0.662
CSH_W1a           0.539    0.050   10.887      Inf    0.000    0.442    0.636
CSH_M7a           0.377    0.064    5.861      Inf    0.000    0.251    0.503
CSH_M6a           0.316    0.066    4.771      Inf    0.000    0.186    0.445
CSH_M4a           0.437    0.057    7.700      Inf    0.000    0.325    0.548
CSH_D3a           0.380    0.059    6.428 4801.702    0.000    0.264    0.496
CSH_M5a           0.098    0.061    1.594      Inf    0.111   -0.022    0.218
CSH_M2a           0.089    0.069    1.276      Inf    0.202   -0.047    0.224

Covariances:
Estimate  Std.Err  t-value       df  P(>|t|) ci.lower ci.upper
A ~~
G                 0.000                                        0.000    0.000
B ~~
G                 0.000                                        0.000    0.000
C ~~
G                 0.000                                        0.000    0.000
D ~~
G                 0.000                                        0.000    0.000
A ~~
B                 0.000                                        0.000    0.000
C                 0.000                                        0.000    0.000
D                 0.000                                        0.000    0.000
B ~~
C                 0.000                                        0.000    0.000
D                 0.000                                        0.000    0.000
C ~~
D                 0.000                                        0.000    0.000

Intercepts:
Estimate  Std.Err  t-value       df  P(>|t|) ci.lower ci.upper
.CSH_B3a           0.000                                        0.000    0.000
.CSH_S4a           0.000                                        0.000    0.000
.CSH_S5a           0.000                                        0.000    0.000
.CSH_S2a           0.000                                        0.000    0.000
.CSH_B11a          0.000                                        0.000    0.000
.CSH_B2a           0.000                                        0.000    0.000
.CSH_B8a           0.000                                        0.000    0.000
.CSH_B13a          0.000                                        0.000    0.000
.CSH_B4a           0.000                                        0.000    0.000
.CSH_B5a           0.000                                        0.000    0.000
.CSH_S10a          0.000                                        0.000    0.000
.CSH_S19a          0.000                                        0.000    0.000
.CSH_W2a           0.000                                        0.000    0.000
.CSH_S7a           0.000                                        0.000    0.000
.CSH_S8a           0.000                                        0.000    0.000
.CSH_W1a           0.000                                        0.000    0.000
.CSH_M7a           0.000                                        0.000    0.000
.CSH_M6a           0.000                                        0.000    0.000
.CSH_M4a           0.000                                        0.000    0.000
.CSH_D3a           0.000                                        0.000    0.000
.CSH_M5a           0.000                                        0.000    0.000
.CSH_M2a           0.000                                        0.000    0.000
A                 0.000                                        0.000    0.000
B                 0.000                                        0.000    0.000
C                 0.000                                        0.000    0.000
D                 0.000                                        0.000    0.000
G                 0.000                                        0.000    0.000

Thresholds:
Estimate  Std.Err  t-value       df  P(>|t|) ci.lower ci.upper
CSH_B3a|t1        0.058    0.057    1.021      Inf    0.307   -0.053    0.169
CSH_B3a|t2        0.999    0.068   14.645      Inf    0.000    0.865    1.132
CSH_S4a|t1        0.476    0.059    8.074      Inf    0.000    0.361    0.592
CSH_S4a|t2        1.250    0.076   16.457      Inf    0.000    1.101    1.399
CSH_S5a|t1        0.845    0.065   13.086      Inf    0.000    0.718    0.971
CSH_S5a|t2        1.637    0.095   17.255      Inf    0.000    1.451    1.823
CSH_S2a|t1        0.231    0.057    4.050      Inf    0.000    0.119    0.343
CSH_S2a|t2        1.217    0.075   16.280      Inf    0.000    1.071    1.364
CSH_B11a|t1       0.058    0.057    1.019      Inf    0.308   -0.053    0.169
CSH_B11a|t2       1.050    0.070   15.088      Inf    0.000    0.914    1.187
CSH_B2a|t1        0.569    0.060    9.486      Inf    0.000    0.452    0.687
CSH_B2a|t2        1.514    0.088   17.255      Inf    0.000    1.342    1.686
CSH_B8a|t1        0.115    0.057    2.030      Inf    0.042    0.004    0.226
CSH_B8a|t2        0.510    0.059    8.600      Inf    0.000    0.394    0.627
CSH_B13a|t1       0.530    0.060    8.882      Inf    0.000    0.413    0.647
CSH_B13a|t2       0.957    0.067   14.252      Inf    0.000    0.826    1.089
CSH_B4a|t1        0.227    0.057    3.978      Inf    0.000    0.115    0.339
CSH_B4a|t2        0.543    0.060    9.079      Inf    0.000    0.426    0.660
CSH_B5a|t1        0.316    0.058    5.485      Inf    0.000    0.203    0.429
CSH_B5a|t2        0.707    0.062   11.399      Inf    0.000    0.585    0.828
CSH_S10a|t1       0.433    0.059    7.388      Inf    0.000    0.318    0.548
CSH_S10a|t2       1.117    0.072   15.564      Inf    0.000    0.976    1.258
CSH_S19a|t1       0.735    0.063   11.642      Inf    0.000    0.611    0.859
CSH_S19a|t2       1.981    0.129   15.310      Inf    0.000    1.727    2.234
CSH_W2a|t1        0.500    0.060    8.397      Inf    0.000    0.383    0.617
CSH_W2a|t2        1.406    0.083   17.008      Inf    0.000    1.244    1.568
CSH_S7a|t1        0.731    0.062   11.693      Inf    0.000    0.608    0.853
CSH_S7a|t2        2.133    0.141   15.151      Inf    0.000    1.857    2.409
CSH_S8a|t1       -0.373    0.058   -6.408      Inf    0.000   -0.487   -0.259
CSH_S8a|t2        0.778    0.063   12.274      Inf    0.000    0.654    0.902
CSH_W1a|t1       -0.269    0.058   -4.667      Inf    0.000   -0.382   -0.156
CSH_W1a|t2        0.813    0.064   12.647      Inf    0.000    0.687    0.940
CSH_M7a|t1        0.695    0.062   11.165      Inf    0.000    0.573    0.817
CSH_M7a|t2        1.598    0.095   16.869      Inf    0.000    1.412    1.783
CSH_M6a|t1        0.655    0.062   10.619      Inf    0.000    0.534    0.776
CSH_M6a|t2        1.591    0.094   16.917      Inf    0.000    1.407    1.775
CSH_M4a|t1        0.234    0.058    4.075      Inf    0.000    0.122    0.347
CSH_M4a|t2        1.673    0.099   16.879      Inf    0.000    1.479    1.867
CSH_D3a|t1       -0.263    0.059   -4.465      Inf    0.000   -0.378   -0.148
CSH_D3a|t2        1.553    0.096   16.152 6322.319    0.000    1.365    1.742
CSH_M5a|t1       -0.130    0.057   -2.278      Inf    0.023   -0.241   -0.018
CSH_M5a|t2        0.954    0.067   14.142      Inf    0.000    0.822    1.086
CSH_M2a|t1        0.634    0.061   10.359      Inf    0.000    0.514    0.755
CSH_M2a|t2        1.466    0.086   16.997      Inf    0.000    1.297    1.635

Variances:
Estimate  Std.Err  t-value       df  P(>|t|) ci.lower ci.upper
.CSH_B3a           0.689                                        0.689    0.689
.CSH_S4a          -0.135                                       -0.135   -0.135
.CSH_S5a           0.578                                        0.578    0.578
.CSH_S2a           0.299                                        0.299    0.299
.CSH_B11a          0.542                                        0.542    0.542
.CSH_B2a           0.579                                        0.579    0.579
.CSH_B8a           0.221                                        0.221    0.221
.CSH_B13a          0.407                                        0.407    0.407
.CSH_B4a           0.014                                        0.014    0.014
.CSH_B5a           0.268                                        0.268    0.268
.CSH_S10a          0.724                                        0.724    0.724
.CSH_S19a          0.624                                        0.624    0.624
.CSH_W2a           0.322                                        0.322    0.322
.CSH_S7a           0.760                                        0.760    0.760
.CSH_S8a           0.631                                        0.631    0.631
.CSH_W1a           0.453                                        0.453    0.453
.CSH_M7a           0.440                                        0.440    0.440
.CSH_M6a           0.275                                        0.275    0.275
.CSH_M4a           0.631                                        0.631    0.631
.CSH_D3a           0.854                                        0.854    0.854
.CSH_M5a           0.250                                        0.250    0.250
.CSH_M2a           0.165                                        0.165    0.165
A                 1.000                                        1.000    1.000
B                 1.000                                        1.000    1.000
C                 1.000                                        1.000    1.000
D                 1.000                                        1.000    1.000
G                 1.000                                        1.000    1.000

Scales y*:
Estimate  Std.Err  t-value       df  P(>|t|) ci.lower ci.upper
CSH_B3a           1.000                                        1.000    1.000
CSH_S4a           1.000                                        1.000    1.000
CSH_S5a           1.000                                        1.000    1.000
CSH_S2a           1.000                                        1.000    1.000
CSH_B11a          1.000                                        1.000    1.000
CSH_B2a           1.000                                        1.000    1.000
CSH_B8a           1.000                                        1.000    1.000
CSH_B13a          1.000                                        1.000    1.000
CSH_B4a           1.000                                        1.000    1.000
CSH_B5a           1.000                                        1.000    1.000
CSH_S10a          1.000                                        1.000    1.000
CSH_S19a          1.000                                        1.000    1.000
CSH_W2a           1.000                                        1.000    1.000
CSH_S7a           1.000                                        1.000    1.000
CSH_S8a           1.000                                        1.000    1.000
CSH_W1a           1.000                                        1.000    1.000
CSH_M7a           1.000                                        1.000    1.000
CSH_M6a           1.000                                        1.000    1.000
CSH_M4a           1.000                                        1.000    1.000
CSH_D3a           1.000                                        1.000    1.000
CSH_M5a           1.000                                        1.000    1.000
CSH_M2a           1.000                                        1.000    1.000

### Terrence Jorgensen

Nov 18, 2019, 8:31:07 AM11/18/19
to lavaan
I would like to calculate CIs

`summary(fit, ci = TRUE)`

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

### Burt Hatch

Nov 18, 2019, 9:29:28 AM11/18/19
to lavaan
Hi Terrence,

I end up with upper and lower CI values that are the same as the variance estimate, so it seems as if these are not quite right.

Thanks!

Burt

### Terrence Jorgensen

Nov 18, 2019, 9:42:05 AM11/18/19
to lavaan
I end up with upper and lower CI values that are the same as the variance estimate, so it seems as if these are not quite right.

No, that's right.  I didn't notice you had categorical outcomes, in which case the residual variances are not estimated by default.  There are a couple ways around this:

1. Your indicators have 3 categories, so you could fix your 2 thresholds (e.g., to 0 and 1 for each item) to instead estimate each indicator's intercept and residual variance (also requires you to set parameterization = "theta").  Your model will be statistically identical (same df and fit), but you would then be able to obtain a CI around the estimated residual variance.
2. Because you have orthogonal factors in this bifactor model, calculating the residual variance as a function of factor loadings is simple.  Start by labeling that indicator's loadings in the syntax, then define a new parameter that is 1 minus the sum of its squared loadings.  The point estimate should be the same as the residual variance you already see, but you can then obtain a delta-method CI around it.

`A =~ CSH_B3a + a*CSH_S4a + ...G =~ CSH_B3a + g*CSH_S4a + ......res_var_CSH_B3a := 1 - (a^2 + g^2)`

I would try (2) first, since (1) involves more syntax adjustments.

### Burt Hatch

Nov 18, 2019, 10:29:06 AM11/18/19
to lavaan
Hi Terrence,

Second method works like a charm.

Thanks!

### Chiel Mues

Feb 7, 2020, 12:09:41 PM2/7/20
to lavaan
Hello,

I have a similar problem, though I have a regular 2 factor model (no crossloads), and I have 4 thresholds. What is the best way to obtain the CI's around a residual variance in that case?

### Terrence Jorgensen

Feb 11, 2020, 6:35:35 AM2/11/20
to lavaan
I have a regular 2 factor model (no crossloads)

Then your indicator is a function of only one factor.  The common-factor component is the product of the squared loading and the factor variance (if the latter is 1, then you just need to square the loading).  The unique-factor component is 1 minus that.
Message has been deleted

### Chiel Mues

Feb 11, 2020, 8:25:15 PM2/11/20
to lavaan
Is it just the case of similarity transforming the upper and lower bounds of the CI of the loading?

### Terrence Jorgensen

Feb 12, 2020, 4:59:08 AM2/12/20
to lavaan
Is it just the case of similarity transforming the upper and lower bounds of the CI of the loading?

Do you have a categorical indicator whose residual variance is negative?  Using the default parameterization = "delta", that would imply that the loading must be > 1.  In which case, yes, you could simply look at the CI of the loading to see if it includes values < 1 (which would imply residual variances > 0).  Good thinking :-)

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

### Chiel Mues

Feb 12, 2020, 7:07:42 AM2/12/20
to lavaan
Thanks! I totally should have remembered that relationship between loadings and residual variances though! haha

On the topic of parameterizations though, when I run my model with cfa(model, ..., parameterization = "delta"), the model doesn't converge.
When I follow the model from this blog, adapted to my 11 variables with 4 thresholds, it runs fine (apart from that beforementiond loading of 1.008).
So I'm assuming lavaan fits somehting else under the hood?

configural_delta <- " F1 =~ x1 + x2 + x3 + x4 F2 =~ x5 + x6 + x7 + x8 x1 | t1 + t2 x2 | t1 + t2 x3 | t1 + t2 x4 | t1 + t2 x5 | t1 + t2 x6 | t1 + t2 x7 | t1 + t2 x8 | t1 + t2 x1 ~*~ c(1, 1)*x1 x2 ~*~ c(1, 1)*x2 x3 ~*~ c(1, 1)*x3 x4 ~*~ c(1, 1)*x4 x5 ~*~ c(1, 1)*x5 x6 ~*~ c(1, 1)*x6 x7 ~*~ c(1, 1)*x7 x8 ~*~ c(1, 1)*x8 x1 ~ c(0, 0)*1 x2 ~ c(0, 0)*1 x3 ~ c(0, 0)*1 x4 ~ c(0, 0)*1 x5 ~ c(0, 0)*1 x6 ~ c(0, 0)*1 x7 ~ c(0, 0)*1 x8 ~ c(0, 0)*1 F1 ~~ c(1,1)*F1 F2 ~~ c(1,1)*F2 F1 ~ c(0, 0)*1 F2 ~ c(0, 0)*1 F1 ~~ NA*F2 "

### Terrence Jorgensen

Feb 20, 2020, 8:06:14 AM2/20/20
to lavaan
when I run my model with cfa(model, ..., parameterization = "delta"), the model doesn't converge

Not sure why; convergence is more often a problem with theta than delta, precisely because of those cases when the data push the residual variance to be negative (which cannot happen when it is fixed to 1).  But judging from your description, you are missing the third threshold in your script (i.e., x1 | t1 + t2 + t3)

### Chiel

Feb 20, 2020, 3:14:40 PM2/20/20
I can't get either theta or delta to converge through the cfa() function.

when I use lavaan() and follow the model specifications described in that blog I do get convergence (apart from that one heywood case). I merely copied the example from the blog, I adjusted it to my needs, as such:

delta_config <- lavaan(config_delta,
data = section_d_cat,
group = "Collab",
auto.fix.first = FALSE)

config_delta <-  '

Valence =~ D_Happy + D_Pleased + D_Content + D_Satisfied + D_Unhappy + D_Dissatisfied
Arousal =~ D_Aroused + D_Hyperactivated +  D_Activated + D_Sleepy + D_Determined

#Residual Covariances
D_Unhappy ~~ D_Dissatisfied
D_Content ~~ D_Satisfied

#Delta

D_Happy | t1 + t2 + t3 + t4
D_Pleased | t1 + t2 + t3 + t4
D_Content | t1 + t2 +t3 + t4
D_Satisfied | t1 + t2 + t3 + t4
D_Unhappy | t1+ t2 + t3 + t4
D_Dissatisfied | t1 + t2 + t3 + t4
D_Aroused | t1 + t2 + t3 + t4
D_Hyperactivated | t1 + t2 + t3 + t4
D_Activated | t1 + t2 + t3 + t4
D_Sleepy | t1 + t2 + t3 + t4
D_Determined | t1 + t2 + t3 + t4

D_Happy~*~c(rep(1, 32))*D_Happy
D_Content~*~c(rep(1, 32))*D_Content
D_Satisfied~*~c(rep(1, 32))*D_Satisfied
D_Unhappy~*~c(rep(1, 32))*D_Unhappy
D_Dissatisfied~*~c(rep(1, 32))*D_Dissatisfied
D_Aroused~*~c(rep(1, 32))*D_Aroused
D_Hyperactivated~*~c(rep(1, 32))*D_Hyperactivated
D_Activated~*~c(rep(1, 32))*D_Activated
D_Sleepy~*~c(rep(1, 32))*D_Sleepy
D_Determined~*~c(rep(1, 32))*D_Determined

D_Happy ~ c(rep(0, 32))*1
D_Content ~ c(rep(0, 32))*1
D_Satisfied ~ c(rep(0, 32))*1
D_Unhappy ~ c(rep(0, 32))*1
D_Dissatisfied ~ c(rep(0, 32))*1
D_Aroused ~ c(rep(0, 32))*1
D_Hyperactivated ~ c(rep(0, 32))*1
D_Activated ~ c(rep(0, 32))*1
D_Sleepy ~ c(rep(0, 32))*1
D_Determined ~ c(rep(0, 32))*1

Valence ~~ c(rep(1, 32))*Valence
Arousal ~~ c(rep(1, 32))*Arousal
Valence ~ c(rep(0, 32))*1
Arousal ~ c(rep(0, 32))*1
Valence ~~ NA*Arousal

'

--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/SYTgS8EfnLg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.

### Terrence Jorgensen

Feb 22, 2020, 6:01:19 PM2/22/20
to lavaan
I can't get either theta or delta to converge through the cfa() function.

when I use lavaan() and follow the model specifications described in that blog I do get convergence (apart from that one heywood case).

I'm confused.  When you say the models don't converge with cfa(), do you merely mean there is a Heywood case?  Heywood cases are not signs of nonconvergence; they are "improper solutions".

Are you really fitting the model to 32 groups?  It may be necessary to provide data with scripts that reproduce your convergence problems, if indeed they do not converge using the cfa() wrapper around lavaan().

### Chiel

Feb 23, 2020, 11:22:51 AM2/23/20
Sorry for the confusion. Using cfa() I get nonconvergence. Using lavaan() I just get the heywood case.

I have 32 groups, yes. So you don't see an issue in the model specification that I used as input for lavaan()?
Any suggestions on how I best provide data and scripts? I don't think I'm allowed at this stage to put the data online freely..

Thanks for your help so far!

Tha

--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/SYTgS8EfnLg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.