model.matrix.logitr {logitr} | R Documentation |
Construct Design Matrices
Description
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.
Usage
## S3 method for class 'logitr'
model.matrix(object, ...)
Arguments
object |
an object of an appropriate class. For the default method,
a model |
... |
further arguments. |
Value
A design matrix
Examples
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)
[Package logitr version 1.1.2 Index]