I have the following model:

 Model <- lmer(x ~ y * z * d * k + (1 + y * z + d | subject), data = Data, 
          REML = FALSE, 
          control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000)))

It did not converge, should I increment the number of iterations? How many iterations are adequate?

  • 4
    $\begingroup$ Convergence problems are not unusual if your model is quite complex (in particular regarding the random effects' structure). First you should make sure that you don't have a false convergence warning, see help("convergence"). Then you could try supplying better starting values to the optimizer. Ultimately, a simpler model is often the only solution if the data can't support the complex model. $\endgroup$ – Roland Sep 17 '19 at 12:36
  • $\begingroup$ I tried with 1e+6 and it worked, no longer get a convergence warning. But are those too many iterations? $\endgroup$ – CatM Sep 17 '19 at 12:43
  • 1
    $\begingroup$ @Roland: do you want to post your comments as an answer? $\endgroup$ – Stephan Kolassa Sep 17 '19 at 12:47
  • 1
    $\begingroup$ The advice by @Roland is excellent. I would nevertheless be concerned about any results that required a million iterations to achieve, because that problem flags the very real possibility the solution could be a critical point but not optimal (or not even a true critical point at all). At a minimum you would want to capture diagnostic information during the iterations and explore that to see the details of the search. You would also want to apply standard reliability checks, including restarting the search from random locations. $\endgroup$ – whuber Sep 17 '19 at 12:52
  • 1
    $\begingroup$ @CatM You should do that and also restart the fit from points slightly outside of the reported optimum. $\endgroup$ – Roland Sep 17 '19 at 12:59

There is no "too many iterations" in numeric optimization. "Too many" is what takes "too long", for a case-specific definition of "too long".

However, slow convergence (needing to increase the number of iterations from the default) is often an indication of potential problems. It could be that your data simply can't support the model and you need to simplify it. This is often the case if you have a complex random effects structure (as you do).

You should use the methods described in help("convergence") to check that the warnings are not false positive and/or that you actually have achieved true convergence (arrived at a global maximum).

You should also carefully check the model output. Extremely small estimated variances (or strong correlations) of random effects are reason for concern (and often mean the parameter should be removed from the model).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.