Constructing the bootstrapped confidence interval
We have looked at how to construct the bootstrapped confidence interval using the standard error method. This involves adding and subtracting the scaled standard error from the observed sample statistic. It turns out that there is another, simpler method, which just uses the percentile of the bootstrap distribution to obtain the confidence interval.
Let us continue with the previous example. Say we would like to calculate the 95% confidence interval of the previous bootstrap distribution. We can achieve this by calculating the upper and lower quantiles (97.5% and 2.5%, respectively) of the bootstrap distribution. The following code achieves this:
>>> bs %>% summarize( l = quantile(stat, 0.025), u = quantile(stat, 0.975) ) # A tibble: 1 × 2 l u <dbl> <dbl...