CFA with Nas

897 views
Skip to first unread message

Andrea Araujo

unread,
Sep 17, 2021, 4:29:21 PM9/17/21
to lavaan
Hi all. I am new with SEM and lavaan. I am running the next model

myModel <- '
   # latent variables
     Connectivity=~Longitud_vias+L_orden_1+L_orden_2+
              L_orden_3+L_orden_4+L_orden_5+L_orden_6+Total+
              Num_Riesgo+Promedio_DistanciaCA2018+Promedio_DistanciaLB2018
     LULCC=~PorcentajeDef16_18+PorcentajeBosque+PorcentajeAgropecuario+
            PorcentajeCA+PorcentajeVA+PorcentajeZA+PorcentajeZI
     
   # regressions
     Casos2018 ~ Connectivity+LULCC
     
   # residual covariances
     Connectivity~~LULCC'

fit1<-cfa(myModel, data=alldata)

And I got this error:

Error in lav_samplestats_from_data(lavdata = lavdata, lavoptions = lavoptions,  : 
  lavaan ERROR: data contains no observations

Warning messages:
1: In lav_data_full(data = data, group = group, cluster = cluster,  :
  lavaan WARNING: some observed variances are (at least) a factor 1000 times larger than others; use varTable(fit) to investigate
2: In lav_data_full(data = data, group = group, cluster = cluster,  :
  lavaan WARNING: some observed variances are larger than 1000000
  lavaan NOTE: use varTable(fit) to investigate
3: In lav_data_full(data = data, group = group, cluster = cluster,  :
  lavaan WARNING: small number of observations (nobs < nvar)
  nobs = 0 nvar = 19

I guess it is because some of my observations contain no data or NAs, thus I am wondering how to deal with Nas? 

Thank you

Terrence Jorgensen

unread,
Sep 17, 2021, 6:40:09 PM9/17/21
to lavaan
Error in lav_samplestats_from_data(lavdata = lavdata, lavoptions = lavoptions,  : 
  lavaan ERROR: data contains no observations

Is this the case after listwise deletion (the default)?  Maybe try FIML


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

Andrea Araujo

unread,
Sep 22, 2021, 2:20:53 PM9/22/21
to lavaan
Dear Terrence,

Thank you very much! It worked in the sense that I have no errors. Nevertheless I keep on having the same warnings. Could you guide a bit about what these warnings mean?

Warning messages:
1: In lav_data_full(data = data, group = group, cluster = cluster,  :
  lavaan WARNING: some observed variances are (at least) a factor 1000 times larger than others; use varTable(fit) to investigate
2: In lav_data_full(data = data, group = group, cluster = cluster,  :
  lavaan WARNING: some observed variances are larger than 1000000
  lavaan NOTE: use varTable(fit) to investigate
3: In lav_data_full(data = data, group = group, cluster = cluster,  :
  lavaan WARNING: due to missing values, some pairwise combinations have less than 10% coverage
4: In lav_mvnorm_missing_h1_estimate_moments(Y = X[[g]], wt = WT[[g]],  :
  lavaan WARNING:
    Maximum number of iterations reached when computing the sample
    moments using EM; use the em.h1.iter.max= argument to increase the
    number of iterations
5: In lavaan::lavaan(model = myModel, data = alldata, missing = "ml.x",  :
  lavaan WARNING:
    the optimizer warns that a solution has NOT been found!

Thank you!

Pat Malone

unread,
Sep 22, 2021, 2:31:59 PM9/22/21
to lav...@googlegroups.com
Try dividing the variable with the massive variance by 100. Greatly disparate variances can cause computational difficulties. No testing will be affected, just the scaling of paths (and SEs) involving that variable.

--
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/436b77a7-90f1-4dc6-9f1a-a95f40213704n%40googlegroups.com.


--
Patrick S. Malone, PhD
Sr Research Statistician, FAR HARBΦR
This message may contain confidential information; if you are not the intended recipient please notify the sender and delete the message.
Reply all
Reply to author
Forward
0 new messages