mkReTrms | R Documentation |
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.
mkReTrms(bars, fr, drop.unused.levels=TRUE,
reorder.terms=TRUE,
reorder.vars=FALSE)
mkNewReTrms(object, newdata, re.form=NULL,
na.action=na.pass,
allow.new.levels=FALSE,
sparse = max(lengths(orig.random.levs)) > 100)
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? |
reorder.terms |
arrange random effects terms in decreasing order of number of groups (factor levels)? |
reorder.vars |
arrange columns of individual random effects terms in alphabetical order? |
object |
a fitted |
newdata |
data frame for which to create new RE terms object |
re.form |
(formula, |
na.action |
function determining what should be done
with missing values for fixed effects in |
allow.new.levels |
(logical) if new levels (or NA values) in
|
sparse |
generate sparse contrast matrices? |
a list
with components
Zt |
transpose of the sparse model matrix for the random effects |
theta |
initial values of the covariance parameters |
Lind |
an integer vector of indices determining the mapping of
the elements of the |
Gp |
a vector indexing the association of
elements of the conditional mode vector
with random-effect terms; if |
lower |
lower bounds on the covariance parameters |
Lambdat |
transpose of the sparse relative covariance factor |
flist |
list of grouping factors used in the random-effects terms |
cnms |
a list of column names of the random effects according to the grouping factors |
Ztlist |
list of components of the transpose of the random-effects model matrix, separated by random-effects term |
nl |
names of the terms (in the same order as |
mkNewReTrms
is used in the context of prediction, to
generate a new "random effects terms" object from an already fitted
model
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
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.