How to use the bootstrap confidence interval calculator
- Paste your data, at least 3 numbers, separated by commas, spaces or new lines.
- Choose the statistic (mean, median or standard deviation), the confidence level and the interval type: percentile, or BCa which corrects for bias and skew.
- Read the interval, the sample value, the bootstrap standard error and the bias.
- Open the advanced options to set the number of resamples and the seed. The same seed and data always give the same interval.
Formula
Draw n values with replacement from the data, B times, and compute the statistic for each draw
Percentile interval = the (1 - level) / 2 and 1 - (1 - level) / 2 percentiles of the B results
BCa: z0 = inverse normal of the share of results below the sample value
BCa: a = sum of (mean_jack - x_i) cubed / (6 (sum of (mean_jack - x_i) squared) to the power 1.5), from leaving out one value at a time
BCa adjusted level = normal CDF of z0 + (z0 + z) / (1 - a (z0 + z))
Percentiles use linear interpolation between sorted results. Draws that equal the sample value count half in z0, so rounding noise cannot change the answer.
Twelve measurements
The data are 4.2, 5.1, 3.8, 6.0, 5.5, 4.9, 7.3, 5.2, 4.4, 6.8, 5.0, 4.7. The sample mean is 5.2417. With 10,000 resamples and seed 12345, the 95 percent percentile interval for the mean is 4.7167 to 5.8417 and the bootstrap standard error is 0.2873.
The BCa interval for the mean is 4.7500 to 5.9083, shifted up a little because the data lean to the high side. For comparison, the usual t interval is 4.587 to 5.896. For the median the BCa interval is 4.55 to 5.75, and for the standard deviation (1.030) the percentile interval is 0.5096 to 1.3261.
What bootstrapping does
A bootstrap treats your sample as a small stand-in for the larger population. Drawing new samples from it, with replacement, shows how much a statistic would move from sample to sample. The spread of those results gives an interval without a formula, which helps for medians, standard deviations and other statistics that lack a simple one. For a mean with roughly bell-shaped data, the confidence interval calculator gives a close answer from a formula.
BCa stands for bias-corrected and accelerated. It adjusts the percentiles for two things: whether the resampled statistics sit off-center from the sample value, and whether their spread changes with the statistic itself. For small skewed samples it is usually closer to the true coverage than the plain percentile interval.
Limits and care
A bootstrap cannot add information that the sample does not contain. With fewer than about 10 values, or for extreme statistics such as the minimum or maximum, the interval can be too narrow. Values that are not independent, such as repeated readings from one source, break the method. Use the standard error calculator and the descriptive statistics calculator to look at the data first.
More resamples make the interval ends steadier but do not change the underlying uncertainty of the sample. 10,000 is plenty for most uses.
Assumptions and limits
- The values are independent draws from the same population.
- The sample is large enough to represent that population: at least 3 values are required and about 20 or more is better.
- Resampling uses a seeded generator, so a result is reproducible but changes with another seed or number of resamples.
- Standard deviation uses n - 1 in the divisor, matching most software.
Frequently asked questions
Why does the interval change when I change the seed?
Each seed draws a different set of resamples. The ends move by a small amount, which is why the page shows the seed. Using more resamples makes the differences between seeds smaller.
Percentile or BCa: which should I use?
Percentile is simple and fine for symmetric data. BCa adjusts for bias and skew and is usually the better choice for small or lopsided samples, as long as the sample has at least a handful of distinct values.
Why can a bootstrap interval for the median look uneven?
The median of a resample can only be one of the original values or the midpoint of two, so the results come in steps. The ends of the interval therefore sit on those values.
Is a bootstrap interval a guarantee about the true value?
No. A 95 percent interval means the method would cover the true value about 95 percent of the time over many samples, under its assumptions. One interval from one sample either covers it or does not.