Learn R Programming

apollo (version 0.1.0)

apollo_prepareProb: Checks likelihood

Description

Checks that likelihoods, i.e. probabilities in the case of choice models, are in the appropiate format to be returned.

Usage

apollo_prepareProb(P, apollo_inputs, functionality)

Arguments

P

List of vectors, matrices or 3-dim arrays. Likelihood of the model components.

apollo_inputs

List grouping most common inputs. Created by function apollo_validateInputs.

functionality

Character. Can take different values depending on desired output of apollo_probabilities.

"estimate"

For model estimation, returns probabilities of chosen alternatives.

"prediction"

For model predictions, returns probabilities of all alternatives.

"validate"

Validates input.

"zero_LL"

Return probabilities with all parameters at zero.

"conditionals"

For conditionals, returns probabilities of chosen alternatives.

"output"

Checks that the model is well defined.

"raw"

For debugging, returns probabilities of all alternatives

Value

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

  • "estimate": Returns only the "model" component of argument P.

  • "prediction": Returns argument P without any changes.

  • "validate": Returns argument P without any changes.

  • "zero_LL": Returns argument P without any changes to its content, but gives names the unnamed elements.

  • "conditionals": Returns only the "model" component of argument P.

  • "output": Returns argument P without any changes to its content, but gives names the unnamed elements.

  • "raw": Returns argument P without any changes.

Details

This function should be called inside apollo_probabilities, near the end of it, just before return(P). This function only performs checks on the shape of P, but does not change its values in any way.