Skip to content
simstat.com Statistics by simulation

Bootstrap confidence interval

Paste a list of numbers and choose a statistic. The tool resamples your data thousands of times and reports both a percentile and a BCa (bias-corrected and accelerated) confidence interval. Everything runs in your browser.

Separate values with commas, spaces or new lines. The example is the treatment group from Efron and Tibshirani's mouse survival data (days).

Leave the seed blank for a new random run. Enter the seed shown with a result to repeat that run exactly.

Result

Histogram of bootstrap replicates (run the tool to draw it)
Bars: bootstrap replicates. Shaded band: percentile interval. Orange dashed lines: BCa interval. Dark line: the statistic in your sample.

What this tool does

The bootstrap treats your sample as a stand-in for the population. It draws a new sample of the same size from your data with replacement and computes the statistic on it. Repeating that thousands of times gives the bootstrap distribution, an estimate of how much the statistic varies from sample to sample. Its standard deviation is the bootstrap standard error.

The formulas

For B replicates θ̂*, the percentile interval at level 1 − α takes their α/2 and 1 − α/2 quantiles:

[θ^(α/2)*,θ^(1−α/2)*]

BCa uses the same replicates but moves those two percentiles to α₁ and α₂:

α1=Φ(z^0+z^0+zα/21−a^(z^0+zα/2))

α₂ is the same with z1−α/2. The bias correction ẑ₀ = Φ⁻¹(share of replicates below θ̂). The acceleration â = Σd³ / (6(Σd²)3/2), where d is each jackknife value's distance from their mean (Efron and Tibshirani, 1993, ch. 14). Quantiles are interpolated as in R's boot package. Because the acceleration follows Efron and Tibshirani's eq. 14.15, BCa results for the median and SD can differ slightly from R's boot.ci defaults.

When the two intervals differ

If the bootstrap distribution is centred on your estimate and roughly symmetric, ẑ₀ and â are near zero and the two intervals almost coincide. They part company when the statistic is biased or its spread changes with its value, as with standard deviations and skewed data. BCa then shifts the interval, and it is usually the more accurate of the two. With fewer than about 15 values, both tend to be too narrow; the median of a small sample gives a lumpy distribution.