Learn R Programming

varComp (version 0.2-0)

model.matrix.varComp: Extracting model matrices

Description

This function extracts the fixed-effect design matrix, random-effect design matrix, or the list of variance-covariance matrices whose weighted sum being the variance-covariance matrix of the response variable.

Usage

# S3 method for varComp
model.matrix(object, what = c("fixed", "random", "varcov", "X", "K", "Z"), ...)

Arguments

object

A varComp object

what

A character vector (only the first element will be used) specifying what kind of design matrix is requested. See details.

Not used.

Value

If what="fixed" or "X", a single numeric matrix of fixed-effect design matrix.

Otherwise, a list of requested matrices.

Details

"fixed" and "X" are equivalent, requesting the fixed effect design matrix.

"random" and "Z" are equivalent, requesting the random effect design matrix. Note that this is an equivalent version of the design matrices such that the tcrossprod will be the contribution to the marginal variance-covariance. This is not necessarily the one computed directly from the random argument passed to varComp. These are actually computed from cholRoot of \(\mathbf{K}\) matrices.

"varcov" and "K" are equivalent, requesting the contribution of each random effect to the marginal correlation matrix. These are not necessarily the same value passed to the varcov argument of varComp, because the input value will be treated as the "\(G\)" matrices when random is not missing, but the result here will always be "\(\mathbf{K}\)" matrices. See varComp for notations.

See Also

varComp

Examples

Run this code
# NOT RUN {
library(nlme)
data(Oxide)
vcf = varComp(Thickness~Source, Oxide, ~Lot/Wafer)
model.matrix(vcf, 'fixed')
model.matrix(vcf, 'random')
model.matrix(vcf, 'varcov')

# }

Run the code above in your browser using DataLab