Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

apollo_el

Calculates Exploded Logit probabilities


Description

Calculates the probabilities of an Exploded Logit model and can also perform other operations based on the value of the functionality argument. The function calculates the probability of a ranking as a product of Multinomial Logit models with gradually reducing availability, where scale differences can be allowed for.

Usage

apollo_el(el_settings, functionality)

Arguments

el_settings

List of inputs of the Exploded Logit model. It shoud contain the following.

  • "alternatives": Named numeric vector. Names of alternatives and their corresponding value in choiceVar.

  • "avail": Named list of numeric vectors or scalars. Availabilities of alternatives, one element per alternative. Names of elements must match those in alternatives. Values can be 0 or 1.

  • "choiceVars": List of numeric vectors. Contain choices for each position of the ranking. The list must be ordered with the best choice first, second best second, etc. It will usually be a list of columns from the database. Use value -1 if a stage does not apply for a given observations (e.g. when some individuals have shorter rankings).

  • "V": Named list of deterministic utilities . Utilities of the alternatives. Names of elements must match those in alternatives.

  • "scales": List of vectors. Scale factors of each Logit model. At least one element should be normalized to 1. If omitted, scale=1 for all positions is assumed.

  • "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.

functionality

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.

  • "conditionals": Used for calculating conditionals.

  • "output": Used for preparing output after model estimation.

  • "raw": Used for debugging.

Value

The returned object depends on the value of argument functionality as follows.

  • "estimate": vector/matrix/array. Returns the probabilities for the chosen alternative for each observation.

  • "prediction": Not applicable (NA).

  • "validate": Same as "estimate"

  • "zero_LL": vector/matrix/array. Returns the probability of the chosen alternative when all parameters are zero.

  • "conditionals": Same as "estimate"

  • "output": Same as "estimate" but also writes summary of input data to internal Apollo log.

  • "raw": Same as "estimate"


apollo

Tools for Choice Model Estimation and Application

v0.2.4
GPL-2
Authors
Stephane Hess [aut], David Palma [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.