mer-class {lme4} | R Documentation |
The mer
class represents linear or generalized
linear or nonlinear mixed-effects models. It incorporates
sparse model matrices for the random effects and corresponding sparse
Cholesky factors. The summary.mer
class represents the summary
of these objects.
## Methods with "surprising" arguments ## S4 method for signature 'mer': deviance(object, REML = NULL, ...) ## S4 method for signature 'mer': expand(x, sparse = TRUE, ...) ## S4 method for signature 'mer': logLik(object, REML = NULL, ...) ## S4 method for signature 'mer': print(x, digits, correlation, symbolic.cor, signif.stars, ...)
object |
object of class mer . |
REML |
logical indicating if REML should be used. A value of
NULL , the default, or NA indicates that the REML values
should be returned if the model was fit by REML, otherwise the ML values. |
x |
object of class mer to expand. |
sparse |
logical scalar indicating if the sparse form of the
expanded T and S matrices should be returned. |
digits |
number of digits to use when printing tables of
parameter estimates. Defaults to max(3, getOption("digits") -
3) . |
correlation |
logical - should the correlation matrix of the
fixed-effects parameter estimates be printed? Defaults to TRUE . |
symbolic.cor |
logical - should a symbolic form of the
correlation matrix be printed instead of the numeric form? Defaults
to FALSE . |
signif.stars |
logical - should the ‘significance stars’
be printed as part of the table of fixed-effects parameter
estimates? Defaults to getOption("show.signif.stars") . |
... |
potential further arguments passed to methods. |
Objects can be created by calls of the
form new("mer", ...)
or, more commonly, via the
lmer
, glmer
or nlmer
functions.
The class "mer"
represents a linear or generalized linear or
nonlinear or generalized nonlinear mixed model and contains the slots:
env
:"environment"
)
created for the evaluation of the nonlinear model function. Not
used except by nlmer
models.nlmodel
:"call"
. Not used except by nlmer
models.frame
:"data.frame"
).call
:"call"
).flist
:X
:nlmer
fitted model this matrix has n * s
rows
where n
is the number of observations and s
is the
number of parameters in the nonlinear model.Zt
:"dgCMatrix"
).pWt
:offset
:y
:"numeric"
).Gp
:Gp
are 0-based indices of
the first element from each random-effects term. Thus the first
element is always 0. The last element is the total length of the
random effects vector.dims
:ST
:V
:"matrix"
) of
the nonlinear model function. Not used except by
nlmer
models.A
:"dgCMatrix"
) for
the the unit, orthogonal random effects, U.Cm
:"dgCMatrix"
) for the
unit, orthogonal random effects, U. Not used except by
nlmer
models.Cx
:"x"
slot in the weighted sparse model
matrix (class "dgCMatrix"
)
for the unit, orthogonal random effects, U, in generalized
linear mixed models. For these models the matrices A and
C have the same sparsity pattern and only the "x"
slot of C needs to be stored.L
:"dCHMfactor"
) where P
is the fill-reducing permutation calculated from the pattern of
nonzeros in A.deviance
:"ML"
element)
and "REML"
criteria and various components. The
"ldL2"
element is twice the logarithm of the determinant of
the Cholesky factor in the L
slot. The "usqr"
component is the value of the random-effects quadratic form.fixef
:ranef
:u
:eta
:mu
:muEta
:var
:glm
family.resid
:sqrtrWt
slot (when its length is >0).sqrtXWt
:sqrtrWt
:RZX
:"matrix"
) to
L RZX = ST'Z'X = AX.RX
:"matrix"
)
of the downdated X'X.
The "summary.mer"
class contains the "mer"
,
class and has additional slots,
methTitle
:logLik
:logLik(object)
.ngrps
:flist
slot.sigma
:coefs
:vcov
:vcov(object)
.REmat
:AICtab
:signature(x = "mer")
: Extract variance and
correlation components. See VarCorr
signature(object = "mer")
: returns the sequential
decomposition of the contributions of fixed-effects terms or, for
multiple arguments, model comparison statistics. See
anova
.signature(object = "mer")
: returns an object
similar to the ranef
method but incorporating the
fixed-effects parameters, thereby forming a table of linear model
coefficients (the columns) by level of the grouping factor (the rows).signature(from = "mer", to = "dtCMatrix")
:
returns the L
slot as a "dtCMatrix"
(column-oriented, sparse, triangular matrix) object.signature(object = "mer")
: returns the
deviance
of the fitted model, or the “REML
deviance” (i.e. negative twice the REML criterion), according to
the REML argument. See the arguments section above for a description
of the REML argument.signature(object = "mer")
:
returns a list of terms in the expansion of the ST
slot.
If sparse
is TRUE
, the default, the elements of the
list are the numeric scalar "sigma"
, the REML or ML
estimate of the standard deviation in the model, and three sparse
matrices: "P"
, the permutation matrix, "S"
, the
diagonal scale matrix and "T"
, the lower triangular matrix
determining correlations. When sparse
is FALSE
each
element of the list is the expansions of the corresponding element
of the ST
slot into a list of S
, the diagonal
matrix, and T
, the (dense) unit lower triangular matrix.
signature(object = "mer")
:
returns the fitted conditional means of the responses. See
fitted
. The napredict
function is
called to align the result with the original data if the model was
fit with na.action = na.exclude
.
signature(object = "mer")
:
returns the estimates of the fixed-effects parameters. See
fixef
.
signature(x = "mer")
:
returns the model formula. See formula
.
signature(object = "mer")
:
returns the log-likelihood or the REML criterion, according to the
optional REML
argument (see the arguments section above),
of the fitted model. See also logLik
.
signature(object = "mer")
:
Create a Markov chain Monte Carlo sample from a posterior
distribution of the model's parameters. See
mcmcsamp
for details.
signature(formula = "mer")
: returns the
model frame (the frame
slot).signature(object = "mer")
: returns the
model matrix for the fixed-effects parameters (the X
slot).signature(x = "mer")
: print information about
the fitted model. See the arguments section above for a description
of optional arguments.signature(object = "mer")
: returns the
conditional modes of the random effects. See ranef
.signature(object = "mer", newresp = "numeric")
:
Update the response vector only and refit the model. See
refit
.signature(object = "mer")
: returns the (raw)
residuals. This method calls napredict
. See the
above description of the fitted
method for details. See
also resid
.signature(object = "mer")
: Another name
for the resid
method.signature(object = "mer")
: Same as the
print
method without the optional arguments.signature(object = "mer")
: simulate
nsim
(defaults to 1) responses from the theoretical
distribution corresponding to the fitted model. The refit
method is particularly useful in combination with this method.
See also simulate
.signature(x = "mer")
: Extract the
terms
object for the fixed-effects terms in the
model formula.signature(object = "mer")
: see
update
on how to update fitted models.signature(object = "mer")
: Calculate
variance-covariance matrix of the fixed effect terms,
see also vcov
.signature(data = "mer")
: Evaluate an R expression
in an environment constructed from the frame
slot.
lmer()
, glmer()
and nlmer()
,
which produce 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)) terms(fm2) str(model.matrix(fm2)) str(model.frame(fm2)) str(resid(fm2)) VarCorr(fm2) ee <- expand(fm2) op <- options(digits = 3) tcrossprod(ee$sigma * ee$P %*% ee$T %*% ee$S) options(op) ## Not run: ## Simulate 'Reaction' according to the fitted model: dim(ss <- simulate(fm2, nsim = 200, seed = 101)) ## -> 180 x 200 ## End(Not run)