The choice_formula object defines the choice model equation.
Arguments
- formula
[
formula]
A symbolic description of the choice model, see details.- error_term
[
character(1)]
Defines the model's error term. Current options are:"probit"(default): errors are multivariate normally distributed"logit": errors follow a type-I extreme value distribution
- random_effects
[
character()]
Defines the random effects in the model. The expected format of elements inrandom_effectsis"<covariate>" = "<distribution>", where"<covariate>"is the name of a variable on theformularight-hand side. Every random effect must reference an explicit covariate (or"ASC"for alternative-specific constants) that appears in the supplied model formula.Current options for
"<distribution>"are:"cn": correlated (with other"cn"random effects) normal distribution
To have random effects for the ASCs, use
"ASC"for"<covariate>".- x
[
choice_formula]
Achoice_formulaobject.- ...
Currently not used.
Value
An object of class choice_formula, which is a list of the elements:
formulaThe model formula.
error_termThe name of the model's error term specification.
choiceThe name of the response variable.
covariate_typesThe (up to) three different types of covariates.
ASCDoes the model have ASCs?
random_effectsThe names of covariates with random effects.
Specifying the model formula
The structure of formula is choice ~ A | B | C, i.e., a standard
formula object but with three parts on the right-hand
side, separated by |, where
choiceis the name of the discrete response variable,Aare names of alternative-specific covariates with a coefficient that is constant across alternatives,Bare names of covariates that are constant across alternatives,and
Care names of alternative-specific covariates with alternative-specific coefficients.
The following rules apply:
By default, intercepts (referred to as alternative-specific constants, ASCs) are added to the model. They can be removed by adding
+ 0in the second part, e.g.,choice ~ A | B + 0 | C. To not include any covariates of the second type but to estimate ASCs, add1in the second part, e.g.,choice ~ A | 1 | C. The expressionchoice ~ A | 0 | Cis interpreted as no covariates of the second type and no ASCs.To not include covariates of any type, add
0in the respective part, e.g.,choice ~ 0 | B | C.Some parts of the formula can be omitted when there is no ambiguity. For example,
choice ~ Ais equivalent tochoice ~ A | 1 | 0.Multiple covariates in one part are separated by a
+sign, e.g.,choice ~ A1 + A2.Arithmetic transformations of covariates in all three parts of the right-hand side are possible via the function
I(), e.g.,choice ~ I(A1^2 + A2 * 2). In this case, a random effect can be defined for the transformed covariate, e.g.,random_effects = c("I(A1^2 + A2 * 2)" = "cn").
