lmer-class {lme4}R Documentation

Mixed Model Representations and *mer Methods

Description

The mer class is mixed-effects representation using a blocked, sparse, symmetric, column-oriented matrix and dense matrices. The lmer class extends mer to represent a fitted linear mixed-effects model. The summary.mer and summary.lmer classes represent summaries of these objects. The coef.lmer and ranef.lmer classes represent fixed and random effect “coefficients”.

Usage

## S4 method for signature 'mer':
logLik(object, REML = object@method == "REML", ...)
## S4 method for signature 'mer':
vcov(object, REML = object@method == "REML", ...)

Arguments

object object of class mer or lmer.
REML logical indicating if REML should be used.
... potential further arguments passed to methods.

Objects from the Class

Objects can be created by calls of the form new("lmer", ...) or, more commonly via the lmer function.

Slots

flist:
The list of grouping factors for the random effects.
Zt:
The transpose of the model matrix for the random effects stored as a "dgCMatrix".
X:
Model matrix for the fixed effects.
y:
Numeric response vector.
wts:
Numeric weights vector.
wrkres:
Numeric vector of working residuals.
method:
Character vector of length 1 containing "ML", for maximum likelihood, or "REML", for restricted maximum likelihood, or "PQL", for penalized quasi-likelihood, or "Laplace", for the Laplacian approximation, or "AGQ", for adaptive Gauss-Hermite quadrature.
family:
a copy of the glm family.
call:
a copy of the call to the model-fitting function.
cnames:
a list of character vectors of column names of the random-effects variance-covariance matrix associated with each grouping factor and the fixed-effects model matrix.
nc:
integer vector giving the number of columns the variance-covariance matrix associated with each grouping factor.
Gp:
integer vector of group pointers within the random effects and the rows of the transposed model matrix in the Zt slot. The elements of Gp are the 0-based index of the first element corresponding to each grouping factor. Thus the first element is always 0. The last element is the total length of the random effects vector (also the total number of rows in the matrix in the Zt slot).
XtX:
The crossproduct matrix of the model matrix in the X slot, stored as a "dpoMatrix" object.
ZtZ:
The crossproduct matrix of the model matrix for the random effects, stored as a "dpoMatrix" object.
ZtX:
The original Z'X matrix, stored as a "dgeMatrix" object.
Zty:
The numeric vector Z'y.
Xty:
The numeric vector X'y.
Omega:
A list of positive-definite matrices stored as "dpoMatrix" objects that are the relative precision matrices of the random effects associated with each of the grouping factors.
L:
The sparse, supernodal lower Cholesky factor of Z'Z+Omega, stored as a "dCHMsuper" object.
RZX:
A rectangular matrix, stored as a "dgeMatrix" object, which is the RZX component of the Cholesky factor of Z'Z+Omega at the current values of the parameters.
RXX:
An upper triangular matrix, stored as a "dtrMatrix" object, which is the RXX component of the Cholesky factor of Z'Z+Omega at the current values of the parameters.
rZy:
A numeric vector - the rZy component of the Cholesky factor of Z'Z+Omega at the current values of the parameters.
rXy:
A numeric vector - the rXy component of the Cholesky factor of Z'Z+Omega at the current values of the parameters.
devComp:
Numeric vector of components from which the deviance can be calculated. The named components are: "n", the number of observations (length of the "y" slot), "p", the length of the fixed-effects vector (number of columns of the matrix in the "X" slot), "yty", the sum of squares of the y,"logryy2", the logarithm of the penalized residual sum of squares, "logDetL2", the logarithm of the square of the determinant of L, "logDetOmega", the logarithm of the determinant of Omega, and "logDetRXX", the logarithm of the determinant of the triangular matrix in the "RXX" slot. This slot's contents are current if status$stage > 0.
deviance:
Numeric vector of length 2 containing the deviance corresponding to the maximum likelihood (ML) and REML criteria. This slot's contents are current if status$stage > 0factored.
fixef:
Numeric vector containing the conditional estimates of the fixed effects. This slot's contents are current if status$stage > 1.
ranef:
Numeric vector containing the conditional modes of the random effects. This slot's contents are current if status$stage > 1.
RZXinv:
A rectangular matrix, stored as a "dgeMatrix" object, which is the RZX component of the inverse of the Cholesky factor of Z'Z+Omega at the current values of the parameters. This slot's contents are current if status$stage > 2.
bVar:
A list of the diagonal inner blocks (upper triangles only) of the positive-definite matrices on the diagonal of the inverse of ZtZ+Omega. With the appropriate scale factor (and conversion to a symmetric matrix) these are the conditional variance-covariance matrices of the random effects.
gradComp:
A list of three-dimensional arrays each with four faces. See the code for the documentation of these components.
status:
Integer vector of length 4 indicating the stage of the calculation at the current value of Omega, and whether REML is being used. The codes for the "stage" element are 0 - unfactored, 1 - factored, 2 - secondary, 3 - gradComp and 4 - HessComp.
call:
A copy of the matched call to the function that created the object.
frame:
the model frame for the model or an empty data frame
terms:
the terms attribute of the model frame for the fixed-effects terms only
weights:
prior weights on the responses. Only present in the glmer class.
showCorrelation:
Logical indicator of whether to display the correlation of the fixed-effects estimates when showing the object. Only present in the summary.lmer class.

The "summary.mer", "summary.lmer" and "summary.glmer" classes contain the "mer", "lmer" and "glmer" classes respectively and have additional slots,

isG:
logical indicating if we have a generalized linear mixed effects model.
methTitle:
character string specifying a method title
logLik:
the same as logLik(object).
ngrps:
...
sigma:
the scale ...
coefs:
the coefficients matrix...
vcov:
the same as vcov(object).
REmat:
the formatted Random-Effects matrix
AICtab:
...

Methods

anova
signature(object = "mer"): model comparisons for mer objects, see anova.
coef
signature(object = "lmer"): Extract the parameters that determine the Omega matrices. The optional logical argument unconstr determines the constrained or unconstrained parameterization.
coef<-
signature(object = "lmer", value = "numeric"): Assign the parameters that determine the Omega matrices. The optional logical argument unconstr determines the constrained or unconstrained parameterization.
coerce
signature(from = "lmer", to = "dtTMatrix"): Ensure that the lmer object has been factored but not inverted and extract the unit lower triangular matrix L from the LDL decomposition of crossprod(Z)+Omega.
coerce
signature(from = "lmer", to = "dsTMatrix"): Ensure that the lmer object has been factored but not inverted and extract the symmetric matrix crossprod(Z)+Omega.
deviance
signature(object = "mer"): extracts the deviance of the fitted model.
logLik
signature(object = "mer"): Extract the log-likelihood from of the fitted model, see also logLik.
update
signature(object = "mer"): see update on how to update fitted models.
simulate
signature(object = "mer"): see simulate on how to simulate from fitted models.
solve
signature(a = "lmer", b = "missing"): Invert the decomposed matrices.
terms
signature(x = "lmer"): Extract terms component.
vcov
signature(object = "mer"): Calculate variance-covariance matrix of the fixed effect terms, see also vcov.

See Also

lmer() produces these objects.
VarCorr for extracting the variance and correlation components of the random-effects terms.

Examples

(fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject),
             data = sleepstudy))
logLik(fm2)
(V2 <- vcov(fm2))
str(resid(fm2))

## Simulate 'Reaction' according to the fitted model:
dim(ss <- simulate(fm2, nsim = 200, seed = 101)) ## -> 180 x 200

[Package lme4 version 0.9975-9 Index]