Applications: Bayesian Inference, Information & Simulation

the bootstrap

You computed some statistic from your data — a median, a correlation, a ratio — and now you need its uncertainty: a standard error or a confidence interval. For a simple average there is a formula, but for a complicated statistic the formula may not exist. The bootstrap is a strikingly simple computational trick that gets the uncertainty anyway, by treating your one dataset as a stand-in for the whole population and resampling from it.

The procedure is almost suspiciously easy. From your original sample of n data points, draw a NEW sample of n points by sampling WITH replacement (so some original points appear twice or more, others not at all). Compute your statistic on this resample. Repeat the whole thing many times — say a thousand resamples — to get a thousand recomputed values of the statistic. The spread of those bootstrap values estimates the sampling variability of your statistic: their standard deviation is the bootstrap standard error, and the middle 95 percent of them (the 2.5th to 97.5th percentiles) form a bootstrap confidence interval. The logic is that the empirical distribution of your data is the best available guess of the true distribution, so resampling from your data mimics drawing fresh datasets from the population.

The bootstrap is beloved because it asks almost nothing: no formula, no assumption of normality, no derivation — just resample and recompute, which is why it works for medians, trimmed means, correlation coefficients, and quantities with no tractable theory. The honest caveats are essential. It cannot conjure information that is not in your sample, so with a tiny n it is unreliable. It can fail badly for statistics that depend on extremes (like the maximum) or for heavy-tailed data where the sample poorly represents the tails, and it assumes your observations are independent — for time series or clustered data the naive bootstrap is wrong and you need specialized variants.

You have 50 reaction times and want a confidence interval for their median, which has no easy formula. Resample 50 times with replacement from your 50 values, take the median; do this 2000 times. The 2.5th and 97.5th percentiles of those 2000 medians give a 95 percent bootstrap interval for the true median — no distributional assumption required.

Resample your data with replacement and recompute; the spread estimates the statistic's uncertainty.

The bootstrap cannot manufacture information beyond your sample: it is unreliable for tiny n, breaks for statistics driven by extremes (like the maximum), and the naive version assumes independent observations.

Also called
bootstrap resampling資源抽樣拔靴法重抽樣法