I have a longitudinal data with ~2400 participants and ~15000 observations. When fitting the mixed effects model using lmer()
with a random slope of time, I received a warning:
optimizer (nloptwrap) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.00897475 (tol = 0.002, component 1)`
but also got a model estimate.
The model is
lmer(sbp ~ time + cov1 + cov2 + cov3 + cov4 +
cov5 + cov6 + cov7 + cov8 + (time|ID), data = df)
I looked at the troubleshooting page from the lme4 package and another nice page describing the convergence issue to check whether this warning is a false positive. I found that the warning can be resolved by rescaling (i.e. standardizing) the time variable in the model. All the fixed effect coefficients of covariates are the same as in the original model. I am interested in getting the slope of time for each participant from this model, so I prefer to keep time in its original scale. Can I say that the warning message is false positive and use my original model?
Can I say that the warning message is false positive and use my original model?
Yes.
Alternately, you could scale and center the time variable and then apply the reverse transformation to the coefficient, as in this question; i.e., if you scale (divide) time by a factor x
before fitting, then you should multiply the time coefficients by x
after fitting (random-effect SDs would be scaled by x
and variances by x^2
).