lme4 (version 1.1-11)

getME: Extract or Get Generalized Components from a Fitted Mixed Effects Model

Description

Extract (or get) components -- in a generalized sense -- from a fitted mixed-effects model, i.e., (in this version of the package) from an object of class "merMod".

Usage

getME(object, name, ...)

## S3 method for class 'merMod': getME(object, name = c("X", "Z", "Zt", "Ztlist", "mmList", "y", "mu", "u", "b", "Gp", "Tp", "L", "Lambda", "Lambdat", "Lind", "Tlist", "A", "RX", "RZX", "sigma", "flist", "fixef", "beta", "theta", "ST", "REML", "is_REML", "n_rtrms", "n_rfacs", "N", "n", "p", "q", "p_i", "l_i", "q_i", "k", "m_i", "m", "cnms", "devcomp", "offset", "lower", "devfun", "glmer.nb.theta"), ...)

Arguments

object
a fitted mixed-effects model of class "merMod", i.e., typically the result of lmer(), glmer() or
name
a character vector specifying the name(s) of the component. If length(name) > 1 or if name = "ALL", a named list of components will be returned. Possible va
...
currently unused in lme4, potentially further arguments in methods.

Value

  • Unspecified, as very much depending on the name.

Details

The goal is to provide everything a user may want from a fitted "merMod" object as far as it is not available by methods, such as fixef, ranef, vcov, etc.

See Also

getCall(). More standard methods for "merMod" objects, such as ranef, fixef, vcov, etc.: see methods(class="merMod")

Examples

Run this code
## shows many methods you should consider *before* using getME():
methods(class = "merMod")

(fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
Z <- getME(fm1, "Z")
stopifnot(is(Z, "CsparseMatrix"),
          c(180,36) == dim(Z),
	  all.equal(fixef(fm1), b1 <- getME(fm1, "beta"),
		    check.attributes=FALSE, tolerance = 0))

## A way to get *all* getME()s :
## internal consistency check ensuring that all work:
parts <- getME(fm1, "ALL")
str(parts, max=2)
stopifnot(identical(Z,  parts $ Z),
          identical(b1, parts $ beta))

Run the code above in your browser using DataCamp Workspace