Warning message: trouble constructing W matrix; used generalized inverse for A11 submatrix

854 views
Skip to first unread message

fotin...@gmail.com

unread,
Aug 10, 2018, 1:57:21 PM8/10/18
to lavaan
Hi,

I am hoping someone can help me (I am desperate!).

I have looked at previous posts but there wasn't much detail as to how to resolve this issue.  I am receiving the following:

Warning message:
In muthen1984(Data = X[[g]], ov.names = ov.names[[g]], ov.types = ov.types,  :
  lavaan WARNING: trouble constructing W matrix; used generalized inverse for A11 submatrix

When I run the following (see below).  I am not sure how to fix this warning.  I have posted the output below as well.  Variances seem fine although the inspect function is showing negatives.

Model.2 <- '
# measurement model
ERa =~ ER1 + ER2 + a4*ER3 + a2*ER4 + a3*ER5
PAa =~ PA1 + PA2 + PAMV1
ERb =~ a4*ER6 + a2*ER7 + a3*ER8
PAb =~ PAMV2 + PAC + PAIB + PAJ + PATB + PAS + PAO + PA3
ERc =~ a4*ER9 + a2*ER10 + a3*ER11
IMD =~ combined_LS + single + income + housing + kessler + job_partner + job_main + academic_partner
#Thresholds
ER3 | c1*t1 + c2*t2; ER9 | c1*t1 + c2*t2; ER6 | c1*t1 + c2*t2
ER4 | d1*t1 + d2*t2; ER10 | d1*t1 + d2*t2; ER7 | d1*t1 + d2*t2
ER5 | e1*t1 + e2*t2; ER11 | e1*t1 + e2*t2; ER8 | e1*t1 + e2*t2
# regressions
# a Path
PAa ~ a * IMD
PAb ~ d * IMD
# b path
ERa ~ b * PAa 
ERb ~ e * PAb 
ERc ~ g * PAa
#c prime path
ERa ~ cp * IMD
ERb ~ fp * IMD
ERc ~ hp * IMD
#Indirect and total effects
ab := a * b
total := cp + ab
de := d * e
totali := fp + de
ag := a * g
totalii := hp + ag'


> inspect(fit.M2,"cor.lv")
    ERa    PAa    ERb    PAb    ERc    IMD   
ERa  1.000                                   
PAa -0.680  1.000                            
ERb  0.249 -0.169  1.000                     
PAb -0.004  0.012 -0.306  1.000              
ERc  0.298 -0.705  0.249 -0.005  1.000       
IMD -0.206  0.564 -0.299  0.021 -0.257  1.000

> summary(fit.M2, fit.measures = TRUE, standardized=TRUE)
lavaan (0.6-1) converged normally after 106 iterations

  Number of observations                          3770

  Estimator                                       DWLS      Robust
  Model Fit Test Statistic                    5895.114    5149.474
  Degrees of freedom                               412         412
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  1.172
  Shift parameter                                          118.804
    for simple second-order correction (Mplus variant)

Model test baseline model:

  Minimum Function Test Statistic           159854.423  101680.137
  Degrees of freedom                               435         435
  P-value                                        0.000       0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    0.966       0.953
  Tucker-Lewis Index (TLI)                       0.964       0.951

  Robust Comparative Fit Index (CFI)                            NA
  Robust Tucker-Lewis Index (TLI)                               NA

Root Mean Square Error of Approximation:

  RMSEA                                          0.059       0.055
  90 Percent Confidence Interval          0.058  0.061       0.054  0.057
  P-value RMSEA <= 0.05                          0.000       0.000

  Robust RMSEA                                                  NA
  90 Percent Confidence Interval                                NA     NA

Standardized Root Mean Square Residual:

  SRMR                                           0.056       0.056

Parameter Estimates:

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

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  ERa =~                                                                
    ER1               0.044    0.009    5.049    0.000    0.063    0.095
    ER2               0.062    0.006   10.050    0.000    0.089    0.195
    ER3       (a4)    0.643    0.010   61.487    0.000    0.919    0.919
    ER4       (a2)    0.664    0.011   61.298    0.000    0.949    0.949
    ER5       (a3)    0.643    0.011   60.097    0.000    0.918    0.918
  PAa =~                                                                
    PA1               0.007    0.009    0.798    0.425    0.009    0.015
    PA2               0.005    0.011    0.466    0.642    0.006    0.009
    PAMV1             0.301    0.044    6.893    0.000    0.365    0.169
  ERb =~                                                                
    ER6       (a4)    0.643    0.010   61.487    0.000    0.710    0.710
    ER7       (a2)    0.664    0.011   61.298    0.000    0.733    0.733
    ER8       (a3)    0.643    0.011   60.097    0.000    0.710    0.710
  PAb =~                                                                
    PAMV2             0.266    0.017   15.862    0.000    0.266    0.469
    PAC               0.014    0.012    1.165    0.244    0.014    0.033
    PAIB              0.034    0.012    2.901    0.004    0.034    0.073
    PAJ               0.074    0.022    3.306    0.001    0.074    0.082
    PATB              0.422    0.027   15.339    0.000    0.422    0.457
    PAS               0.214    0.020   10.686    0.000    0.214    0.265
    PAO               0.015    0.033    0.446    0.655    0.015    0.011
    PA3              -0.279    0.027  -10.182    0.000   -0.279   -0.251
  ERc =~                                                                
    ER9       (a4)    0.643    0.010   61.487    0.000    0.935    0.935
    ER10      (a2)    0.664    0.011   61.298    0.000    0.965    0.965
    ER11      (a3)    0.643    0.011   60.097    0.000    0.934    0.934
  IMD =~                                                                
    combnd_LS         0.656    0.027   24.135    0.000    0.656    0.540
    single            0.129    0.005   25.709    0.000    0.129    0.423
    income           -1.023    0.036  -28.479    0.000   -1.023   -0.740
    housing           0.545    0.022   24.326    0.000    0.545    0.650
    kessler           1.156    0.062   18.745    0.000    1.156    0.334
    job_prtnr         0.893    0.048   18.509    0.000    0.893    0.555
    job_main          0.858    0.050   17.009    0.000    0.858    0.522
    acdmc_prt         0.057    0.009    6.036    0.000    0.057    0.114

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  PAa ~                                                                 
    IMD        (a)    0.683    0.170    4.029    0.000    0.564    0.564
  PAb ~                                                                 
    IMD        (d)    0.021    0.027    0.777    0.437    0.021    0.021
  ERa ~                                                                 
    PAa        (b)   -0.976    0.034  -29.110    0.000   -0.828   -0.828
  ERb ~                                                                 
    PAb        (e)   -0.331    0.035   -9.548    0.000   -0.300   -0.300
  ERc ~                                                                 
    PAa        (g)   -0.985    0.034  -29.302    0.000   -0.821   -0.821
  ERa ~                                                                 
    IMD       (cp)    0.373    0.170    2.194    0.028    0.261    0.261
  ERb ~                                                                 
    IMD       (fp)   -0.323    0.026  -12.322    0.000   -0.293   -0.293
  ERc ~                                                                 
    IMD       (hp)    0.300    0.170    1.765    0.078    0.206    0.206

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
 .ERa ~~                                                                
   .ERb               0.295    0.033    9.035    0.000    0.295    0.295
   .ERc              -0.453    0.061   -7.422    0.000   -0.453   -0.453
 .ERb ~~                                                                
   .ERc               0.276    0.033    8.238    0.000    0.276    0.276

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .ER1               2.285    0.011  209.408    0.000    2.285    3.413
   .ER2               2.761    0.011  244.410    0.000    2.761    6.051
   .ER3               0.000                               0.000    0.000
   .ER4               0.000                               0.000    0.000
   .ER5               0.000                               0.000    0.000
   .PA1               1.352    0.016   86.675    0.000    1.352    2.384
   .PA2               1.650    0.013  128.718    0.000    1.650    2.431
   .PAMV1             6.240    0.038  164.361    0.000    6.240    2.896
   .ER6               0.000                               0.000    0.000
   .ER7               0.000                               0.000    0.000
   .ER8               0.000                               0.000    0.000
   .PAMV2             1.277    0.010  126.298    0.000    1.277    2.254
   .PAC               0.117    0.019    6.243    0.000    0.117    0.267
   .PAIB              0.159    0.017    9.365    0.000    0.159    0.341
   .PAJ               0.456    0.027   16.626    0.000    0.456    0.506
   .PATB              0.395    0.027   14.729    0.000    0.395    0.427
   .PAS               0.276    0.028    9.826    0.000    0.276    0.342
   .PAO               0.649    0.038   17.076    0.000    0.649    0.489
   .PA3               2.761    0.018  151.439    0.000    2.761    2.486
   .ER9               0.000                               0.000    0.000
   .ER10              0.000                               0.000    0.000
   .ER11              0.000                               0.000    0.000
   .combined_LS       2.069    0.024   84.788    0.000    2.069    1.704
   .single            1.104    0.000 4233.974    0.000    1.104    3.617
   .income            3.269    0.023  139.983    0.000    3.269    2.365
   .housing           1.439    0.030   47.753    0.000    1.439    1.714
   .kessler           4.029    0.085   47.182    0.000    4.029    1.164
   .job_partner       2.624    0.029   90.256    0.000    2.624    1.632
   .job_main          2.785    0.030   93.009    0.000    2.785    1.695
   .academic_prtnr    1.467    0.008  183.681    0.000    1.467    2.941
   .ERa               0.000                               0.000    0.000
   .PAa               0.000                               0.000    0.000
   .ERb               0.000                               0.000    0.000
   .PAb               0.000                               0.000    0.000
   .ERc               0.000                               0.000    0.000
    IMD               0.000                               0.000    0.000

Thresholds:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
    ER3|t1    (c1)   -0.699    0.014  -48.386    0.000   -0.699   -0.699
    ER3|t2    (c2)    0.205    0.015   14.000    0.000    0.205    0.205
    ER9|t1    (c1)   -0.699    0.014  -48.386    0.000   -0.699   -0.699
    ER9|t2    (c2)    0.205    0.015   14.000    0.000    0.205    0.205
    ER6|t1    (c1)   -0.699    0.014  -48.386    0.000   -0.699   -0.699
    ER6|t2    (c2)    0.205    0.015   14.000    0.000    0.205    0.205
    ER4|t1    (d1)   -0.763    0.014  -52.627    0.000   -0.763   -0.763
    ER4|t2    (d2)    0.383    0.014   27.418    0.000    0.383    0.383
    ER10|t1   (d1)   -0.763    0.014  -52.627    0.000   -0.763   -0.763
    ER10|t2   (d2)    0.383    0.014   27.418    0.000    0.383    0.383
    ER7|t1    (d1)   -0.763    0.014  -52.627    0.000   -0.763   -0.763
    ER7|t2    (d2)    0.383    0.014   27.418    0.000    0.383    0.383
    ER5|t1    (e1)   -0.886    0.014  -61.661    0.000   -0.886   -0.886
    ER5|t2    (e2)   -0.438    0.014  -31.836    0.000   -0.438   -0.438
    ER11|t1   (e1)   -0.886    0.014  -61.661    0.000   -0.886   -0.886
    ER11|t2   (e2)   -0.438    0.014  -31.836    0.000   -0.438   -0.438
    ER8|t1    (e1)   -0.886    0.014  -61.661    0.000   -0.886   -0.886
    ER8|t2    (e2)   -0.438    0.014  -31.836    0.000   -0.438   -0.438

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .ER1               0.444    0.011   40.867    0.000    0.444    0.991
   .ER2               0.200    0.006   33.856    0.000    0.200    0.962
   .ER3               0.156                               0.156    0.156
   .ER4               0.100                               0.100    0.100
   .ER5               0.157                               0.157    0.157
   .PA1               0.321    0.010   30.852    0.000    0.321    1.000
   .PA2               0.461    0.016   29.558    0.000    0.461    1.000
   .PAMV1             4.509    0.104   43.196    0.000    4.509    0.971
   .ER6               0.495                               0.495    0.495
   .ER7               0.462                               0.462    0.462
   .ER8               0.496                               0.496    0.496
   .PAMV2             0.250    0.010   26.202    0.000    0.250    0.780
   .PAC               0.192    0.003   62.108    0.000    0.192    0.999
   .PAIB              0.217    0.004   55.303    0.000    0.217    0.995
   .PAJ               0.807    0.014   59.737    0.000    0.807    0.993
   .PATB              0.674    0.024   27.528    0.000    0.674    0.791
   .PAS               0.604    0.012   48.760    0.000    0.604    0.930
   .PAO               1.760    0.024   74.594    0.000    1.760    1.000
   .PA3               1.156    0.037   31.611    0.000    1.156    0.937
   .ER9               0.126                               0.126    0.126
   .ER10              0.069                               0.069    0.069
   .ER11              0.127                               0.127    0.127
   .combined_LS       1.045    0.035   29.906    0.000    1.045    0.708
   .single            0.077    0.001   53.090    0.000    0.077    0.821
   .income            0.865    0.038   23.043    0.000    0.865    0.452
   .housing           0.407    0.013   30.736    0.000    0.407    0.578
   .kessler          10.650    0.229   46.531    0.000   10.650    0.889
   .job_partner       1.789    0.074   24.319    0.000    1.789    0.692
   .job_main          1.963    0.086   22.825    0.000    1.963    0.727
   .academic_prtnr    0.246    0.001  165.428    0.000    0.246    0.987
   .ERa               1.000                               0.490    0.490
   .PAa               1.000                               0.682    0.682
   .ERb               1.000                               0.821    0.821
   .PAb               1.000                               1.000    1.000
   .ERc               1.000                               0.474    0.474
    IMD               1.000                               1.000    1.000

Scales y*:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
    ER3               1.000                               1.000    1.000
    ER4               1.000                               1.000    1.000
    ER5               1.000                               1.000    1.000
    ER6               1.000                               1.000    1.000
    ER7               1.000                               1.000    1.000
    ER8               1.000                               1.000    1.000
    ER9               1.000                               1.000    1.000
    ER10              1.000                               1.000    1.000
    ER11              1.000                               1.000    1.000

Defined Parameters:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
    ab               -0.667    0.169   -3.947    0.000   -0.467   -0.467
    total            -0.294    0.029  -10.065    0.000   -0.206   -0.206
    de               -0.007    0.009   -0.777    0.437   -0.006   -0.006
    totali           -0.330    0.026  -12.900    0.000   -0.299   -0.299
    ag               -0.673    0.170   -3.957    0.000   -0.463   -0.463
    totalii          -0.373    0.030  -12.400    0.000   -0.257   -0.257

Chao Xu

unread,
Aug 10, 2018, 10:29:39 PM8/10/18
to lavaan
It seems to me that this issue is due to the singularity of the weight matrix W. W is estimated from the fourth-order moments of the data vector (see various Muthen papers), meaning that the singularity stems from the inherent structure of your data.

The diagnostics can be fairly complex, if not impossible, without working around with your data. What I would suggest is to check your data and see the possibility of some issues (e.g., collinearity, etc.).

Myriam

unread,
Jul 25, 2020, 3:05:57 PM7/25/20
to lavaan
I had the same error message and went to read the Muthen 1984 paper referenced in the error message (A general SEM with dichotomous, ordered categorical, and continuous latent variable indicators). 

This is what I gathered (Pp. 119-120. )
  • W is a positive definite weight matrix used at the third estimation stage. Is part of the weighted least squares fitting function which is miminized by the estimation. Forming this matrix is needed to obtain a limited information generalized least squares estimator. 
  • The A(g) submatrix is a “consistent estimator of the asymptotic covariance matrix of the estimator Theta prime”. Theta (not primed) is the “vector of free and distinct model parameters”
For me the problem came from the fact that I had specified condition.x=FALSE in the lavaan fitting command. I had a dichotomous observed exogenous variable X, so I was using the WLSMV estimator. This requires condition.x=TRUE for models with categorical covariates. So if my understanding is correct, this created a problem in relation to third stage estimation. 

You did not list the fitting command you used and your estimator so I am not sure if this applies to you as well. Here is something on the Mplus website that explains why conditioning on X observed covariates is important - if this applies to you (but the post dates back to 2018) or to someone else who might read this post because of the same error message. 


Myriam
Reply all
Reply to author
Forward
0 new messages