model.matrix.logitr | R Documentation |
Creates a design (or model) matrix, e.g., by expanding factors to a set of dummy variables (depending on the contrasts) and expanding interactions similarly.
## S3 method for class 'logitr'
model.matrix(object, ...)
object |
an object of an appropriate class. For the default method,
a model |
... |
further arguments. |
A design matrix
library(logitr)
# Estimate a preference space model
mnl_pref <- logitr(
data = yogurt,
outcome = "choice",
obsID = "obsID",
pars = c("price", "feat", "brand")
)
# Get the model.matrix design matrix
model.matrix(mnl_pref)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.