Calculates the probabilities of an ordered logit model and can also perform other operations based on the value of the functionality
argument.
apollo_ol(ol_settings, functionality)
List of settings for the OL model. It should include the following.
Numeric vector. Dependant variable. The coding of this variable is assumed to be from 1 to the maximum number of different levels. For example, if the ordered response has three possible values: "never", "sometimes" and "always", then it is assumed that outcomeOrdered contains "1" for "never", "2" for "sometimes", and 3 for "always". If another coding is used, then it should be specified using the coding
argument.
Numeric vector. A single explanatory variable (usually a latent variable). Must have the same number of rows as outcomeOrdered.
Numeric vector. Thresholds. As many as number of different levels in the dependent variable - 1. Extreme thresholds are fixed at -inf and +inf. No mixing allowed in thresholds.
Numeric or character vector. Optional argument. Defines the order of the levels in outcomeOrdered
. The first value is associated with the lowest level of V
, and the last one with the highest value. If not provided, is assumed to be 1:(length(tau) + 1)
.
Boolean vector. TRUE if a row must be considered in the calculations, FALSE if it must be excluded. It must have length equal to the length of argument outcomeOrdered
. Default value is "all"
, meaning all rows are considered in the calculation.
Character. Can take different values depending on desired output.
Used for model estimation.
Used for model predictions.
Used for validating input.
Used for calculating null likelihood.
Used for calculating conditionals.
Used for preparing output after model estimation.
Used for debugging.
The returned object depends on the value of argument functionality
as follows.
vector/matrix/array. Returns the probabilities for the chosen alternative for each observation.
List. Returns a list with the probabilities for each possible outcome.
Boolean. Returns TRUE if all tests are passed.
vector/matrix/array. Returns the probability of the chosen alternative when all parameters are zero.
Same as "prediction".
Same as "estimate" but also writes summary of choices into temporary file (later read by apollo_modelOutput
).
Same as "prediction".
This function estimates an ordered logit model of the type:
y* = V + epsilon
outcomeOrdered = 1 if -Inf < y* < tau[1]
2 if tau[1] < y* < tau[2]
...
maxLvl if tau[length(tau)] < y* < +Inf
Where epsilon is distributed standard logistic, and the values 1, 2, ..., maxLvl can be
replaces by coding[1], coding[2], ..., coding[maxLvl].
The behaviour of the function changes depending on the value of the functionality
argument.