lme4 (version 1.1-11)

mkReTrms: Make Random Effect Terms: Create Z, Lambda, Lind, etc.

Description

From the result of findbars applied to a model formula and the evaluation frame fr, create the model matrix Zt, etc, associated with the random-effects terms.

Usage

mkReTrms(bars, fr, drop.unused.levels=TRUE)

Arguments

bars
a list of parsed random-effects terms
fr
a model frame in which to evaluate these terms
drop.unused.levels
(logical) drop unused factor levels? (experimental)

Value

  • a list with components
  • Zttranspose of the sparse model matrix for the random effects
  • thetainitial values of the covariance parameters
  • Lindan integer vector of indices determining the mapping of the elements of the theta vector to the "x" slot of Lambdat
  • Gp
  • lowerlower bounds on the covariance parameters
  • Lambdattranspose of the sparse relative covariance factor
  • flistlist of grouping factors used in the random-effects terms
  • cnmsa list of column names of the random effects according to the grouping factors
  • Ztlistlist of components of the transpose of the random-effects model matrix, separated by random-effects term

See Also

Other utilities: findbars, mkRespMod, nlformula, nobars, subbars. getME can retrieve these components from a fitted model, although their values and/or forms may be slightly different in the final fitted model from their original values as returned from mkReTrms.

Examples

Run this code
data("Pixel", package="nlme")
mform <- pixel ~ day + I(day^2) + (day | Dog) + (1 | Side/Dog)
(bar.f <- findbars(mform)) # list with 3 terms
mf <- model.frame(subbars(mform),data=Pixel)
rt <- mkReTrms(bar.f,mf)
names(rt)

Run the code above in your browser using DataCamp Workspace