apollo_modifyUserDefFunc: Checks and modifies Apollo user-defined functions

View source: R/apollo_modifyUserDefFunc.R

apollo_modifyUserDefFuncR Documentation

Checks and modifies Apollo user-defined functions

Description

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

Usage

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.

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.

Value

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


apollo documentation built on Oct. 2, 2024, 1:08 a.m.