Given a set of starting values and a range for them, searches for points with a better likelihood.
apollo_searchStart(
apollo_beta,
apollo_fixed,
apollo_probabilities,
apollo_inputs,
searchStart_settings = NA
)
Named numeric vector. Names and values for parameters.
Character vector. Names (as defined in apollo_beta
) of parameters whose value should not change during estimation.
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 "estimate" (default), "prediction", "validate", "conditionals", "zero_LL", "shares_LL", or "raw".
List grouping most common inputs. Created by function apollo_validateInputs.
List containing options for the search of starting values. The following are valid options.
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.
apolloBetaMin
: Vector. Minimum possible value of parameters when generating candidates. Ignored if smartStart is TRUE. Default is apollo_beta - 0.1
.
apolloBetaMax
: Vector. Maximum possible value of parameters when generating candidates. Ignored if smartStart is TRUE. Default is apollo_beta + 0.1
.
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.
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.
bfgsIter
: Numeric scalar. Number od BFGS iterations to perform at each stage to each remaining candidate. Default is 20.
named vector of model parameters. These are the best values found.
This function implements a simplified version of the algorithm proposed by Bierlaire, Themans, & Zufferey (2010). 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.
Randomly draw nCandidates
candidates from an interval given by the user.
Label all candidates with a valid log-likelihood (LL) as active.
Apply bfgsIter
iterations of the BFGS algorithm to each active candidate.
Apply the following tests to each active candidate:
Has the BGFS search converged?
Are the candidate parameters after BFGS closer than dTest
from any other candidate with higher LL?
Is the LL of the candidate after BFGS further than distLL
from a candidate with better LL, and its gradient smaller than gTest
?
Mark any candidates for which at least one test results in yes as inactive.
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 directory summarising progress. This file is called modelName
_searchStart.csv .