Learn R Programming

nlme (version 3.1-149)

model.matrix.reStruct: reStruct Model Matrix

Description

The model matrices for each element of formula(object), calculated using data, are bound together column-wise. When multiple grouping levels are present (i.e. when length(object) > 1), the individual model matrices are combined from innermost (at the leftmost position) to outermost (at the rightmost position).

Usage

# S3 method for reStruct
model.matrix(object, data, contrast, …)

Arguments

object

an object inheriting from class "reStruct", representing a random effects structure and consisting of a list of pdMat objects.

data

a data frame in which to evaluate the variables defined in formula(object).

contrast

an optional named list specifying the contrasts to be used for representing the factor variables in data. The components names should match the names of the variables in data for which the contrasts are to be specified. The components of this list will be used as the contrasts attribute of the corresponding factor. If missing, the default contrast specification is used.

some methods for this generic require additional arguments. None are used in this method.

Value

a matrix obtained by binding together, column-wise, the model matrices for each element of formula(object).

See Also

model.matrix, contrasts, reStruct, formula.reStruct

Examples

Run this code
# NOT RUN {
rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel)
model.matrix(rs1, Pixel)
# }

Run the code above in your browser using DataLab