The optimizer (NLMINB) claimed the model converged, but not all elements of the gradient are (near) zero

515 views
Skip to first unread message

Luana Yang

unread,
Mar 1, 2020, 8:37:35 PM3/1/20
to lavaan
Dear all,
I use Lavaan to build a sem model, but the fit measures not available if model did not converge. How can I deal with it ?
Here is the syntax I am running:

model1 <-'
                      ## Lavaan latan variables
                      UI =~ PIS+NL
                      T =~ AT+MTCM+MTWM
                      P =~ AP+PWM+PCM
                      
                      ## Lavaan regression
                      amp~ UI+DEM+NPP+T+P+HI
                      NPP~ P+T+UI+DEM
                      HI+T+P~ UI
                      NL ~ PIS
                      
                    ## Lavaan covariance
                      T~~P
                      
          '
fit1 <- sem(model1, data=dataNOR, estimator="MLR",std.lv=TRUE)

The results:
Warning message:
In lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable,  :
  lavaan WARNING: the optimizer (NLMINB) claimed the model converged,
                  but not all elements of the gradient are (near) zero;
                  the optimizer may not have found a local solution
                  use check.gradient = FALSE to skip this check.

lavaan 0.6-5 did NOT end normally after 213 iterations
** WARNING ** Estimates below are most likely unreliable

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of free parameters                         34
                                                      
  Number of observations                        229118
                                                      
Model Test User Model:
                                                      
  Test statistic                                    NA
  Degrees of freedom                                NA

Parameter Estimates:

  Information                                      Observed
  Observed information based on                     Hessian
  Standard errors                        Robust.huber.white

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  UI =~                                                                 
    PIS               0.023       NA                      0.023    0.316
    NL                0.044       NA                      0.044    0.526
  T =~                                                                  
    AT                0.207       NA                      0.211    1.026
    MTCM              0.202       NA                      0.206    0.963
    MTWM              0.138       NA                      0.141    0.920
  P =~                                                                  
    AP                0.133       NA                      0.134    1.126
    PWM               0.075       NA                      0.075    0.553
    PCM               0.056       NA                      0.056    0.646

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  amp ~                                                                 
    UI               -0.021       NA                     -0.021   -0.127
    DEM               0.065       NA                      0.065    0.042
    NPP               0.382       NA                      0.382    0.368
    T                 0.033       NA                      0.033    0.206
    P                 0.049       NA                      0.050    0.307
    HI                0.027       NA                      0.027    0.030
  NPP ~                                                                 
    P                 0.090       NA                      0.091    0.583
    T                 0.002       NA                      0.002    0.010
    UI                0.020       NA                      0.020    0.131
    DEM               0.141       NA                      0.141    0.094
  HI ~                                                                  
    UI                0.027       NA                      0.027    0.146
  T ~                                                                   
    UI               -0.201       NA                     -0.197   -0.197
  P ~                                                                   
    UI               -0.090       NA                     -0.089   -0.089
  NL ~                                                                  
    PIS               0.447       NA                      0.447    0.384

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
 .T ~~                                                                  
   .P                -0.029       NA                     -0.029   -0.029

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .PIS               0.005       NA                      0.005    0.900
   .NL                0.003       NA                      0.003    0.449
   .AT               -0.002       NA                     -0.002   -0.052
   .MTCM              0.003       NA                      0.003    0.073
   .MTWM              0.004       NA                      0.004    0.154
   .AP               -0.004       NA                     -0.004   -0.267
   .PWM               0.013       NA                      0.013    0.694
   .PCM               0.004       NA                      0.004    0.582
   .amp               0.015       NA                      0.015    0.573
   .NPP               0.016       NA                      0.016    0.649
   .HI                0.032       NA                      0.032    0.979
    UI                1.000                               1.000    1.000
   .T                 1.000                               0.961    0.961
   .P                 1.000                               0.992    0.992

R-Square:
                   Estimate
    PIS               0.100
    NL                0.551
    AT                   NA
    MTCM              0.927
    MTWM              0.846
    AP                   NA
    PWM               0.306
    PCM               0.418
    amp               0.427
    NPP               0.351
    HI                0.021
    T                 0.039
    P                 0.008

Warning message:
In .local(object, ...) :
  lavaan WARNING: fit measures not available if model did not converge

Thanks for your time.

Jeremy Miles

unread,
Mar 1, 2020, 8:52:18 PM3/1/20
to lav...@googlegroups.com
One thing to do is to try different starting values.

However, I think this is a weird looking model. You've got a lot of  variables, and very few covariances. (I didn't spend the time to draw out the path diagram, but if you did, it would be helpful).

Some of your variances are small - the usual advice is to make sure that the variances of your variables are within an order of magnitude of one another, or you run into precision estimates.

Finally, you have some negative variances - variances can't be negative, so whether you have fit indices or not, you know that this model is wrong.

Hope that helps,

jeremy

Luana Yang

unread,
Mar 1, 2020, 9:22:17 PM3/1/20
to lavaan
Dear jeremy,
 Thanks for your help. I know this model have some problems, but how can I make the variances of my variables are within an order of magnitude of one another? 

在 2020年3月2日星期一 UTC+8上午9:37:35,Luana Yang写道:

Jeremy Miles

unread,
Mar 1, 2020, 9:32:07 PM3/1/20
to lav...@googlegroups.com

If the variance is small, multiply it by 10.

If it's large, divide it by 10.

J

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/59182d0f-e486-47e9-aade-76b5017331a9%40googlegroups.com.

Luana Yang

unread,
Mar 1, 2020, 10:06:32 PM3/1/20
to lavaan
(I don't know if my reply was sent successfully, so I sent it again.The variance of the AT was -0.052, and that of PIS was 0.9(I don't know if I should look at the variance after normalization). Should I multiply AT in the raw data by 10 and divide PIS by 10? 

在 2020年3月2日星期一 UTC+8上午10:32:07,Jeremy Miles写道:
To unsubscribe from this group and stop receiving emails from it, send an email to lav...@googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages