Calculates the likelihood of a Multiple Discrete Continuous Nested Extreme Value (MDCNEV) model with an outside good.
apollo_mdcnev(mdcnev_settings, functionality)
List of settings for the MDCEV model. It must include the following.
V
: Named list. Utilities of the alternatives. Names of elements must match those in argument 'alternatives'.
alternatives
: Character vector. Names of alternatives, elements must match the names in list 'V'.
alpha
: Named list. Alpha parameters for each alternative, including for the outside good. As many elements as alternatives.
gamma
: Named list. Gamma parameters for each alternative, including for the outside good. As many elements as alternatives.
mdcnevNests
: Named list. Lambda parameters for each nest. Elements must be named with the nest name. The lambda at the root is fixed to 1, and therefore must be no be defined. The value of the estimated mdcnevNests parameters should be between 0 and 1 to ensure consistency with random utility maximization.
mdcnevStructure
: Numeric matrix. One row per nest and one column per alternative. Each element of the matrix is 1 if an alternative belongs to the corresponding nest.
cost
: Named list of numeric vectors. Price of each alternative. One element per alternative, each one as long as the number of observations or a scalar. Names must match those in alternatives
.
avail
: Named list. Availabilities of alternatives, one element per alternative. Names of elements must match those in argument 'alternatives'. Value for each element can be 1 (scalar if always available) or a vector with values 0 or 1 for each observation. If all alternatives are always available, then user can just omit this argument.
continuousChoice
: Named list of numeric vectors. Amount of consumption of each alternative. One element per alternative, as long as the number of observations or a scalar. Names must match those in alternatives
.
budget
: Numeric vector. Budget for each observation.
minConsumption
: Named list of scalars or numeric vectors. Minimum consumption of the alternatives, if consumed. As many elements as alternatives. Names must match those in alternatives
.
outside
: Character. Alternative name for the outside good. Default is "outside"
rows
: Boolean vector. Consideration of rows in the likelihood calculation, FALSE to exclude. Length equal to the number of observations (nObs). Default is "all"
, equivalent to rep(TRUE, nObs)
.
componentName
: Character. Name given to model component.
Character. Can take different values depending on desired output.
"estimate" Used for model estimation.
"prediction" Used for model predictions.
"validate" Used for validating input.
"zero_LL" Used for calculating null likelihood.
"shares_LL" Used for calculating likelihood with constants only.
"conditionals" Used for calculating conditionals.
"output" Used for preparing output after model estimation.
"raw" Used for debugging.
The returned object depends on the value of argument functionality
as follows.
"estimate"
: vector/matrix/array. Returns the probabilities for the observed consumption for each observation.
"prediction"
: A matrix with one row per observation, and columns indicating means and s.d. of continuous and discrete predicted consumptions.
"validate"
: Same as "estimate"
, but it also runs a set of tests to validate the function inputs.
"zero_LL"
: Not implemented. Returns a vector of NA with as many elements as observations.
"shares_LL"
: Not implemented. Returns a vector of NA with as many elements as observations.
"conditionals"
: Same as "estimate"
"output"
: Same as "estimate"
but also writes summary of input data to internal Apollo log.
"raw"
: Same as "estimate"