Calculates apollo_probabilities with functionality="prediction".
apollo_prediction(
model,
apollo_probabilities,
apollo_inputs,
prediction_settings = list(),
modelComponent = NA
)Predictions from the model. If runs=1, the function returns a data frame for a single component, or a named list of data frames for multiple components. If runs>1, each component is returned as a list with at_estimates, containing predictions at the estimated parameter values, and draws, an array of predictions obtained using draws from the asymptotic distribution of the estimates. If no predictions are available, the function returns NULL.
Model object. Estimated model object as returned by function apollo_estimate. A user can also simply provide a vector of parameter values instead of a whole model object, allowing for prediction to take place without having estimated a model.
Function. Returns probabilities of the model to be estimated. Must receive three arguments:
apollo_beta: Named numeric vector. Names and values of model parameters.
apollo_inputs: List containing options of the model. See apollo_validateInputs.
functionality: Character. Can be either "components", "conditionals", "estimate" (default), "gradient", "output", "prediction", "preprocess", "raw", "report", "shares_LL", "validate" or "zero_LL".
List grouping most common inputs. Created by function apollo_validateInputs.
List. Contains settings for this function. User input is required for all settings except those with a default or marked as optional.
includeChosen: Boolean. If TRUE, the predicted choice for each observation is included in the output. Default is FALSE.
modelComponent: Character. Name of component of apollo_probabilities output to calculate predictions for. Default is to predict for all components.
nRep: Scalar integer. Only used for models that require simulation for prediction (e.g. MDCEV). Number of draws used to calculate prediction. Default is 100.
runs: Numeric. Number of runs to use for computing confidence intervals of predictions. Default is 1, meaning no confidence intervals are calculated.
silent: Boolean. If TRUE, this function will not print output to screen. Default is FALSE, unless apollo_inputs$silent=TRUE.
simChoice: Boolean. If TRUE, simulated choices are added to the output. FALSE by default.
summary: Boolean. If TRUE, a summary of the prediction is printed to screen. TRUE by default.
Deprecated. Same as modelComponent inside prediction_settings.
Structure of predictions are simplified before returning, e.g. list of vectors are turned into a matrix.