Bootstrap Intervals
Confidence intervals by resampling — for the median and other statistics with no formula.
from your 20 values
spread of the statistic across resamples
resample mean minus the observed value
| Method | 95% interval | Width | What it does |
|---|---|---|---|
| Percentile | [9.925, 10.375] | 0.45 | The plain quantiles of the resampled statistics. Simple, and the usual first answer. |
| Basic | [9.975, 10.425] | 0.45 | The percentile interval reflected about the observed value, correcting for bias. |
| BCa | [9.9, 10.35] | 0.45 | Bias-corrected and accelerated. The most accurate of the three, and the one to quote when the bootstrap distribution is skewed. |
The 5,000 resampled values
9.7141skewness -0.30810.5859
The resampled distribution is close to symmetric, so the three methods largely agree. They separate when it is skewed. Results are reproducible: the same data, statistic and seed always give the same interval.
The bootstrap builds a confidence interval by resampling your own data with replacement, thousands of times, and watching how much the statistic moves. It needs no formula and no distributional assumption, which is why it works for the median, the IQR and anything else without a standard error.
Using the sample as a stand-in for the population
A confidence interval asks how much a statistic would vary across repeated samples from the population. You only have one sample, and no access to the population — so the bootstrap does the obvious audacious thing and treats the sample as the population. Draw from it with replacement, the same number of values, and compute the statistic. Do that a few thousand times and the spread of those values estimates the spread you would have seen across real repeated sampling.
Drawing with replacement is the whole trick. Without it every resample would be the original data in a different order, and the statistic would never move. With it, some values appear twice and others not at all, which is exactly the kind of variation a fresh sample would have shown.
Why this matters for the median
The mean has a standard error you can write down: s ÷ √n. The median does not, in any form usable by hand — its sampling distribution depends on the population density at the median, which you do not know. The bootstrap sidesteps the problem entirely by never needing a formula, and the same applies to the interquartile range, a trimmed mean, a ratio of two statistics, or anything else you can compute.
B of 1,000 works; 10,000 makes the interval endpoints steadier
- 1 Draw a resample the same size as your data. With replacement, so a value can appear more than once or not at all.
- 2 Compute the statistic on it. Whatever you are estimating — the median, the standard deviation, anything.
- 3 Repeat a few thousand times. The collected values form the bootstrap distribution shown on this page.
- 4 Read the interval off its quantiles. The 2.5th and 97.5th percentiles give a 95% percentile interval.
- 5 Prefer BCa when the distribution is skewed. It corrects for bias and for the statistic’s variance changing with its own value, which is when the three methods separate.
How often each interval really covers, normal data
Share of nominal 95% intervals containing the true mean, from 1,200 simulated samples at each size with 1,200 resamples each.
| n | Percentile | Basic | BCa | t interval |
|---|---|---|---|---|
| 10 | 90.8% | 90.3% | 90.6% | 94.5% |
| 20 | 94.8% | 95.3% | 94.5% | 96.6% |
| 50 | 94.1% | 93.7% | 94.3% | 94.9% |
What the bootstrap cannot rescue
That table is the honest caveat. The bootstrap is an asymptotic method: its guarantees arrive as the sample grows, and at n = 10 all three intervals cover about 91% of the time while claiming 95%, where the ordinary t interval manages 94.5%. If your data is roughly normal and you want a mean, the textbook formula is simply better at small n. The bootstrap earns its place when there is no formula, or when the data is too skewed for one to apply.
It also cannot fix a sample that is not representative. Resampling reproduces whatever is in your data, biases included — if the sampling was skewed, every resample inherits the same skew and the interval will be confidently wrong. The same applies to a sample too small to contain the tail behaviour that matters: the bootstrap cannot invent values it never saw, which is why intervals for extreme quantiles are unreliable at small n.
One practical note: because the method is random, two runs give slightly different endpoints. This page seeds its generator, so the same data, statistic and seed always produce the same interval — a number you can quote. Changing the seed shows how much of the last digit is noise, which is a useful check before reporting one.