NA values in standard errors after removing one variable from the model

Skip to first unread message

Tatiana Logvinenko

Sep 23, 2019, 9:53:00 AM9/23/19
to lavaan
I am using lavaan for SEM analysis of the dataset with test performance measures. I have 5 latent variables constructed from observed variables that were either subtests of one test, or were subtests of different tests measuring similar ability. 

After fitting the model, several problems occurred: 

1) NAs were introduced in CFI and TLI 

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

2) There is a warning, that  some observed variances are (at least) a factor 1000 times larger than others (use varTable(fit) to investigate); however the data was fitted, BUT after removing one exogenous variable from the regression expression NAs are introduced in the standard errors OR new warning occurs:  lavaan WARNING: the optimizer warns that a solution has NOT been found!

The variable I want to exclude from predictors was 'sex' variable (this variable is not causing anything else in my model): it could be either 1 or 2. 

I don't have any specific questions, but I will be happy to hear any thought why this error message occurs (or in some instance lavaan finds the solution but there are NAs in the standard errors) and how I can improve my model. It might be important, that when I knit my RMarkdown file to HTML I have different warning, that some variances are negative, but after fixing the variances the problem with 'sex' variable is still present. I also thought that  I shouldn't have specified in the var/covar parameter, that residuals of the variables that constitutes the same latent variable should correlate, but clearing it up haven't helped.

The lavaan syntax is as follows: 

sem <- '
# measurement model
word_id_time =~ psw_t + rw_t + ld_irrw + ld_nw + ld_regw
word_id_acc =~ word_id_total + pw_id_total
naming_acc =~ ran_c + ran_o + ran_l + ran_n + sn1e + sn2e +sw1e + sw2e
naming_speed =~ ran_ct + ran_ot + ran_lt + ran_nt + sn1t + sn2t + sw1t +sw2t
phon =~ pa + pseudo_a

# regressions
ab_com ~ word_id_time + word_id_acc + naming_acc + naming_speed + phon +age.tidy + sex
word_id_time ~ naming_speed
word_id_acc ~ naming_acc + phon

#this specifies a variance/covariance parameter
psw_t ~~ rw_t
ld_regw  ~~ ld_nw  + ld_irrw
psw_t ~~ pw_id_total
rw_t ~~ word_id_total
ran_c ~~   ran_ct + ran_o
ran_o ~~   ran_ot
ran_l ~~   ran_lt + ran_n
ran_n ~~   ran_nt
ran_ct ~~   ran_ot
ran_lt ~~   ran_nt
sn1t ~~     sn2t + sn1e + sn2e
sw1t ~~     sw2t +sw1e + sw2e

sem_test <- lavaan::sem(sem_model, data=data, estimator = "ML", missing="fiml",

I am using for this SEM 25 observed variables in total, among which there are transformed (sqrt) count variables (e.g. number of correct answers or number of errors), continuous right-skewed variables (e.g. time in seconds), and variables in z-scores (i.e. ab_com, pa, pseudo_a), however no categorical variable (except 'sex', but it is coded as integer and I want to exclude it). The total number of observations is 414 with some missing data, for which I've used (missing="fiml") option. 

I will appreciate any help on that, because I am very new to lavaan and I am not a proficient R-user. 


Sep 25, 2019, 7:58:57 AM9/25/19
to lavaan
  As a general strategy, focus on the first error/warning first because solving the first problem will often impact later ones.

  Scaling your variables is a standard step in data preparation for SEM analysis.  Multiply your variables by various powers of 10 to get them all to have variances that differ from one another by a ratio less than 1:10.  This should be discussed in more detail in any good introductory text book.

Keith A. Markus
John Jay College of Criminal Justice, CUNY
Frontiers of Test Validity Theory: Measurement, Causation and Meaning.

Reply all
Reply to author
0 new messages