apollo_modifyUserDefFunc function

Checks and modifies Apollo user-defined functions

Checks and modifies Apollo user-defined functions

Checks and enhances user defined functions apollo_probabilities, apollo_randCoeff and apollo_lcPars.

apollo_modifyUserDefFunc( apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs, validate = TRUE, noModification = FALSE )

Arguments

  • apollo_beta: Named numeric vector. Names and values for parameters.

  • apollo_fixed: Character vector. Names of parameters inside apollo_beta whose values should be kept constant throughout estimation.

  • 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 .

  • validate: Logical. If TRUE, the original and modified apollo_probabilities functions are estimated. If their results do not match, then the original functions are returned, and success is set to FALSE inside the returned list.

  • noModification: Logical. If TRUE, loop expansion etc are skipped.

Returns

List with four elements: apollo_probabilities, apollo_randCoeff, apollo_lcPars and a dummy called success (TRUE if modification was successful, FALSE if not. FALSE will be only be returnes if the modifications are validated).

Details

Internal use only. Called by apollo_estimate before estimation. Checks include: no re-definition of variables, no (direct) calls to database, calling of apollo_weighting if weights are defined.

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