lme4 (version 0.9975-9)

lmer: Fit (Generalized) Linear Mixed-Effects Models

Description

This generic function fits a linear mixed-effects model with nested or crossed grouping factors for the random effects.

Usage

lmer(formula, data, family, method, control, start,
     subset, weights, na.action, offset, contrasts,
     model, ...)

## S3 method for class 'formula': lmer(formula, data, family, method, control, start, subset, weights, na.action, offset, contrasts, model, \dots)

Arguments

formula
a two-sided linear formula object describing the fixed-effects part of the model, with the response on the left of a ~ operator and the terms, separated by + operators, on the right. The vertical bar character
data
an optional data frame containing the variables named in formula. By default the variables are taken from the environment from which lmer is called.
family
a GLM family, see glm. If family is missing then a linear mixed model is fit; otherwise a generalized linear mixed model is fit.
method
a character string. For a linear mixed model the default is "REML" indicating that the model should be fit by maximizing the restricted log-likelihood. The alternative is "ML" indicating that the log-likelihood shou
control
a list of control parameters. See below for details.
start
a list of relative precision matrices for the random effects. This has the same form as the slot "Omega" in a fitted model. Only the upper triangle of these symmetric matrices should be stored.
subset, weights, na.action, offset, contrasts
further model specification arguments as in lm; see there for details.
model
logical indicating if the model component should be returned (in slot frame).
...
potentially further arguments for methods. Currently none are used.

Value

  • An object of class "lmer". There are many methods applicable to "lmer" objects, see the above help page.

concept

GLMM

Details

This is a revised version of the lme function from the nlme package. This version uses a different method of specifying random-effects terms and allows for fitting generalized linear mixed models as well as linear mixed models.

Additional standard arguments to model-fitting functions can be passed to lmer. [object Object],[object Object],[object Object],[object Object]

See Also

The lmer class, lm

Examples

Run this code
(fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
(fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy))
anova(fm1, fm2)

Run the code above in your browser using DataCamp Workspace