Linear Mixed-Effects Models using 'Eigen' and S4

Fit linear and generalized linear mixed-effects models. The models and their components are represented using S4 classes and methods. The core computational algorithms are implemented using the 'Eigen' C++ library for numerical linear algebra and 'RcppEigen' "glue".

  • Release 1.1-8 is on CRAN now. There are no major user-visible changes.
    • We have fixed some bugs in predict, simulate, and refit.
    • Convergence and positive-definite-Hessian warnings are still overly conservative for large (>10^4 rows) data sets, but we are holding off on changing anything until we really understand the problem; see help("convergence").
    • The deviance computation has changed for GLMMs; see "Deviance and log-likelihood of GLMMs" in merMod-class.Rd
  • Otherwise, see the NEWS file (or news(Version=="1.1.8",package="lme4")).
  • Efficient for large data sets, using algorithms from the Eigen linear algebra package via the RcppEigen interface layer.
  • Allows arbitrarily many nested and crossed random effects.
  • Fits generalized linear mixed models (GLMMs) and nonlinear mixed models (NLMMs) via Laplace approximation or adaptive Gauss-Hermite quadrature; GLMMs allow user-defined families and link functions.
  • Incorporates likelihood profiling and parametric bootstrapping.
  • From CRAN (stable release 1.0.+)
  • Development version from Github:
library("devtools"); install_github("lme4/lme4",dependencies=TRUE)

(This requires devtools >= 1.6.1, and installs the "master" (development) branch.) This approach builds the package from source, i.e. make and compilers must be installed on your system -- see the R FAQ for your operating system; you may also need to install dependencies manually. Specify build_vignettes=FALSE if you have trouble because your system is missing some of the LaTeX/texi2dvi tools.

  • Usually up-to-date development binaries from lme4 r-forge repository:

(these source and binary versions are updated manually, so may be out of date; if you believe they are, please contact the maintainers).

It is possible to install (but not easily to check) lme4 at least as recently as 1.1-7.

  • make sure you have exactly these package versions: Rcpp 0.10.5, RcppEigen
  • for installation, use --no-inst; this is necessary in order to prevent R from getting hung up by the knitr-based vignettes
  • running R CMD check is difficult, but possible if you hand-copy the contents of the inst directory into the installed package directory ...
  • lme4.0 is a maintained version of lme4 back compatible to CRAN versions of lme4 0.99xy, mainly for the purpose of reproducible research and data analysis which was done with 0.99xy versions of lme4.
  • there have been some reports of problems with lme4.0 on R version 3.1; if someone has a specific reproducible example they'd like to donate, please contact the maintainers.
  • Notably, lme4.0 features getME(<mod>, "..") which is compatible (as much as sensibly possible) with the current lme4's version of getME().
  • You can use the convert_old_lme4() function to take a fitted object created with lme4 <1.0 and convert it for use with lme4.0.
  • It currently resides on R-forge, and you should be able to install it with

(if the binary versions are out of date or unavailable for your system, please contact the maintainers).


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.1-27.1 by Ben Bolker, 6 months ago

Report a bug at

Browse source code at

Authors: Douglas Bates [aut] , Martin Maechler [aut] , Ben Bolker [aut, cre] , Steven Walker [aut] , Rune Haubo Bojesen Christensen [ctb] , Henrik Singmann [ctb] , Bin Dai [ctb] , Fabian Scheipl [ctb] , Gabor Grothendieck [ctb] , Peter Green [ctb] , John Fox [ctb] , Alexander Bauer [ctb] , Pavel N. Krivitsky [ctb, cph] , shared copyright on simulate.formula)

Documentation:   PDF Manual  

Task views: Econometrics, Analysis of Ecological and Environmental Data, Official Statistics & Survey Methodology, Psychometric Models and Methods, Statistics for the Social Sciences, Handling and Analyzing Spatio-Temporal Data, Official Statistics & Survey Statistics

GPL (>= 2) license

Imports graphics, grid, splines, utils, parallel, MASS, lattice, boot, nlme, minqa, nloptr

Depends on Matrix, methods, stats

Suggests knitr, rmarkdown, PKPDmodels, MEMSS, testthat, ggplot2, mlmRev, optimx, gamm4, pbkrtest, HSAUR3, numDeriv, car, dfoptim, mgcv, statmod, rr2, semEff

Linking to Rcpp, RcppEigen

Imported by ANTs, ARTool, AgroR, BBRecapture, BFpack, BayesCACE, BayesLN, BayesSenMC, BradleyTerry2, CMatching, DClusterm, DHARMa, ESTER, EdSurvey, GHap, GLMpack, HeritSeq, IDmeasurer, IMTest, JWileymisc, KenSyn, LKT, LSAmitR, MAGNAMWAR, MCM, MDMR, MLID, MMeM, MXM, MiRKAT, MixMAP, MixedPsy, MultiRR, PBImisc, PLmixed, PheVis, Phenotype, PoolTestR, PrevMap, REndo, RLRsim, RRreg, RVAideMemoire, RVFam, Rcmdr, RcmdrPlugin.TeachStat, ShinyItemAnalysis, SignacX, SimplyAgree, SlaPMEG, SoyNAM, StroupGLMM, Surrogate, TcGSA, VCA, VetResearchLMM, altmeta, attrib, autoMrP, bayesammi, baystability, biokNN, blmeco, boot.pval, brokenstick, buildmer, car, chngpt, ciTools, climwin, clusterPower, clusteredinterference, cpr, crctStepdown, cvms, dataquieR, daySupply, designr, diagmeta, difR, dmlalg, doremi, eatRep, eda4treeR, eefAnalytics, effects, epidemia, epr, ez, faraway, faux, fence, finalfit, fishmethods, fullfact, geex, glmmEP, glmmSeq, glmmTMB, glmmsr, gvcR, hmi, ib, iccbeta, inferference, intRvals, inti, isni, joineRML, jomo, jstable, latrend, lefko3, lmem.qtler, manymodelr, mbest, mecor, mediation, meta, metamicrobiomeR, metamisc, metan, metaplus, micemd, misty, mlVAR, modnets, multiDimBio, multiblock, multilevelTools, multisite.accuracy, omics, packDAMipd, pamm, paramhetero, partR2, pcgen, phyr, piecewiseSEM, powerbydesign, predint, projpred, psfmi, psycModel, ptmixed, qape, qra, rADA, raincin, rbenvo, refund, refund.shiny, reghelper, regplot, repmod, reproducer, rewie, rockchalk, rosetta, rpql, rptR, rr2, rsq, rstanarm, rties, selfmade, semEff, siland, sjstats, skpr, smicd, spOccupancy, specr, spsurvey, squid, stability, standardize, statgenGxE, statgenSTA, stevemisc, surrosurv, themetagenomics, tidyMicro, tramME, truthiness, tukeytrend, ubms, unmarked, varTestnlme, warpMix, weights, welchADF.

Depended on by BClustLonG, CLME, GLMMRR, HelpersMG, JointModel, LMERConvenienceFunctions, MEMSS, MargCond, Metatron, MixRF, MultisiteMediation, SPCDAnalyze, WeMix, WebPower, afex, agRee, aods3, arm, bapred, blme, cAIC4, carcass, cgam, dfmeta, eirm, gamm4, glmertree, gtheory, influence.ME, jlctree, joineRmeta, lmerTest, longpower, macc, marked, merDeriv, merTools, mixAK, mlmRev, mlma, mumm, mvMISE, panelr, pbkrtest, pedigreemm, prLogistic, predictmeans, r2mlm, robustBLME, robustlmm, sae, simr, structree, swissMrP.

Suggested by AICcmodavg, ANOM, AgreementInterval, BGData, BayesFactor, DAAG, DySeq, Epi, HLMdiag, HSAUR, HSAUR2, HSAUR3, ICCbin, KFAS, MARSS, MESS, MethComp, MuMIn, NHSRdatasets, OnAge, OpenMx, R2admb, RcmdrPlugin.NMBU, SARP.compo, SASmixed, ScottKnott, SimSurvey, TripleR, TukeyC, agridat, aod, bartCause, bayestestR, brms, brolgar, broom, broom.helpers, broom.mixed, broomExtra, bruceR, catdata, clubSandwich, codebook, concurve, correlation, ctsem, cvam, datawizard, dlnm, doBy, dominanceanalysis, dscore, effectsize, embed, emmeans, epimdr, equatiomatic, expp, eyetrackingR, finetune, flexmix, gamair, ggResidpanel, ggeffects, glmglrt, glmulti, gmodels, gtsummary, hamlet, hmclearn, hnp, huxtable, immer, insight, interactions, ipmr, irtrees, jtools, konfound, kulife, kyotil, languageR, lava, lavaSearch2, likelihoodAsy, lmeInfo, lmeresampler, lmfor, lucid, lvmisc, marginaleffects, margins, metadat, metafor, metarep, mice, miceadds, mitml, mixlm, mlr3pipelines, modelbased, modelsummary, multcomp, mztwinreg, ordinal, pan, parameters, performance, permutes, pez, phia, polypoly, postHoc, psr, psych, pubh, purge, r2glmm, report, rmcorr, samplingDataCRT, see, sense, shinybrms, simglm, sjPlot, slim, spaMM, stan4bart, supernova, tableone, tidyLPA, tidystats, tram, vtreat.

Enhanced by LAM, memisc, papeR, prediction, stargazer, texreg.

See at CRAN