ML0105 Bootstrap & Resampling Inference

What is the bootstrap, how do you construct a percentile confidence interval from resamples, and why does it not need parametric assumptions? For example, how would you put a 95% interval on the median order value from a sample of Amazon purchases without assuming the order values follow any particular distribution?

Line-art scene: on the left a dashed box labeled unknown population F with a dashed skewed density curve and a large question mark; an arrow labeled draw once leads to a dot plot of 40 right-skewed order values with the sample median marked and a long right tail; an arrow leads to a yellow box asking for a 95 percent interval for the median and noting there is no textbook standard-error formula for a median without knowing F

The Problem: One right-skewed sample of 40 order values gives one sample median, and the population shape is unknown. No textbook standard-error formula for a median avoids that unknown shape, and drawing a second sample is not an option.

Answer

The bootstrap estimates the sampling distribution of a statistic by treating the observed sample as a stand-in for the population and redrawing from it. You draw n points with replacement from your n observations, recompute the statistic (a median, a ratio of means, an AUC), and repeat this B times, typically 1,000 to 10,000. The spread of the B replicates approximates how much the statistic would vary across fresh samples from the real population. The percentile interval then reads a 95% confidence interval directly off the 2.5th and 97.5th percentiles of those replicates. No parametric assumption is needed because the empirical distribution of the data replaces the unknown population, so there is no normality assumption and no closed-form standard error to derive. The method is nonparametric but not assumption-free, since it still requires independent resampling units, a sample large enough to represent the population, and a reasonably smooth statistic.

(1) Plug-In Principle: The unknown population F is replaced by the empirical distribution \hat{F}_n, which puts mass 1/n on each observation. Resampling shows how the statistic would vary if \hat{F}_n were the population, and that approximates how it varies under F.
(2) Same Size, With Replacement: Each resample has exactly n draws, so some points repeat and only about 1 - 1/e \approx 63.2\% of the originals appear. Drawing without replacement would return the original sample every time and show zero variability.
(3) Percentile Interval: Sort the B replicates and take the \alpha/2 and 1-\alpha/2 quantiles. With B = 2000 at 95% confidence these are the 50th and 1950th sorted values.
(4) No Formula Required: The same loop gives intervals for medians, ratios of means, trimmed means, correlations, and model metrics such as AUC, where an analytic standard error is messy or unknown.
(5) Assumptions That Remain: Resampled units must be i.i.d., n must be large enough for \hat{F}_n to resemble F, and the statistic must be smooth. Percentile intervals are only first-order accurate, which is what BCa and studentized intervals improve.

Mathematical Formulation:
\hat{\theta} = s(x_1, \ldots, x_n)
\hat{F}_n(t) = \frac{1}{n}\sum_{i=1}^{n}\mathbf{1}\{x_i \leq t\}
x_1^{*b}, \ldots, x_n^{*b} \overset{\text{iid}}{\sim} \hat{F}_n
\hat{\theta}^{*b} = s(x_1^{*b}, \ldots, x_n^{*b})
\mathrm{CI}_{\mathrm{pct}} = \big[\hat{\theta}^{*}_{(\alpha/2)},\ \hat{\theta}^{*}_{(1-\alpha/2)}\big]
\widehat{\mathrm{se}}_{B} = \sqrt{\frac{1}{B-1}\sum_{b=1}^{B}\big(\hat{\theta}^{*b} - \bar{\theta}^{*}\big)^2}

Where:

  • \hat{\theta} is the statistic computed on the observed data by the function s(\cdot), and x_1, \ldots, x_n are the n observed i.i.d. units.
  • \hat{F}_n is the empirical CDF, putting mass 1/n on each observation, and \mathbf{1}\{\cdot\} is the indicator function; sampling from \hat{F}_n is the same as drawing indices uniformly with replacement.
  • b \in \{1, \ldots, B\} indexes the resamples, x_i^{*b} is the i-th draw of resample b, and \hat{\theta}^{*b} is the bootstrap replicate of the statistic.
  • \hat{\theta}^{*}_{(q)} is the q-quantile of the B replicates and 1-\alpha is the confidence level, so \alpha = 0.05 uses the 2.5th and 97.5th percentiles.
  • \widehat{\mathrm{se}}_{B} is the bootstrap standard error and \bar{\theta}^{*} is the mean of the replicates; \bar{\theta}^{*} - \hat{\theta} is the bootstrap estimate of bias.

Worked Example:
Take the five observations {2, 3, 5, 8, 40}, whose sample median is 5. A resample’s median is its third-smallest value, so it is at most the k-th order statistic x_{(k)} exactly when at least three of the five draws land at or below x_{(k)}. That is a binomial event with success probability k/5, for example P(\hat{\theta}^{*} = 2) = P(\mathrm{Bin}(5, 0.2) \geq 3) = 0.058. Working through k = 1, \ldots, 5 gives the exact bootstrap distribution of the median: 2 with probability 0.058, 3 with 0.260, 5 with 0.365, 8 with 0.260, and 40 with 0.058. Monte Carlo resampling converges to exactly this distribution as B grows. Because 5.8% of the mass already sits on each extreme, the 2.5th percentile is 2 and the 97.5th is 40, so the 95% percentile interval is the entire data range. The bootstrap is being honest: five points cannot pin down a median, and no resampling scheme can manufacture information the sample does not contain.


Login to view more content
Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *