apollo_searchStart: Searches for better starting values.

View source: R/apollo_searchStart.R

apollo_searchStartR Documentation

Searches for better starting values.

Description

Given a set of starting values and a range for them, searches for points with a better likelihood and steeper gradients.

Usage

apollo_searchStart(
  apollo_beta,
  apollo_fixed,
  apollo_probabilities,
  apollo_inputs,
  searchStart_settings = NA
)

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.

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.

searchStart_settings

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

  • apolloBetaMax: Vector. Maximum possible value of parameters when generating candidates. Ignored if smartStart is TRUE. Default is apollo_beta + 0.1.

  • apolloBetaMin: Vector. Minimum possible value of parameters when generating candidates. Ignored if smartStart is TRUE. Default is apollo_beta - 0.1.

  • bfgsIter: Numeric scalar. Number od BFGS iterations to perform at each stage to each remaining candidate. Default is 20.

  • dTest: Numeric scalar. Tolerance for test 1. A candidate is discarded if its distance in parameter space to a better one is smaller than dTest. Default is 1.

  • gTest: Numeric scalar. Tolerance for test 2. A candidate is discarded if the norm of its gradient is smaller than gTest AND its LL is further than llTest from a better candidate. Default is 10^(-3).

  • llTest: Numeric scalar. Tolerance for test 2. A candidate is discarded if the norm of its gradient is smaller than gTest AND its LL is further than llTest from a better candidate. Default is 3.

  • maxStages: Numeric scalar. Maximum number of search stages. The algorithm will stop when there is only one candidate left, or if it reaches this number of stages. Default is 5.

  • nCandidates: Numeric scalar. Number of candidate sets of parameters to be used at the start. Should be an integer bigger than 1. Default is 100.

  • smartStart: Boolean. If TRUE, candidates are randomly generated with more chances in the directions the Hessian indicates improvement of the LL function. Default is FALSE.

Details

This function implements a simplified version of the algorithm proposed by Bierlaire, M., Themans, M. & Zufferey, N. (2010), A Heuristic for Nonlinear Global Optimization, INFORMS Journal on Computing, 22(1), pp.59-70. The main difference lies in it implementing only two out of three tests on the candidates described by the authors. The implemented algorithm has the following steps.

  1. Randomly draw nCandidates candidates from an interval given by the user.

  2. Label all candidates with a valid log-likelihood (LL) as active.

  3. Apply bfgsIter iterations of the BFGS algorithm to each active candidate.

  4. Apply the following tests to each active candidate:

    1. Has the BGFS search converged?

    2. Are the candidate parameters after BFGS closer than dTest from any other candidate with higher LL?

    3. Is the LL of the candidate after BFGS further than distLL from a candidate with better LL, and its gradient smaller than gTest?

  5. Mark any candidates for which at least one test results in yes as inactive.

  6. Go back to step 3, unless only one candidate is active, or the maximum number of iterations (maxStages) has been reached.

This function will write a CSV file to the working/output directory summarising progress. This file is called modelName_searchStart.csv .

Value

named vector of model parameters. These are the best values found.


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