do_bootstrap | R Documentation |
Estimate bunching on bootstrapped samples, using residual-based bootstrapping with replacement.
do_bootstrap( zstar, binwidth, firstpass_prep, residuals, n_boot = 100, correct = TRUE, correct_iter_max = 200, notch = FALSE, zD_bin = NA, seed = NA )
zstar |
a numeric value for the the bunching point. |
binwidth |
a numeric value for the width of each bin. |
firstpass_prep |
(binned) data that includes all variables necessary for fitting the model. |
residuals |
residuals from (first pass) fitted bunching model. |
n_boot |
number of bootstrapped iterations. Default is 100. |
correct |
implements correction for integration constraint. Default is TRUE. |
correct_iter_max |
maximum iterations for integration constraint correction. Default is 200. |
notch |
whether analysis is for a kink or notch. Default is FALSE (kink). |
zD_bin |
the bin marking the upper end of the dominated region (notch case). |
seed |
a numeric value for bootstrap seed (random re-sampling of residuals). Default is NA. |
do_bootstrap
returns a list with the following bootstrapped estimates:
b_vector |
A vector with the bootstrapped normalized excess mass estimates. |
b_sd |
The standard deviation of the bootstrapped b_vector. |
B_vector |
A vector with the bootstrapped excess mass estimates (not normalized). |
B_sd |
The standard deviation of the bootstrapped B_vector. |
marginal_buncher_vector |
A vector with the bootstrapped estimates of the location (z value) of the marginal buncher. |
marginal_buncher_sd |
The standard deviation of the bootstrapped marginal_buncher_vector. |
alpha_vector |
A vector with the bootstrapped estimates of the fraction of bunchers in the dominated region (only in notch case). |
alpha_vector_sd |
The standard deviation of the bootstrapped alpha_vector. |
bunchit
, prep_data_for_fit
data(bunching_data) binned_data <- bin_data(z_vector = bunching_data$kink, zstar = 10000, binwidth = 50, bins_l = 20, bins_r = 20) prepped_data <- prep_data_for_fit(binned_data, zstar = 10000, binwidth = 50, bins_l = 20, bins_r = 20, poly = 4) firstpass <- fit_bunching(prepped_data$data_binned, prepped_data$model_formula, binwidth = 50) residuals_for_boot <- fit_bunching(prepped_data$data_binned, prepped_data$model_formula, binwidth = 50)$residuals boot_results <- do_bootstrap(zstar = 10000, binwidth = 50, firstpass_prep = prepped_data, residuals = residuals_for_boot, seed = 1) boot_results$b_sd
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.