apollo_bootstrap {apollo}  R Documentation 
Samples individuals with replacement from the database, and estimates the model for each sample.
apollo_bootstrap(
apollo_beta,
apollo_fixed,
apollo_probabilities,
apollo_inputs,
estimate_settings = list(estimationRoutine = "bfgs", maxIterations = 200, writeIter =
FALSE, hessianRoutine = "none", printLevel = 2L, silent = FALSE, maxLik_settings =
list()),
bootstrap_settings = list(nRep = 30, samples = NA, calledByEstimate = FALSE, recycle =
TRUE)
)
apollo_beta 
Named numeric vector. Names and values for parameters. 
apollo_fixed 
Character vector. Names (as defined in 
apollo_probabilities 
Function. Returns probabilities of the model to be estimated. Must receive three arguments:

apollo_inputs 
List grouping most common inputs. Created by function apollo_validateInputs. 
estimate_settings 
List. Options controlling the estimation process. See apollo_estimate.

bootstrap_settings 
List containing settings for the sampling procedure. User input is required for all settings except those with a default or marked as optional.

This function implements a basic block bootstrap. It estimates the model parameters on nRep
different samples.
Each new sample is constructed by sampling with replacement from the original full sample. Each new sample has as many
individuals as the original sample, though some of them may be repeated. Sampling is done at the individual level,
therefore if different individuals have different number of observations, each resample does not necessarily have the same number of observations.
If the sampling should be done at the individual level (not recommended for panel data), then the optional
bootstrap_settings$samples
argument should be provided.
For each sample, only the parameters and loglikelihood are estimated. Standard errors are not calculated (they may be added in future versions). The composition of the resamples is stored in a file, but is stable with the same seed.
This function writes three different files to the working or output directory:
modelName_bootstrap_params.csv
: estimated parameters, final loglikelihood, and number of observations for each resample
modelName_bootstrap_samples.csv
: composition of each resample.
modelName_bootstrap_vcov.csv
: variancecovariance matrix of the estimated parameters across resamples.
The first two files are updated throughout the run of this function, while the last one is only written once the function finishes.
When run, this function will look for the first two files above in the working/output directory. If they are found, the function will attempt to pick up resampling from where those files left off. This is useful in cases where the original bootstrapping was interrupted, or when additional resampling runs are to be performed.
List with three elements.
estimates
: Matrix containing the parameter estimates for each repetition. As many rows as repetitions and as many columns as parameters.
LL
: Vector of final loglikelihoods of each repetition.
varcov
: Covariance matrix of the estimated parameters across the repetitions.
This function also writes three output files to the working/output directory, with the following names ('x' represents the model name):
x_bootstrap_params.csv: Table containing the parameter estimates, loglikelihood, and number of observations for each repetition.
x_bootstrap_samples.csv: Table containing the description of the sample used in each repetition. Same format than bootstrap_settings$samples
.
x_bootstrap_vcov: Table containing the covariance matrix of estimated parameters across the repetitions.