Change optimiser

If a maximal model will not converge, then sometimes all you need to do is change the optimiser (see Troubleshoot).

Optimisers change how the model estimates the parameters. An optimiser that often works well is bobyqa:

lmer(
  y ~ 1 + x * z + (1 + x * z | g), 
  data = df, 
  control = lmerControl(optimizer = "bobyqa")  # add in this line
)

(For logistic regression models with glmer(), write glmerControl(optimizer = "bobyqa") instead.)

If bobyqa still isn’t helping your model converge, then you can use the function allFit() to try all available optimisers for a given model. It will be slow, but it’ll help you identify which optimisers work (if any), or whether you’ll have to move on to simplify your model.

allopts <- allFit(myfittedmodel)
summary(allopts)

If no optimisers help your model converge, then you will need to simplify the model’s random effect structure.

Linked flash cards