Preprint
Machine Learning
Featured

Fitting Linear Mixed-Effects Models Using <b>lme4</b>

Douglas M. Bates(University of Wisconsin–Madison), Martin Mächler(ETH Zurich), Benjamin M. Bolker(McMaster University), Steve Walker(McMaster University)
January 1, 2015Journal of Statistical Software86,722 citations

87k

Citations

8.9k

Influential Citations

Journal of Statistical Software

Venue

2015

Year

Abstract

Maximum likelihood or restricted maximum likelihood (REML) estimates of the parameters in linear mixed-effects models can be determined using the lmer function in the lme4 package for R. As for most model-fitting functions in R, the model is described in an lmer call by a formula, in this case including both fixed- and random-effects terms. The formula and data together determine a numerical representation of the model from which the profiled deviance or the profiled REML criterion can be evaluated as a function of some of the model parameters. The appropriate criterion is optimized, using one of the constrained optimization functions in R, to provide the parameter estimates. We describe the structure of the model, the steps in evaluating the profiled deviance or REML criterion, and the structure of classes or types that represents such a model. Sufficient detail is included to allow specialization of these structures by users who wish to write functions to fit specialized linear mixed models, such as models incorporating pedigrees or smoothing splines, that are not easily expressible in the formula language used by lmer.

Analysis

Why This Paper Matters

This paper is the definitive reference for the lme4 package, which has become the de facto standard for fitting linear mixed-effects models in R. With over 86,000 citations, it underpins a vast amount of empirical research in fields ranging from ecology to psychology, where hierarchical or longitudinal data are common. The paper's clear exposition of the underlying optimization and profiling techniques makes it accessible to practitioners while providing enough detail for advanced users to extend the framework.

The lme4 package addresses a critical need in statistical computing: efficient and reliable estimation of mixed models, which are essential for analyzing data with multiple sources of variation. By providing a unified interface via the lmer function, it democratizes access to complex statistical methods.

Technical Contributions

The paper's key innovations include:

  • Profiled deviance/REML criterion: Separates optimization into a profiled step for fixed effects and variance components, reducing computational burden.
  • Formula-based model specification: Extends R's formula syntax to include random effects terms (e.g., (1|group)), making model definition intuitive.
  • Numerical representation: Converts model formulas and data into a sparse matrix representation for efficient computation.
  • Extensible class structure: Defines classes (e.g., merMod) that allow users to implement specialized random effects structures, such as those for pedigrees or smoothing splines.
  • Constrained optimization: Leverages R's optimizers (e.g., Nelder-Mead, bobyqa) to handle non-negative variance components.

Results

No empirical results or benchmarks are reported in this methodological paper. The primary outcome is the software implementation itself, which has been validated through extensive use in the research community. The lme4 package is known for its computational efficiency and numerical stability, handling models with thousands of observations and hundreds of random effects levels.

Significance

The lme4 package has had a transformative impact on applied statistics and data science. It enables researchers to fit complex hierarchical models without writing custom optimization code, accelerating analysis in fields like genetics, ecology, and social sciences. The paper's detailed documentation of the underlying algorithms also serves as a template for implementing similar mixed-effects software in other languages. Its high citation count reflects its role as a foundational tool in modern statistical practice.