apollo_nl {apollo}  R Documentation 
Calculates Nested Logit probabilities
Description
Calculates the probabilities of a Nested Logit model and can also perform other operations based on the value of the functionality
argument.
Usage
apollo_nl(nl_settings, functionality)
Arguments
nl_settings 
List of inputs of the NL model. It should contain the following.

functionality 
Character. Setting instructing Apollo what processing to apply to the likelihood function. This is in general controlled by the functions that call

Details
In this implementation of the Nested Logit model, each nest must have a lambda parameter associated to it.
For the model to be consistent with utility maximisation, the estimated value of the Lambda parameter of all nests
should be between 0 and 1. Lambda parameters are inversely proportional to the correlation between the error terms of
alternatives in a nest. If lambda=1, then there is no relevant correlation between the unobserved
utility of alternatives in that nest.
The tree must contain an upper nest called "root"
. The lambda parameter of the root is automatically
set to 1 if not specified in nlNests
, but can be changed by the user if desired (though not advised).
Value
The returned object depends on the value of argument functionality
as follows.

"components"
: Same as"estimate"

"conditionals"
: Same as"estimate"

"estimate"
: vector/matrix/array. Returns the probabilities for the chosen alternative for each observation. 
"gradient"
: Not implemented. 
"output"
: Same as"estimate"
but also writes summary of input data to internal Apollo log. 
"prediction"
: List of vectors/matrices/arrays. Returns a list with the probabilities for all alternatives, with an extra element for the probability of the chosen alternative. 
"preprocess"
: Returns a list with preprocessed inputs, based onnl_settings
. 
"raw"
: Same as"prediction"

"report"
: List with tree structure and choice overview. 
"shares_LL"
: vector/matrix/array. Returns the probability of the chosen alternative when only constants are estimated. 
"validate"
: Same as"estimate"
, but it also runs a set of tests to validate the function inputs. 
"zero_LL"
: vector/matrix/array. Returns the probability of the chosen alternative when all parameters are zero.