Learn R Programming

apollo (version 0.2.6)

apollo_validateInputs: Prepares input for apollo_estimate

Description

Searches the user work space (.GlobalEnv) for all necessary input to run apollo_estimate, and packs it in a single list.

Usage

apollo_validateInputs(
  apollo_beta = NA,
  apollo_fixed = NA,
  database = NA,
  apollo_control = NA,
  apollo_HB = NA,
  apollo_draws = NA,
  apollo_randCoeff = NA,
  apollo_lcPars = NA,
  recycle = FALSE,
  silent = FALSE
)

Arguments

apollo_beta

Named numeric vector. Names and values for parameters.

apollo_fixed

Character vector. Names (as defined in apollo_beta) of parameters whose value should not change during estimation.

database

data.frame. Data used by model.

apollo_control

List. Options controlling the running of the code.

  • modelName: Character. Name of the model. Used when saving the output to files.

  • modelDescr: Character. Description of the model. Used in output files.

  • indivID: Character. Name of column in the database with each decision maker's ID.

  • mixing: Boolean. TRUE for models that include random parameters.

  • nCores: Numeric>0. Number of cores to use in calculations of the model likelihood.

  • seed: Numeric. Seed for random number generation.

  • HB: Boolean. TRUE if using RSGHB for Bayesian estimation of model.

  • noValidation: Boolean. TRUE if user does not wish model input to be validated before estimation - FALSE by default.

  • noDiagnostics: Boolean. TRUE if user does not wish model diagnostics to be printed - FALSE by default.

  • outputDirectory: Character. Optional directory for outputs if different from working director - empty by default

  • weights: Character. Name of column in database containing weights for estimation.

  • workInLogs: Boolean. TRUE for increased numeric precision in models with panel data - FALSE by default.

  • panelData: Boolean. TRUE if there are multiple obsrvations (i.e. rows) for each decision maker - Automatically set based on indivID by default.

  • calculateLLC: Boolean. TRUE if user wants to calculate LL at constants (if applicable). - TRUE by default.

apollo_HB

List. Contains options for bayesian estimation. See ?RSGHB::doHB for details. Parameters modelname, gVarNamesFixed, gVarNamesNormal, gDIST, svN and FC are automatically set based on the other arguments of this function. Other settings to include are the following.

  • hbDist Mandatory setting. A named character vector determining the distribution of each parameter to be estimated. Possible values are as follows.

    • "DNE": Parameter kept at its starting value (not estimated).

    • "F": Fixed (as in non-random) parameter.

    • "N": Normal.

    • "LN+": Positive log-normal.

    • "LN-": Negative log-normal.

    • "CN+": Positive censored normal.

    • "CN-": Negative censored normal.

    • "JSB": Johnson SB.

  • constraintNorm Character vector. Constraints for random coefficients in bayesian estimation. Constraints can be written as "b1>b2", "b1<b2", "b1>0", or "b1<0".

  • fixedA Named numeric vector. Contains the names and fixed mean values of random parameters. For example, c(b1=0) fixes the mean of b1 to zero.

  • fixedD Named numeric vector. Contains the names and fixed variance of random parameters. For example, c(b1=1) fixes the variance of b1 to zero.

apollo_draws

List of arguments describing the inter and intra individual draws. Required only if apollo_control$mixing = TRUE. Unused elements can be ommited.

  • interDrawsType: Character. Type of inter-individual draws ('halton','mlhs','pmc','sobol','sobolOwen', 'sobolFaureTezuka', 'sobolOwenFaureTezuka' or the name of an object loaded in memory, see manual in www.ApolloChoiceModelling.com for details).

  • interNDraws: Numeric scalar (>=0). Number of inter-individual draws per individual. Should be set to 0 if not using them.

  • interUnifDraws: Character vector. Names of uniform-distributed inter-individual draws.

  • interNormDraws: Character vector. Names of normaly distributed inter-individual draws.

  • intraDrawsType: Character. Type of intra-individual draws ('halton','mlhs','pmc','sobol','sobolOwen','sobolFaureTezuka', 'sobolOwenFaureTezuka' or the name of an object loaded in memory).

  • intraNDraws: Numeric scalar (>=0). Number of intra-individual draws per individual. Should be set to 0 if not using them.

  • intraUnifDraws: Character vector. Names of uniform-distributed intra-individual draws.

  • intraNormDraws: Character vector. Names of normaly distributed intra-individual draws.

apollo_randCoeff

Function. Used with mixing models. Constructs the random parameters of a mixing model. Receives two arguments:

  • apollo_beta: Named numeric vector. Names and values of model parameters.

  • apollo_inputs: The output of this function (apollo_validateInputs).

apollo_lcPars

Function. Used with latent class models. Constructs a list of parameters for each latent class. Receives two arguments:

  • apollo_beta: Named numeric vector. Names and values of model parameters.

  • apollo_inputs: The output of this function (apollo_validateInputs).

recycle

Logical. If TRUE, an older version of apollo_inputs is looked for in the calling environment (parent frame), and any element in that old version created by the user is copied into the new apollo_inputs returned by this function. For recycle=TRUE to work, the old version of apollo_inputs must be named "apollo_inputs". If FALSE, nothing is copied from any older version of apollo_inputs. FALSE is the default.

silent

Logical. TRUE to keep the function from printing to the console. Default is FALSE.

Value

List grouping several required input for model estimation.

Details

All arguments to this function are optional. If the function is called without arguments, then it it will look in the user workspace (i.e. the global environment) for variables with the same name as its ommited arguments. We strongly recommend users to visit www.ApolloChoiceModelling.com for examples on how to use Apollo. In the website, users will also find a detailed manual and a user-group for help and further reference.