computeDesignMatrix | R Documentation |
If sampler
is provided instead of formula
, the design matrices
are based on the model used to create the sampler environment. In that case, if
data
is NULL
, the design matrices stored in sampler
are returned,
otherwise the design matrices are computed for the provided data based on the sampler's model.
The output is a list of dense or sparse design matrices for the model components
with respect to data
.
computeDesignMatrix(formula = NULL, data = NULL, labels = TRUE)
formula |
model formula. |
data |
data frame to be used in deriving the design matrices. |
labels |
if |
A list of design matrices.
n <- 1000
dat <- data.frame(
x = rnorm(n),
f = factor(sample(1:50, n, replace=TRUE))
)
str(computeDesignMatrix(~ x, dat)[[1]])
model <- ~ reg(~x, name="beta") + gen(~x, factor=~f, name="v")
X <- computeDesignMatrix(model, dat)
str(X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.