lme4-package: Linear, generalized linear, and nonlinear mixed models
Description
lme4
provides functions for fitting and analyzing
mixed models: linear (lmer
), generalized linear
(glmer
) and nonlinear (nlmer
.)Differences between <code>nlme</code> and <code>lme4</code>
lme4
covers approximately the same ground as the earlier nlme
package. The most important differences are:
lme4
uses modern, efficient linear algebra methods
as implemented in theEigen
package, and uses reference
classes to avoid undue copying of large objects; it is therefore likely
to be faster and more memory-efficient thannlme
.lme4
includes generalized linear mixed model (GLMM)
capabilities, via theglmer
function.lme4
doesnotcurrently implementnlme
's
features for modeling heteroscedasticity and
correlation of residuals.lme4
does not currently offer the same flexibility
asnlme
for composing complex variance-covariance structures,
but it does implement crossed random effects in a way that
is both easier for the user and much faster.lme4
offers built-in facilities for likelihood
profiling and parametric bootstrapping.lme4
is designed to be more modular thannlme
,
making it easier for downstream package developers and end-users
to re-use its components for extensions of the basic mixed model
framework. It also allows more flexibility for specifying
different functions for optimizing over the random-effects
variance-covariance parameters.lme4
is not (yet) as well-documented asnlme
.
Differences between current (1.0.+) and previous versions of
<code>lme4</code>
[gn]lmer
now produces objects of classmerMod
rather than classmer
as before- the new version uses a combination of S3 and reference classes
(see
ReferenceClasses
,merPredD-class
, andlmResp-class
) as well as S4 classes; partly for this reason
it is more interoperable withnlme
- The internal structure of [gn]lmer is now more modular, allowing
finer control of the different steps of argument checking; construction
of design matrices and data structures; parameter estimation; and construction
of the final
merMod
object (seemodular
) - profiling and parametric bootstrapping are new in
the current version
- the new version of
lme4
doesnotprovide
anmcmcsamp
(post-hoc MCMC sampling) method, because this
was deemed to be unreliable. Alternatives for computing p-values
include parametric bootstrapping (bootMer
) or methods
implemented in thepbkrtest
package and leveraged by thelmerTest
package and theAnova
function in thecar
package
(seepvalues
for more details).
Caveats and trouble-shooting
- Some users who have previously installed versions of the
RcppEigen and minqa packages may encounter segmentation faults (!!);
the solution is to make sure to re-install these packages before
installing
lme4
. (Because the problem is not with the
explicitversionof the packages, but with running
packages that were built with different versions ofRcpp
in conjunction with each other, simply making sure you have
the latest version, or usingupdate.packages
, will
not necessarily solve the problem; you must actually re-install
the packages. The problem is most likely withminqa
.)