lavaan WARNING: the optimizer (NLMINB) claimed the model converged

480 views
Skip to first unread message

LIU BAI

unread,
Oct 8, 2021, 11:25:11 AM10/8/21
to lavaan
Dear group members
I conducted a mediation model using lavaan. I got no error and no warning without bootstrapping. However, when using bootstrapping (n = 10000), I got a warning below:

"## Warning 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."

This warning repeated several times and at the end I have the other warning:
## Warning in bootstrap.internal(object = NULL, lavmodel. = lavmodel, 
## lavsamplestats. = lavsamplestats, : lavaan WARNING: only 9960 bootstrap draws ## were successful.

I did get the estimated results and the model summary showed that I requested 10000 bootstrap draws but 9960 draws were successful. I have no latent variables in the model, and I tried scaling all variables included in the model, but still got the same warnings.

I assume that a bootstrap draw would not be successful when the gradient elements are not zero. Please correct me if I'm wrong!

My question is whether this warning is an issue when using bootstrapping? Are the estimations still reliable in this situation? Is there any way to solve the warning?

Thank you very much!



Liu

Terrence Jorgensen

unread,
Oct 13, 2021, 4:20:49 AM10/13/21
to lavaan
this warning is an issue when using bootstrapping? Are the estimations still reliable in this situation?

I don't think you have anything to worry about.  Is your sample size modest, and Likert variables have few (e.g., 5) response categories?  It is possible that some bootstrap samples manifest a perfect correlation between a pair of variables just due to sampling error, in which case the model cannot be fit.  Something else might be going on, but regardless, you have 99.6% successful samples out of 10K, so you can draw your inferences from those.  If you really want to investigate further, you can generate your 10K bootstraps first, then use lavaanList() to fit them.  In the output, fit@meta$ok == FALSE for replications that did not converge, so you can extract those samples and fit them one at a time with lavaan() to see what happens.

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

Liu Bai

unread,
Oct 22, 2021, 3:17:19 PM10/22/21
to lavaan
Hello Terrence,
Thank you so much for your reply! This is really helpful.

Liu

Reply all
Reply to author
Forward
0 new messages