The challenge of convergence is well known in the area of mixed-effects models. These models often struggle to reach reliable-enough estimates due to an insufficiency of data relative to the complexity of the model (Baayen et al., 2008; Bates et al., 2015; Brauer & Curtin, 2018). The solutions proposed range from the removal of random slopes under certain conditions (Matuschek et al., 2017) to the maintenance of random slopes in spite of convergence warnings, which seeks to avoid an inflation of the Type I error due to dependencies in the data (Brauer & Curtin, 2018; Singmann & Kellen, 2019).

The multiple-optimisers sanity check from lme4::allFit()

Framed within the drive to maintain random slopes wherever possible, the developers of the ‘lme4’ package propose a sanity check that uses a part of the ‘lme4’ engine called ‘optimiser’. Every model has a default optimiser, unless a specific one is chosen through control = lmerControl(optimiser = '...') (in lmer models) or control = glmerControl(optimiser = '...') (in glmer models). The seven widely-available optimisers are:

  • bobyqa
  • Nelder_Mead
  • nlminbwrap
  • nmkbw
  • optimx.L-BFGS-B
  • nloptwrap.NLOPT_LN_BOBYQA

To assess whether convergence warnings render the results invalid, or on the contrary, the results can be deemed valid in spite of the warnings, Bates et al. (2021) suggest refitting models affected by convergence warnings with a variety of optimisers. The authors argue that if the different optimisers produce practically-equivalent results, the results are valid. For this purpose, the ‘allFit’ function from the ‘lme4’ package allows the refitting of models using a number of optimisers. To use the seven optimisers listed above, two extra packages were installed: ‘dfoptim’ and ‘optimx’ (see lme4 manual). The output from ‘allFit’ contains several statistics on the fixed and the random effects fitted by each optimiser (see example).

The severity of convergence problems in each study will be examined below using the ‘allFit’ function from the ‘lme4’ package.


Baayen, R. H., Davidson, D. J., & Bates, D. M. (2008). Mixed-effects modeling with crossed random effects for subjects and items. Journal of Memory and Language, 59(4), 390–412.
Bates, D., Mächler, M., Bolker, B., & Walker, S. (2015). Fitting linear mixed-effects models using lme4. Journal of Statistical Software, 67, 1–48.
Bates, D., Maechler, M., Bolker, B., Walker, S., Christensen, R. H. B., Singmann, H., Dai, B., Scheipl, F., Grothendieck, G., Green, P., Fox, J., Brauer, A., & Krivitsky, P. N. (2021). Package ’lme4. CRAN.
Brauer, M., & Curtin, J. J. (2018). Linear mixed-effects models and the analysis of nonindependent data: A unified framework to analyze categorical and continuous independent variables that vary within-subjects and/or within-items. Psychological Methods, 23(3), 389–411.
Matuschek, H., Kliegl, R., Vasishth, S., Baayen, H., & Bates, D. (2017). Balancing Type I error and power in linear mixed models. Journal of Memory and Language, 94, 305–315.
Singmann, H., & Kellen, D. (2019). An introduction to mixed models for experimental psychology. In D. H. Spieler & E. Schumacher (Eds.), New methods in cognitive psychology (pp. 4–31). Psychology Press.

Pablo Bernabeu, 2022. Licence: CC BY 4.0.

Online book created using the R package bookdown.