All Labs

Bootstrap & Confidence Interval Lab

Explore the bootstrap resampling method for constructing confidence intervals. Draw thousands of bootstrap samples, visualize the sampling distribution, compare percentile, normal, and BCa interval methods, and verify coverage through simulation.

Guided Experiment: Understanding Confidence Level Through Coverage

If you construct 95% bootstrap confidence intervals from many different random samples, what fraction do you predict will contain the true population mean?

Write your hypothesis in the Lab Report panel, then click Next.

Original Sample Summary

n
20
Mean
24.44
Median
24.60
SD
2.61
Min
19.80
Max
28.70

Controls

Bootstrap Resamples (B)1,000
True Population Mean (μ)25
Coverage Simulations50

Data Table

(0 rows)
#TrialConfidence LevelLower BoundUpper BoundWidthContains μ?
0 / 500
0 / 500
0 / 500

Reference Guide

Bootstrap Resampling

A bootstrap sample is drawn by randomly selecting n observations with replacement from the original dataset. Each bootstrap sample has the same size as the original.

X1,X2,,XnF^nX^*_1, X^*_2, \ldots, X^*_n \sim \hat{F}_n

The bootstrap statistic (mean, median, etc.) is computed for each resample. Repeating B times builds the bootstrap distribution of the statistic.

Percentile Method CI

The percentile method takes the quantiles of the bootstrap distribution directly as the confidence interval bounds.

CI=[θ(α/2),  θ(1α/2)]\mathrm{CI} = \left[\theta^*_{(\alpha/2)},\; \theta^*_{(1-\alpha/2)}\right]

For a 95% CI, the 2.5th and 97.5th percentiles of the B bootstrap statistics form the interval. This method is simple and makes no distributional assumptions.

Coverage Probability

Coverage probability is the long-run proportion of confidence intervals that contain the true parameter value.

Coverage=#{CIiμ}Nsim\mathrm{Coverage} = \frac{\#\{\mathrm{CI}_i \ni \mu\}}{N_{\text{sim}}}

A well-calibrated 95% CI should contain the true parameter in about 95 out of 100 repeated experiments. The coverage simulation lets you verify this empirically.

Bootstrap vs Traditional CI

Traditional CIs rely on known sampling distributions (e.g., t-distribution for means). Bootstrap CIs estimate the sampling distribution empirically.

θ^±z×SEboot\hat{\theta} \pm z^* \times \mathrm{SE}_{\text{boot}}

The normal bootstrap CI uses the bootstrap SE in a Wald-type interval. The BCa method adds bias and skewness corrections for better accuracy with asymmetric distributions or small samples.