apollo_prediction function

Predicts using an estimated model

Predicts using an estimated model

Calculates apollo_probabilities with functionality="prediction".

apollo_prediction( model, apollo_probabilities, apollo_inputs, prediction_settings = list(), modelComponent = NA )

Arguments

  • model: Model object. Estimated model object as returned by function apollo_estimate .

  • apollo_probabilities: 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"’ .
  • apollo_inputs: List grouping most common inputs. Created by function apollo_validateInputs .

  • prediction_settings: List. Contains settings for this function. User input is required for all settings except those with a default or marked as optional.

    • ‘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.
    • ‘silent’ : Boolean. If TRUE, this function won't print any output to screen.
    • ‘summary’ : Boolean. If TRUE, a summary of the prediction is printed to screen. TRUE by default.
  • modelComponent: Deprecated . Same as modelComponent inside prediction_settings.

Returns

A list containing predictions for component modelComponent of the model described in apollo_probabilities. The particular shape of the prediction will depend on the model component.

Details

Structure of predictions are simplified before returning, e.g. list of vectors are turned into a matrix.

  • Maintainer: Stephane Hess
  • License: GPL-2
  • Last published: 2025-03-12