Extracts from a model object fixed and random effects design matrices.
# S3 method for egf
model.matrix(object, which = c("fixed", "random"),
top = NULL, random = NULL, ...)
A (sparse) dgCMatrix or a traditional
(dense) matrix, with attributes assign
and contrasts
except in special cases; see ‘Details’.
an egf
object.
a character string controlling what is returned:
"fixed"
the fixed effects design matrix X
corresponding to top
.
"random"
the random effects design matrix Z
corresponding to top
and random
.
a character string specifying a top level nonlinear model parameter.
NULL
indicates “all of them”; see ‘Details’.
a random effect term, which is a call to binary operator |
.
NULL
indicates “all of them”; see ‘Details’.
unused optional arguments.
model.matrix(which = "fixed", top = NULL)
returns the result of combining (in the sense of cbind
)
all fixed effects design matrices.
model.matrix(which = "random", top = "<name>", random = NULL)
returns the result of combining all random effects design matrices
associated with parameter top
.
model.matrix(which = "random", top = NULL, random = NULL)
returns the result of combining all random effects design matrices
and permuting the columns to obtain a convenient ordering of
random effect coefficients.
(Coefficients are sorted by relation to a common random vector.
Random vectors are sorted by relation to a common covariance matrix.)
None of these “combined” design matrices possesses attributes
assign
and contrasts
.
The generic function model.matrix
.