recodeData | R Documentation |
X
and updated pars
and
randPars
to include any dummy-coded categorical or interaction
variables.Recodes the data and returns a list of the encoded design matrix (X
) as
well as two vectors (pars
and randPars
) with discrete (categorical)
variables and interaction variables added to X
, pars
, and
randPars
.
recodeData(data, pars, randPars)
data |
The data, formatted as a |
pars |
The names of the parameters to be estimated in the model.
Must be the same as the column names in the |
randPars |
A named vector whose names are the random parameters and
values the distribution: |
A list of the design matrix (X
) and two vectors (pars
and
randPars
) with discrete (categorical) variables and interaction variables
added.
library(logitr)
data(yogurt)
# Recode the yogurt data
result <- recodeData(
data = yogurt,
pars = c("price", "feat", "brand", "price*brand"),
randPars = c(feat = "n", brand = "n")
)
result$formula
result$pars
result$randPars
head(result$X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.