lmer-class {lme4} | R Documentation |
The mer
class is mixed-effects representation using a
sparse, symmetric, column-oriented matrix and several 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”.
## S4 method for signature 'mer': logLik(object, REML = object@status["REML"], ...) ## S4 method for signature 'mer': vcov(object, REML = object@status["REML"], ...)
object |
object of class mer or lmer . |
REML |
logical indicating if REML should be used. |
... |
potential further arguments passed to methods. |
Objects can be created by calls of the form new("lmer", ...)
or, more commonly via the lmer
function.
flist
:Zt
:"dgCMatrix"
.X
:y
:wts
:wrkres
:method
:"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
:call
:cnames
:nc
:Gp
: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
:X
slot, stored as a
"dpoMatrix"
object.ZtZ
:"dpoMatrix"
object.ZtX
:"dgeMatrix"
object.Zty
:Xty
:Omega
:"dpoMatrix"
objects that are the
relative precision matrices of the random effects associated with
each of the grouping factors.L
:"dCHMsuper"
object.RZX
:"dgeMatrix"
object, which is the RZX
component of the Cholesky factor of Z'Z+Omega at the
current values of the parameters.RXX
:"dtrMatrix"
object, which is the RXX
component of the Cholesky factor of Z'Z+Omega at the
current values of the parameters.rZy
:rXy
:devComp
:"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
:status$stage > 0factored
.fixef
:status$stage > 1
.ranef
:status$stage > 1
.RZXinv
:"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
: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
:status
: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
:frame
:terms
:weights
:glmer
class.showCorrelation
: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
:methTitle
:logLik
:logLik(object)
.ngrps
:sigma
:coefs
:vcov
:vcov(object)
.REmat
:AICtab
:signature(object = "mer")
: model comparisons for
mer
objects, see anova
.signature(object = "lmer")
: Extract the
parameters that determine the Omega matrices. The optional
logical argument unconstr
determines the constrained or
unconstrained parameterization.signature(object = "lmer", value = "numeric")
: Assign the
parameters that determine the Omega matrices. The optional
logical argument unconstr
determines the constrained or
unconstrained parameterization. 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.signature(from = "lmer", to = "dsTMatrix")
:
Ensure that the lmer
object has been factored but not
inverted and extract the symmetric matrix
crossprod(Z)+Omega.signature(object = "mer")
: extracts the
deviance
of the fitted model.signature(object = "mer")
: Extract the
log-likelihood from of the fitted model, see also logLik
.signature(object = "mer")
: see
update
on how to update fitted models.signature(object = "mer")
: see
simulate
on how to simulate from fitted models.signature(a = "lmer", b = "missing")
: Invert
the decomposed matrices.signature(x = "lmer")
: Extract
terms
component.signature(object = "mer")
: Calculate
variance-covariance matrix of the fixed effect terms,
see also vcov
.
lmer()
produces these objects.
VarCorr
for extracting the variance and
correlation components of the random-effects terms.
(fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), data = sleepstudy)) print(fm2, digits = 10, corr = FALSE) # more precision; no corr.matrix 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