NA error

215 views
Skip to first unread message

Yousra DHAINI

unread,
May 27, 2020, 7:59:43 AM5/27/20
to lavaan
Hello world,
Please i find a problem when running a sem model, when i run the summary() it shows the estimation but NAs in all Std.Err values and no z-values ( univariate Normality is not valid but multivariate  Normality  is accepted and i scaled my dataframe) still don't know where the problem come from.
I wonder if anyone can help me.
Thanks. 

Terrence Jorgensen

unread,
May 27, 2020, 10:26:55 AM5/27/20
to lavaan
when i run the summary() it shows the estimation but NAs in all Std.Err values and no z-values

Does it say that the optimizer did not find a solution?  Check lavInspect(fit, "converged")

It is possible your model is not identified, but you would need to share more information about your model and data (e.g., a reproducible example with R script).

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

 
Message has been deleted

Yousra DHAINI

unread,
May 27, 2020, 6:06:52 PM5/27/20
to lavaan

Yousra DHAINI

17:09 (il y a 5 heures)
À lavaan
Yes sir, it doen't converge to a solution ( the result of lavInspect(fit, "converged") is False)
Well, i'm running a SEM with 3 latent variables( Access,developement and Utilisation) Aiming to creating another latent variable which is financial inclusion using these 3 variables. I tested normality of the distribution of my variables(univariateNormality is accepted for 2 variables but multivariateNormality is accepted by shapiro test p-value=0.05185 ), so i used both the ML and MLR method and i scaled data before running this code.  

My model specification is as follows:

model.full<-'  # latent variables
                 Accès =~ Couv.Comm.Rurale+Couv.Comm.Urbain+Couv.Comm.Total+Densite.Res.Bq.Rural+Densite.Res.Bq.Urbain+Densite.Res.Bq.Total+Densite.pointsIOB.MTO.Rural+Densite.pointsIOB.MTO.Urbain+Densite.pointsIOB.MTO.Total
                Dev =~ Indice.Rur+Pov.Mon+Pov.Mult+Pov.Glob+Vuln.Urb+Vuln.Rur+Vuln + PIB.hab+DCFM.hab+Poids.Emp.Informel
                Utilisation =~ Equ.Comptes.Rural+Equ.Comptes.Urbain +Equ.Comptes.Total+Dep.Moy.Cpte+Dep.PIB+Cred.PIB +DepAV.DCFM+Prop.Femmes.Nouv.Cred +Prop.Jeunes.Nouv.Cred+Prop.Jeunes.Cred +Prop.Femmes.Cred 
     
              # residual variances observed variables
                Couv.Comm.Rurale ~~ Couv.Comm.Rurale
                Couv.Comm.Urbain ~~ Couv.Comm.Urbain
                Couv.Comm.Total ~~ Couv.Comm.Total
                Densite.Res.Bq.Rural~~ Densite.Res.Bq.Rural
                Densite.Res.Bq.Urbain~~ Densite.Res.Bq.Urbain
                Densite.Res.Bq.Total~~ Densite.Res.Bq.Total
                Densite.pointsIOB.MTO.Rural~~ Densite.pointsIOB.MTO.Rural
                Densite.pointsIOB.MTO.Urbain~~ Densite.pointsIOB.MTO.Urbain
                Densite.pointsIOB.MTO.Total ~~ Densite.pointsIOB.MTO.Total

                Indice.Rur ~~ Indice.Rur
                Pov.Mon ~~ Pov.Mon
                Pov.Mult ~~ Pov.Mult
                Pov.Ext ~~ Pov.Ext
                Pov.Glob ~~ Pov.Glob
                Vuln.Urb ~~ Vuln.Urb
                Vuln.Rur ~~ Vuln.Rur
                Vuln ~~ Vuln
                PIB.hab ~~ PIB.hab
                DCFM.hab ~~ DCFM.hab
                Poids.Emp.Informel ~~ Poids.Emp.Informel
          
                Equ.Comptes.Rural ~~ Equ.Comptes.Rural
                Equ.Comptes.Urbain ~~ Equ.Comptes.Urbain
                Equ.Comptes.Total ~~ Equ.Comptes.Total
                Dep.Moy.Cpte ~~ Dep.Moy.Cpte
                Dep.PIB ~~ Dep.PIB
                Cred.PIB ~~ Cred.PIB
                DepAV.DCFM ~~ DepAV.DCFM
                Prop.Femmes.Nouv.Cred ~~ Prop.Femmes.Nouv.Cred
                Prop.Jeunes.Nouv.Cred ~~ Prop.Jeunes.Nouv.Cred
                Prop.Jeunes.Cred ~~ Prop.Jeunes.Cred
                Prop.Femmes.Cred ~~ Prop.Femmes.Cred
              # factor variances
                Accès~ Accès
                Dev ~ Dev
                Utilisation ~ Utilisation
              # factor covariances
                Accès~ Dev
                Dev ~ Utilisation + Accès
                Utilisation ~ Accès + Dev
'
Here's the lines of code i runned:

1-ML
fit <- sem(model.full, data=data)
summary(fit, fit.measures = TRUE, standardized = TRUE)

The resut i get:

> fit <- sem(model.full, data=data)
Warning message:
In lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable,  :
  lavaan WARNING: the optimizer warns that a solution has NOT been found!
> summary(fit)
lavaan 0.6-6 did NOT end normally after 10000 iterations
** WARNING ** Estimates below are most likely unreliable

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

Parameter Estimates:

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

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)
  Accès =~                                            
    Couv.Comm.Rurl    1.000                           
    Couv.Comm.Urbn   -0.571       NA                  
    Couv.Comm.Totl    3.468       NA                  
    Dnst.Rs.Bq.Rrl    0.493       NA                  
    Dnst.Rs.Bq.Urb    2.462       NA                  
    Dnst.Rs.Bq.Ttl    7.014       NA                  
    Dnst.IOB.MTO.R    1.088       NA                  
    Dnst.IOB.MTO.U   -0.929       NA                  
    Dnst.IOB.MTO.T    4.682       NA                  
  Dev =~                                              
    Indice.Rur        1.000                           
    Pov.Mon           1.524       NA                  
    Pov.Mult          1.245       NA                  
    Pov.Glob          1.610       NA                  
    Vuln.Urb          1.374       NA                  
    Vuln.Rur          1.519       NA                  
    Vuln              1.803       NA                  
    PIB.hab          -0.788       NA                  
    DCFM.hab         -0.822       NA                  
    Pds.Emp.Infrml    0.631       NA                  
  Utilisation =~                                      
    Equ.Compts.Rrl    1.000                           
    Equ.Cmpts.Urbn    2.323       NA                  
    Equ.Compts.Ttl    3.486       NA                  
    Dep.Moy.Cpte      3.332       NA                  
    Dep.PIB           3.782       NA                  
    Cred.PIB          3.218       NA                  
    DepAV.DCFM        3.987       NA                  
    Prp.Fmms.Nv.Cr    0.720       NA                  
    Prp.Jns.Nv.Crd    1.374       NA                  
    Prop.Jeuns.Crd   -0.392       NA                  
    Prop.Femms.Crd    1.394       NA                  

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)
  Accès ~                                             
    Accès            -3.702       NA                  
  Dev ~                                               
    Dev              -2.410       NA                  
  Utilisation ~                                       
    Utilisation      -5.552       NA                  
  Accès ~                                             
    Dev              -0.242       NA                  
  Dev ~                                               
    Utilisation       1.177       NA                  
    Accès             0.618       NA                  
  Utilisation ~                                       
    Accès             1.493       NA                  
    Dev              -0.020       NA                  

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .Couv.Comm.Rurl    1.011       NA                  
   .Couv.Comm.Urbn    0.978       NA                  
   .Couv.Comm.Totl    0.720       NA                  
   .Dnst.Rs.Bq.Rrl    0.980       NA                  
   .Dnst.Rs.Bq.Urb    0.848       NA                  
   .Dnst.Rs.Bq.Ttl   -0.102       NA                  
   .Dnst.IOB.MTO.R    0.960       NA                  
   .Dnst.IOB.MTO.U    0.966       NA                  
   .Dnst.IOB.MTO.T    0.498       NA                  
   .Indice.Rur        0.634       NA                  
   .Pov.Mon           0.298       NA                  
   .Pov.Mult          0.526       NA                  
    Pov.Ext           0.985       NA                  
   .Pov.Glob          0.213       NA                  
   .Vuln.Urb          0.428       NA                  
   .Vuln.Rur          0.301       NA                  
   .Vuln              0.015       NA                  
   .PIB.hab           0.803       NA                  
   .DCFM.hab          0.786       NA                  
   .Pds.Emp.Infrml    0.868       NA                  
   .Equ.Compts.Rrl    0.919       NA                  
   .Equ.Cmpts.Urbn    0.650       NA                  
   .Equ.Compts.Ttl    0.230       NA                  
   .Dep.Moy.Cpte      0.294       NA                  
   .Dep.PIB           0.095       NA                  
   .Cred.PIB          0.342       NA                  
   .DepAV.DCFM       -0.004       NA                  
   .Prp.Fmms.Nv.Cr    0.953       NA                  
   .Prp.Jns.Nv.Crd    0.869       NA                  
   .Prop.Jeuns.Crd    0.976       NA                  
   .Prop.Femms.Crd    0.865       NA                  
   .Accès             0.017       NA                  
   .Dev               0.631       NA                  
   .Utilisation       0.023       NA                  

> lavInspect(fit, "converged")
[1] FALSE

2-MLR
fit<-sem(model=model.full,data=data,std.lv=TRUE,estimator = "MLR",se = "robust", test = "Satorra-Bentler")
summary(fit, fit.measures = TRUE, standardized = TRUE)
avInspect(fut, "converged")

The results i got:

> fit<-sem(model=model.full,data=data,std.lv=TRUE,estimator = "MLR",se = "robust", test = "Satorra-Bentler")
Error in solve.default(A1) : 
  system is computationally singular: reciprocal condition number = 2.34478e-37
In addition: Warning messages:
1: In lav_model_hessian(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  :
  lavaan WARNING: Hessian is not fully symmetric.
Max diff = 112.140213034585
(Max diag Hessian = 291.802586691273)
2: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  :
  lavaan WARNING:
    The variance-covariance matrix of the estimated parameters (vcov)
    does not appear to be positive definite! The smallest eigenvalue
    (= -2.206684e-10) is smaller than zero. This may be a symptom that
    the model is not identified.
>summary(fit, fit.measures = TRUE, standardized = TRUE)
lavaan 0.6-6 did NOT end normally after 10000 iterations
** WARNING ** Estimates below are most likely unreliable

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

Parameter Estimates:

  Standard errors                             Sandwich
  Information bread                           Observed
  Observed information based on                Hessian

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  Accès =~                                                              
    Couv.Comm.Rurl    1.000                               1.001    1.007
    Couv.Comm.Urbn   -0.238       NA                     -0.238   -0.240
    Couv.Comm.Totl    0.632       NA                      0.633    0.637
    Dnst.Rs.Bq.Rrl    0.306       NA                      0.307    0.309
    Dnst.Rs.Bq.Urb   -0.114       NA                     -0.115   -0.115
    Dnst.Rs.Bq.Ttl    0.961       NA                      0.962    0.966
    Dnst.IOB.MTO.R    0.204       NA                      0.204    0.206
    Dnst.IOB.MTO.U   -0.948       NA                     -0.949   -0.952
    Dnst.IOB.MTO.T    0.119       NA                      0.119    0.120
  Dev =~                                                                
    Couv.Comm.Rurl    1.000                               1.058    1.065
    Couv.Comm.Urbn    0.043       NA                      0.045    0.046
    Couv.Comm.Totl    0.129       NA                      0.137    0.138
    Dnst.Rs.Bq.Rrl    0.263       NA                      0.279    0.281
    Dnst.Rs.Bq.Urb   -0.237       NA                     -0.250   -0.252
    Dnst.Rs.Bq.Ttl   -0.889       NA                     -0.940   -0.944
    Dnst.IOB.MTO.R    0.261       NA                      0.276    0.278
    Dnst.IOB.MTO.U   -0.153       NA                     -0.162   -0.162
    Dnst.IOB.MTO.T   -0.316       NA                     -0.335   -0.337
  Utilisation =~                                                        
    Couv.Comm.Rurl    1.000                               1.155    1.163
    Couv.Comm.Urbn    0.002       NA                      0.003    0.003
    Couv.Comm.Totl    0.360       NA                      0.415    0.418
    Dnst.Rs.Bq.Rrl    0.365       NA                      0.421    0.424
    Dnst.Rs.Bq.Urb    0.235       NA                      0.271    0.273
    Dnst.Rs.Bq.Ttl    0.744       NA                      0.860    0.863
    Dnst.IOB.MTO.R    0.183       NA                      0.212    0.213
    Dnst.IOB.MTO.U    0.547       NA                      0.632    0.634
    Dnst.IOB.MTO.T    0.308       NA                      0.356    0.358

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  Accès ~                                                               
    Accès            -0.702       NA                     -0.702   -0.702
  Dev ~                                                                 
    Dev               1.283       NA                      1.283    1.283
  Utilisation ~                                                         
    Utilisation      -0.125       NA                     -0.125   -0.125
  Accès ~                                                               
    Dev              -0.007       NA                     -0.008   -0.008
  Dev ~                                                                 
    Utilisation      -0.309       NA                     -0.337   -0.337
    Accès            -0.289       NA                     -0.273   -0.273
  Utilisation ~                                                         
    Accès            -0.574       NA                     -0.497   -0.497
    Dev              -0.014       NA                     -0.013   -0.013

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .Couv.Comm.Rurl   -0.571       NA                     -0.571   -0.578
   .Couv.Comm.Urbn    0.925       NA                      0.925    0.937
   .Couv.Comm.Totl    0.698       NA                      0.698    0.708
   .Dnst.Rs.Bq.Rrl    0.833       NA                      0.833    0.845
   .Dnst.Rs.Bq.Urb    0.783       NA                      0.783    0.795
   .Dnst.Rs.Bq.Ttl   -1.287       NA                     -1.287   -1.296
   .Dnst.IOB.MTO.R    0.904       NA                      0.904    0.916
   .Dnst.IOB.MTO.U   -0.933       NA                     -0.933   -0.940
   .Dnst.IOB.MTO.T    0.715       NA                      0.715    0.726
    Indice.Rur        0.987       NA                      0.987    1.000
    Pov.Mon           0.987       NA                      0.987    1.000
    Pov.Mult          0.987       NA                      0.987    1.000
    Pov.Ext           0.987       NA                      0.987    1.000
    Pov.Glob          0.987       NA                      0.987    1.000
    Vuln.Urb          0.987       NA                      0.987    1.000
    Vuln.Rur          0.987       NA                      0.987    1.000
    Vuln              0.987       NA                      0.987    1.000
    PIB.hab           0.987       NA                      0.987    1.000
    DCFM.hab          0.987       NA                      0.987    1.000
    Pds.Emp.Infrml    0.987       NA                      0.987    1.000
    Equ.Compts.Rrl    0.987       NA                      0.987    1.000
    Equ.Cmpts.Urbn    0.987       NA                      0.987    1.000
    Equ.Compts.Ttl    0.987       NA                      0.987    1.000
    Dep.Moy.Cpte      0.987       NA                      0.987    1.000
    Dep.PIB           0.987       NA                      0.987    1.000
    Cred.PIB          0.987       NA                      0.987    1.000
    DepAV.DCFM        0.987       NA                      0.987    1.000
    Prp.Fmms.Nv.Cr    0.987       NA                      0.987    1.000
    Prp.Jns.Nv.Crd    0.987       NA                      0.987    1.000
    Prop.Jeuns.Crd    0.987       NA                      0.987    1.000
    Prop.Femms.Crd    0.987       NA                      0.987    1.000
   .Accès             1.000                               0.998    0.998
   .Dev               1.000                               0.893    0.893
   .Utilisation       1.000                               0.749    0.749

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

> lavInspect(fit, "converged")
[1] FALSE

Reply all
Reply to author
Forward
0 new messages