Bifactor Model Errors

504 views
Skip to first unread message

Andrew Kiselica

unread,
May 22, 2019, 10:41:51 AM5/22/19
to lavaan
Hello,

I am attempting to run a bifactor model in lavaan.  I have successfully run one-factor, four-factor correlated, and higher order models without any problems.  However, the bifactor model continually comes up with a message that the model is not identified when I am almost positive that it is identified.  I've pasted the relevant output from R below. Any suggestions on how to fix the problem would be greatly appreciated!

> BifC <- ' G =~ ZUDSBENTC + zTRAILBr + zTRAILAr + ZUDSVERTN + ZDIGFORCT + ZDIGBACCT + ZVEG + ZANIMALS + ZMINTTOTS + ZCRAFTVRS + ZCRAFTDVR + ZUDSBENTD
+ VisExec =~  zTRAILBr + ZUDSBENTC + zTRAILAr + ZUDSVERTN
+ Attn =~ ZDIGFORCT + ZDIGBACCT
+ Lang =~ ZVEG + ZANIMALS + ZMINTTOTS
+ Mem =~ ZCRAFTVRS + ZCRAFTDVR + ZUDSBENTD 
+ G ~~ 0*VisExec
+ G ~~ 0*Attn
+ G ~~ 0*Mem
+ G ~~ 0*Lang
+ VisExec ~~ Attn
+ VisExec ~~ Lang
+ VisExec ~~ Mem
+ Attn ~~ Mem
+ Attn ~~ Lang
+ Lang ~~ Mem' 
> fitBifC <- cfa(BifC, data=Half1)
Warning messages:
1: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  :
  lavaan WARNING:
    Could not compute standard errors! The information matrix could
    not be inverted. This may be a symptom that the model is not
    identified.
2: In lav_object_post_check(object) :
  lavaan WARNING: some estimated ov variances are negative
3: In lav_object_post_check(object) :
  lavaan WARNING: some estimated lv variances are negative
> summary(fitBifC, fit.measures=TRUE, standardized=TRUE)
lavaan 0.6-3 ended normally after 942 iterations

  Optimization method                           NLMINB
  Number of free parameters                         42

  Number of observations                          3123

  Estimator                                         ML
  Model Fit Test Statistic                    2791.712
  Degrees of freedom                                36
  P-value (Chi-square)                           0.000

Model test baseline model:

  Minimum Function Test Statistic            50215.496
  Degrees of freedom                                66
  P-value                                        0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    0.945
  Tucker-Lewis Index (TLI)                       0.899

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)             -233167.370
  Loglikelihood unrestricted model (H1)     -231771.514

  Number of free parameters                         42
  Akaike (AIC)                              466418.739
  Bayesian (BIC)                            466672.694
  Sample-size adjusted Bayesian (BIC)       466539.243

Root Mean Square Error of Approximation:

  RMSEA                                          0.157
  90 Percent Confidence Interval          0.152  0.162
  P-value RMSEA <= 0.05                          0.000

Standardized Root Mean Square Residual:

  SRMR                                           0.051

Parameter Estimates:

  Information                                 Expected
  Information saturated (h1) model          Structured
  Standard Errors                             Standard

Latent Variables:
                   Estimate    Std.Err  z-value  P(>|z|)   Std.lv   Std.all
  G =~                                                                     
    ZUDSBENTC           1.000                              208.506    0.945
    zTRAILBr            0.921       NA                     192.009    0.538
    zTRAILAr            0.922       NA                     192.232    0.768
    ZUDSVERTN           0.915       NA                     190.881    0.850
    ZDIGFORCT           0.841       NA                     175.285    0.834
    ZDIGBACCT           0.843       NA                     175.847    0.826
    ZVEG                0.865       NA                     180.303    0.854
    ZANIMALS            0.827       NA                     172.435    0.869
    ZMINTTOTS           0.879       NA                     183.236    0.820
    ZCRAFTVRS           0.859       NA                     179.124    0.790
    ZCRAFTDVR           0.903       NA                     188.328    0.799
    ZUDSBENTD           1.027       NA                     214.052    0.901
  VisExec =~                                                               
    zTRAILBr            1.000                                0.137    0.000
    ZUDSBENTC         492.629       NA                      67.634    0.307
    zTRAILAr         -394.182       NA                     -54.118   -0.216
    ZUDSVERTN        -545.508       NA                     -74.894   -0.333
  Attn =~                                                                  
    ZDIGFORCT           1.000                               98.523    0.469
    ZDIGBACCT           1.339       NA                     131.935    0.619
  Lang =~                                                                  
    ZVEG                1.000                               99.807    0.473
    ZANIMALS            0.604       NA                      60.281    0.304
    ZMINTTOTS           0.386       NA                      38.525    0.172
  Mem =~                                                                   
    ZCRAFTVRS           1.000                                  NaN      NaN
    ZCRAFTDVR          -1.531       NA                         NaN      NaN
    ZUDSBENTD           0.080       NA                         NaN      NaN

Covariances:
                   Estimate    Std.Err  z-value  P(>|z|)   Std.lv   Std.all
  G ~~                                                                     
    VisExec             0.000                                0.000    0.000
    Attn                0.000                                0.000    0.000
    Mem                 0.000                                0.000    0.000
    Lang                0.000                                0.000    0.000
  VisExec ~~                                                               
    Attn               -0.049       NA                      -0.004   -0.004
    Lang               -9.082       NA                      -0.663   -0.663
    Mem                 0.931       NA                       0.065    0.065
  Attn ~~                                                                  
    Mem                93.157       NA                       0.009    0.009
    Lang             1482.231       NA                       0.151    0.151
  Lang ~~                                                                  
    Mem              -569.790       NA                      -0.055   -0.055

Variances:
                   Estimate    Std.Err  z-value  P(>|z|)   Std.lv   Std.all
   .ZUDSBENTC         630.804       NA                     630.804    0.013
   .zTRAILBr        90498.369       NA                   90498.369    0.711
   .zTRAILAr        22782.298       NA                   22782.298    0.364
   .ZUDSVERTN        8418.791       NA                    8418.791    0.167
   .ZDIGFORCT        3781.443       NA                    3781.443    0.086
   .ZDIGBACCT       -2968.082       NA                   -2968.082   -0.065
   .ZVEG             2083.574       NA                    2083.574    0.047
   .ZANIMALS         6005.720       NA                    6005.720    0.153
   .ZMINTTOTS       14928.663       NA                   14928.663    0.299
   .ZCRAFTVRS       30094.630       NA                   30094.630    0.586
   .ZCRAFTDVR       45472.594       NA                   45472.594    0.818
   .ZUDSBENTD       10678.225       NA                   10678.225    0.189
    G               43474.919       NA                       1.000    1.000
    VisExec             0.019       NA                       1.000    1.000
    Attn             9706.708       NA                       1.000    1.000
    Lang             9961.493       NA                       1.000    1.000
    Mem            -10818.394       NA                         NaN      NaN

PD

unread,
May 22, 2019, 10:44:33 AM5/22/19
to lavaan
Group factors must be uncorrelated otherwise you have linear dependence in the model. orthogonal = TRUE or change your code

Nickname

unread,
May 23, 2019, 11:35:38 AM5/23/19
to lavaan
If 'group' means 'specific' I am not sure that it is true that these must be orthogonal.  I believe that it is only required that the general factor be orthogonal to the specific factors.

Bifactor models are finicky.  You are pressing your luck with only two indicators for one of your factors.  You might try omitting that factor and its indicators.

I generally have better luck fitting bifactor models fixing the variances of the latent variables rather than using index variables.  This is illustrated below.  For me, the first model fails but the second converges and has reasonable standard errors in most samples.

Caveat: I do not have much experience with the convenience wrappers like the cfa() function and was unsuccessful in overriding the auto.fix.first default.  That is why I fit the second model using the lavaan() function.  In principle, I think that it should be possible to fit the model using the cfa() function.

Finally, I could not help but notice that all your observed variable names begin with 'Z'.  If this indicates that you are analyzing z scores, be aware that this is comparable to analyzing a correlation matrix.  Analyzing a correlation matrix as if it were a covariance matrix misrepresents the degrees of freedom and thus can produce inaccurate inferential statistics.

Enter code here...
 

 
# Bifactor Model
require(lavaan)

BifCSim <- '
  G =~ ZUDSBENTC + zTRAILBr + zTRAILAr + ZUDSVERTN + ZDIGFORCT + ZDIGBACCT + ZVEG + ZANIMALS + ZMINTTOTS + ZCRAFTVRS + ZCRAFTDVR + ZUDSBENTD + extraIndicator

  VisExec =~  zTRAILBr + ZUDSBENTC + zTRAILAr + ZUDSVERTN
  Attn =~ ZDIGFORCT + ZDIGBACCT + extraIndicator
  Lang =~ ZVEG + ZANIMALS + ZMINTTOTS
  Mem =~ ZCRAFTVRS + ZCRAFTDVR + ZUDSBENTD
  G ~~ 0*VisExec
  G ~~ 0*Attn
  G ~~ 0*Mem
  G ~~ 0*Lang
  VisExec ~~ .5 * Attn
  VisExec ~~ .5 * Lang
  VisExec ~~ .5 * Mem
  Attn ~~ .5 * Mem
  Attn ~~ .5 * Lang
  Lang ~~ .5 * Mem
'
# end BifCSim model

BifC <- '
  G =~ ZUDSBENTC + zTRAILBr + zTRAILAr + ZUDSVERTN + ZDIGFORCT + ZDIGBACCT + ZVEG + ZANIMALS + ZMINTTOTS + ZCRAFTVRS + ZCRAFTDVR + ZUDSBENTD + extraIndicator

  VisExec =~  zTRAILBr + ZUDSBENTC + zTRAILAr + ZUDSVERTN
  Attn =~ ZDIGFORCT + ZDIGBACCT + extraIndicator
  Lang =~ ZVEG + ZANIMALS + ZMINTTOTS
  Mem =~ ZCRAFTVRS + ZCRAFTDVR + ZUDSBENTD
  G ~~ 0*VisExec
  G ~~ 0*Attn
  G ~~ 0*Mem
  G ~~ 0*Lang
  VisExec ~~ Attn
  VisExec ~~ Lang
  VisExec ~~ Mem
  Attn ~~ Mem
  Attn ~~ Lang
  Lang ~~ Mem
'
# end BifC model

BifC2 <- '
  G =~ ZUDSBENTC + zTRAILBr + zTRAILAr + ZUDSVERTN + ZDIGFORCT + ZDIGBACCT + ZVEG + ZANIMALS + ZMINTTOTS + ZCRAFTVRS + ZCRAFTDVR + ZUDSBENTD + extraIndicator

  VisExec =~  zTRAILBr + ZUDSBENTC + zTRAILAr + ZUDSVERTN
  Attn =~ ZDIGFORCT + ZDIGBACCT + extraIndicator

  Lang =~ ZVEG + ZANIMALS + ZMINTTOTS
  Mem =~ ZCRAFTVRS + ZCRAFTDVR + ZUDSBENTD
  G ~~ 0*VisExec
  G ~~ 0*Attn
  G ~~ 0*Mem
  G ~~ 0*Lang
  VisExec ~~ Attn
  VisExec ~~ Lang
  VisExec ~~ Mem
  Attn ~~ Mem
  Attn ~~ Lang
  Lang ~~ Mem
  G ~~ 1*G
  VisExec ~~ 1*VisExec
  Attn ~~ 1*Attn
  Lang ~~ 1*Lang
  Mem ~~ 1*Mem
'
# end BifC2 model


foo
<- simulateData(model=BifCSim, sample.nobs=1000) #This is admittedly a hack relying on default values of one.
summary
(cov(foo)[lower.tri(cov(foo))]) # Quick peek
summary
(cor(foo)[lower.tri(cor(foo))])
det
(cov(foo))

fitBifC
<- cfa(BifC, data=foo) # Fixed index variable loadings, free latent variances
summary
(fitBifC)

fitBifC2
<- lavaan(BifC2, data=foo, auto.var=TRUE) # Fixed latent variances, free loadings
summary
(fitBifC2)





------------------------
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/

Andrew Kiselica

unread,
May 24, 2019, 10:10:32 AM5/24/19
to lavaan
Thanks for the very helpful reply, Keith! Fixing the factor variances did the trick.
Reply all
Reply to author
Forward
0 new messages