Rev 3365 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{lmer-class}\title{Mixed Model Representations and *mer Methods}\docType{class}% Classes\alias{lmer-class}\alias{glmer-class}\alias{mer-class}\alias{coef.lmer-class}\alias{summary.mer-class}\alias{summary.lmer-class}\alias{ranef.lmer-class}% Methods\alias{anova,mer-method}\alias{coef,mer-method}\alias{coef,mer-method}\alias{coerce,lmer,dsTMatrix-method}\alias{coerce,mer,dtCMatrix-method}\alias{coerce,mer,pMatrix-method}\alias{chol,lmer,ANY-method}\alias{confint,mer-method}\alias{deviance,mer-method}\alias{fitted,mer-method}\alias{formula,mer-method}\alias{logLik,mer-method}\alias{plot,coef.lmer-method}\alias{plot,ranef.lmer-method}\alias{qqmath,ranef.lmer-method}\alias{resid,mer-method}\alias{residuals,mer-method}\alias{show,mer-method}\alias{simulate,mer-method}\alias{summary,mer-method}\alias{terms,lmer-method}\alias{update,mer-method}\alias{vcov,mer-method}\alias{with,lmer-method}%\alias{deviance,summary.mer-method}\alias{logLik,summary.mer-method}\alias{vcov,summary.mer-method}\alias{summary,summary.mer-method}\description{The \code{mer} class is mixed-effects representation using ablocked, sparse, symmetric, column-oriented matrix and densematrices. The \code{lmer} class extends \code{mer} to represent afitted linear mixed-effects model. The \code{summary.mer} and\code{summary.lmer} classes represent summaries of these objects. The\code{coef.lmer} and \code{ranef.lmer} classes represent fixed andrandom effect \dQuote{coefficients}.}\section{Objects from the Class}{Objects can be created by calls of the form \code{new("lmer", ...)}or, more commonly via the \code{\link{lmer}} function.%%% Doug, will we want to keep this?%% or by applying the \code{summary} generic to an \code{lmer} object.}\section{Slots}{\describe{\item{\code{flist}:}{The list of grouping factors for the randomeffects.}\item{\code{Zt}:}{The transpose of the model matrix for the randomeffects stored as a \code{\linkS4class{dgCMatrix}}.}\item{\code{X}:}{Model matrix for the fixed effects.}\item{\code{y}:}{Numeric response vector.}\item{\code{wts}:}{Numeric weights vector.}\item{\code{wrkres}:}{Numeric vector of working residuals.}\item{\code{method}:}{Character vector of length 1 containing\code{"ML"}, for maximum likelihood, or \code{"REML"}, forrestricted maximum likelihood, or \code{"PQL"}, for penalizedquasi-likelihood, or \code{"Laplace"}, for the Laplacianapproximation, or \code{"AGQ"}, for adaptive Gauss-Hermitequadrature.}\item{\code{useScale}:}{logical indicating if variance-covariancematrices include a scale factor. This is \code{FALSE} for theglmm families \code{binomial} and \code{poisson}, otherwise\code{TRUE}.}\item{\code{family}:}{a copy of the glm family.}\item{\code{call}:}{a copy of the call to the model-fittingfunction.}\item{\code{cnames}:}{a list of character vectors of column namesof the random-effects variance-covariance matrix associated witheach grouping factor and the fixed-effects model matrix.}\item{\code{nc}:}{integer vector giving the number of columns thevariance-covariance matrix associated with each grouping factor.}\item{\code{Gp}:}{integer vector of group pointers within the randomeffects and the rows of the transposed model matrix in the\code{Zt} slot. The elements of \code{Gp} are the 0-based indexof the first element corresponding to each grouping factor. Thusthe first element is always 0. The last element is the totallength of the random effects vector (also the total number of rowsin the matrix in the \code{Zt} slot).}\item{\code{XtX}:}{The crossproduct matrix of the model matrix inthe \code{X} slot, stored as a\code{"\linkS4class{dpoMatrix}"} object.}\item{\code{ZtZ}:}{The crossproduct matrix of the model matrix forthe random effects, stored as a \code{"\linkS4class{dpoMatrix}"} object.representation of the original \eqn{Z'Z} matrix.}\item{\code{ZtX}:}{The original \eqn{Z'X} matrix, stored as a\code{"\linkS4class{dgeMatrix}"} object.}\item{\code{Zty}:}{The numeric vector \eqn{Z'y}.}\item{\code{Xty}:}{The numeric vector \eqn{X'y}.}\item{\code{Omega}:}{A list of positive-definite matrices stored as\code{"\linkS4class{dpoMatrix}"} objects that are therelative precision matrices of the random effects associated witheach of the grouping factors.}\item{\code{L}:}{The sparse, supernodal lower Cholesky factor of\eqn{Z'Z+\Omega}, stored as a\code{"\linkS4class{dCHMsuper}"} object.}\item{\code{RZX}:}{A rectangular matrix, stored as a\code{"\linkS4class{dgeMatrix}"} object, which is the RZXcomponent of the Cholesky factor of \eqn{Z'Z+\Omega} at thecurrent values of the parameters.}\item{\code{RXX}:}{An upper triangular matrix, stored as a\code{"\linkS4class{dtrMatrix}"} object, which is the RXXcomponent of the Cholesky factor of \eqn{Z'Z+\Omega} at thecurrent values of the parameters.}\item{\code{rZy}:}{A numeric vector - the rZycomponent of the Cholesky factor of \eqn{Z'Z+\Omega} at thecurrent values of the parameters.}\item{\code{rXy}:}{A numeric vector - the rXycomponent of the Cholesky factor of \eqn{Z'Z+\Omega} at thecurrent values of the parameters.}\item{\code{devComp}:}{Numeric vector of components from which thedeviance can be calculated. The named components are: \code{"n"},the number of observations (length of the \code{"y"} slot),\code{"p"}, the length of the fixed-effects vector (number ofcolumns of the matrix in the \code{"X"} slot), \code{"yty"}, thesum of squares of the \code{y},\code{"logryy2"}, the logarithm ofthe penalized residual sum of squares, \code{"logDetL2"}, thelogarithm of the square of the determinant of \code{L},\code{"logDetOmega"}, the logarithm of the determinant of\code{Omega}, and \code{"logDetRXX"}, the logarithm of thedeterminant of the triangular matrix in the \code{"RXX"} slot.This slot's contents are current if \code{status$factored} is \code{TRUE}.}\item{\code{deviance}:}{Numeric vector of length 2 containing thedeviance corresponding to the maximum likelihood (ML) and REMLcriteria. This slot's contents are current if\code{status$factored} is \code{TRUE}.}\item{\code{fixef}:}{Numeric vector containing the conditional estimatesof the fixed effects. This slot's contents are current if\code{status$secondary} is \code{TRUE}.}\item{\code{ranef}:}{Numeric vector containing the conditional modesof the random effects. This slot's contents are current if\code{status$secondary} is \code{TRUE}.}\item{\code{RZXinv}:}{A rectangular matrix, stored as a\code{"\linkS4class{dgeMatrix}"} object, which is the RZXcomponent of the inverse of the Cholesky factor of\eqn{Z'Z+\Omega} at the current values of the parameters. Thisslot's contents are current if \code{status$gradComp} is\code{TRUE}.}\item{\code{bVar}:}{A list of the diagonal inner blocks (uppertriangles only) of the positive-definite matrices on the diagonalof the inverse of \code{ZtZ+Omega}. With the appropriate scalefactor (and conversion to a symmetric matrix) these are theconditional variance-covariance matrices of the random effects.}\item{\code{gradComp}:}{A list of three-dimensional arrays each with fourfaces. See the code for the documentation of these components.}\item{\code{status}:}{Logical vector of length 4 indicating if theobject has been factored, if the secondary slots have beenevaluated, if the gradient components have been evaluated and ifthe Hessian components have been evaluated.}\item{\code{call}:}{A copy of the matched call to the function thatcreated the object.}\item{\code{useScale}:}{logical indicator of the use of the scalefactor when calculating variance-covariance objects. Only presentin the \code{summary.lmer} class.}\item{\code{frame}:}{the model frame for the model or an empty dataframe}\item{\code{terms}:}{the terms attribute of the model frame for thefixed-effects terms only}\item{\code{weights}:}{prior weights on the responses. Only presentin the \code{glmer} class.}\item{\code{showCorrelation}:}{Logical indicator of whether todisplay the correlation of the fixed-effects estimates whenshowing the object. Only present in the \code{summary.lmer} class.}}The \code{"summary.mer"} and \code{"summary.lmer"} classes \emph{contain}the \code{"mer"} and \code{"lmer"} classes respectively and haveadditional slots,\describe{\item{\code{isG}:}{logical indicating if we have a\bold{g}eneralized linear mixed effects model.}\item{\code{methTitle}:}{character string specifying a method title}\item{\code{logLik}:}{the same as \code{\link{logLik}(object)}.}\item{\code{ngrps}:}{...}% FIXME\item{\code{sigma}:}{the scale ...}% FIXME\item{\code{coefs}:}{the coefficients matrix...}% FIXME\item{\code{vcov}:}{the same as \code{\link{vcov}(object)}.}\item{\code{REmat}:}{the formatted Random-Effects matrix}\item{\code{AICtab}:}{...}% FIXME}% summary slots}\usage{\S4method{logLik}{mer}(object, REML = object@method == "REML", \dots)\S4method{vcov}{mer}(object, REML = object@method == "REML",useScale = object@useScale, \dots)}\arguments{\item{object}{object of class \code{mer} or \code{lmer}.}\item{REML}{logical indicating if REML should be used.}\item{useScale}{logical indicating if a scale should be computed andused; otherwise \code{sc <- 1} is used.}\item{\dots}{potential further arguments passed to methods.}}\section{Methods}{% TODO:% "show": object = "lmer" (inherited from object = "mer")% "with": data = "lmer"\describe{\item{anova}{\code{signature(object = "mer")}: model comparisons for\code{mer} objects, see \code{\link{anova}}.}%% FIXME: say a bit more on lmer - model comparison ??\item{coef}{\code{signature(object = "lmer")}: Extract theparameters that determine the Omega matrices. The optionallogical argument \code{unconstr} determines the constrained orunconstrained parameterization.}\item{coef<-}{\code{signature(object = "lmer", value = "numeric")}: Assign theparameters that determine the Omega matrices. The optionallogical argument \code{unconstr} determines the constrained orunconstrained parameterization. }\item{coerce}{\code{signature(from = "lmer", to = "dtTMatrix")}:Ensure that the \code{lmer} object has been factored but notinverted and extract the unit lower triangular matrix \eqn{L}from the \eqn{LDL} decomposition of\eqn{Z^\prime Z+\Omega}{crossprod(Z)+Omega}.}\item{coerce}{\code{signature(from = "lmer", to = "dsTMatrix")}:Ensure that the \code{lmer} object has been factored but notinverted and extract the symmetric matrix\eqn{Z^\prime Z+\Omega}{crossprod(Z)+Omega}.}\item{deviance}{\code{signature(object = "mer")}: extracts the\code{\link{deviance}} of the fitted model.}%%% some of the following are also in \usage{..} because they have extra args:\item{logLik}{\code{signature(object = "mer")}: Extract thelog-likelihood from of the fitted model, see also \code{\link{logLik}}.}\item{update}{\code{signature(object = "mer")}: see\code{\link{update}} on how to update fitted models.}\item{simulate}{\code{signature(object = "mer")}: see\code{\link{simulate}} on how to simulate from fitted models.}\item{solve}{\code{signature(a = "lmer", b = "missing")}: Invertthe decomposed matrices.}\item{terms}{\code{signature(x = "lmer")}: Extract\code{\link{terms}} component.}\item{vcov}{\code{signature(object = "mer")}: Calculatevariance-covariance matrix of the \emph{fixed} effect terms,see also \code{\link{vcov}}.}}}\seealso{\code{\link{lmer}()} produces these objects.\cr\code{\link{VarCorr}} for extracting the variance andcorrelation components of the \emph{random}-effects terms.}\examples{data(sleepstudy)(fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject),data = sleepstudy))logLik(fm2)(V2 <- vcov(fm2))}\keyword{classes}