The bootstrap: resampling your own data

The question
Make an estimate, then let the sample stand in for its population.
- 1 SeeEstimate uncertainty from one sample.
- 2 TryChoose a resampling rule.
- 3 ProveBuild the proof, line by line.
- 4 ApplyCompute errors and interval endpoints.
Before you start · 3 quick checks on averages, variance and empirical probabilities
Two ideas before you start
2 ideasA sample becomes a small population
A bar at each distinct observation shows the fraction of sample entries with that value.
Pick a sample entry at random. Repeated values get more probability because they occupy more entries.
Exact definition
For observed real numbers \(x_1,\ldots,x_n\), the empirical distribution puts probability \(1/n\) on each indexed entry. A value appearing \(k\) times has total probability \(k/n\). Its CDF counts the fraction of entries at or below a cutoff, as in empirical quantiles.
A statistic summarizes a whole sample
Observations lie on a number line. A dashed mark locates their mean.
The mean is one number computed from all the observations. A different sample can give a different mean.
Exact definition
A statistic is a function of the observed sample. Here it is the arithmetic mean, \(\bar{x}=n^{-1}\sum_i x_i\). Uppercase \(\bar{X}\) denotes this statistic before the random sample has been observed; lowercase \(\bar{x}\) denotes its realized value.
Refresher: sampling distributions and standard error
Repeat the entire data collection under the same conditions. Compute the statistic once per sample. The probability distribution of those statistics is its sampling distribution. Its standard deviation is the standard error, abbreviated SE. This is the spread of a statistic across samples, not the spread of observations within a sample.
We assume observations are independent draws from one unchanged population distribution. Independent means that learning one draw does not change the probabilities for another. If each draw has finite variance, the variance of their sum is the sum of their variances. This follows because the cross products of centered independent draws have expectation zero. No normal distribution is assumed. See expectation and variance for the underlying definitions.
Estimate how much the mean moves
- Read the observations, in minutes. Enter your estimate of the mean’s standard error.
- Commit the estimate, then add batches of resamples.
- Reveal the teaching population to compare against fresh samples.
These are simulated processing times, collected as independent draws from a fixed population. You initially see only one sample. The population stays hidden until you request the comparison. An estimate from so little data need not be close to the truth.
A bootstrap resample draws as many entries as the original sample contains, independently and with replacement. After each selection the entry is available again. Compute the resample mean, record it, and repeat. Each repeated entry retains its own chance of being selected.
| Distribution of means | Replicates | Simulated SD | Exact SD |
|---|
The bootstrap distribution is conditional on the observed data: the sample is fixed while the resampling varies. The fresh-sample distribution varies the original data collection instead. Centering the two histograms separately lets you compare their widths without confusing a shift in center with a difference in spread.
For the mean, an exact conditional width is available, so the table can check the simulation. For more complicated statistics, such as a fitted model’s error, resampling can estimate a spread even when a convenient formula is unavailable. The resampling scheme must still match how the data were collected.
Choose how to resample
- Predict the result of changing the sampling rule.
- Then build resamples by selecting entries yourself.
Use what you found: build a resample
When the usual resampling rule is a poor model
Resampling single observations independently discards any dependence in the original data. Consecutive measurements can move together; observations within one household can share an influence. Such data need a resampling method that preserves the relevant groups or time structure.
Resampling also cannot invent a tail event absent from the sample. A small sample may underrepresent rare, large values. If all observed entries happen to be equal, the bootstrap mean has no variation even though the population may vary. Increasing the number of resamples cannot fix that missing information. A finite sample does not by itself establish that the population variance is finite.
Find the conditional variance
Fix \(n\ge2\) finite real observations that are not all equal. Write \(\bar{x}=n^{-1}\sum_i x_i\) and \(v=n^{-1}\sum_i(x_i-\bar{x})^2\), so \(v\gt0\). Let \(I_1,\ldots,I_n\) be independent uniform indices from the observed entries, and set \(X_j^*=x_{I_j}\). A star means probability is computed with the observed data held fixed.
\[\begin{aligned} E_*(\bar{X}^*)&=\bar{x},\\ \operatorname{Var}_*(\bar{X}^*)&=v/n.\end{aligned}\]Here \(\bar{X}^*=n^{-1}\sum_j X_j^*\). The proof uses linearity of expectation, variance scaling by the square of a constant, and addition of variances for independent variables. The sampling-distribution refresher explains the last rule.
Choose the next true equation at each step. The observations may include negative numbers, repeated values and a mean of zero. The nonconstant assumption keeps the alternative variance formulas distinct.
If the sample variance uses the conventional divisor \(n-1\), write \(s^2=\sum_i(x_i-\bar{x})^2/(n-1)\). Then
\[\operatorname{SE}_*(\bar{X}^*)=\frac{\sqrt{n-1}}{n}s.\]This differs from the usual estimate \(s/\sqrt n\). The empirical distribution has variance \(v\), with divisor \(n\). Keeping those divisors straight explains the difference; it is not simulation error. For constant observations the same identities give zero, although that case was excluded from the choice exercise.
For independent original draws from a population of finite variance \(\sigma^2\), the true standard error is \(\sigma/\sqrt n\). Replacing \(\sigma^2\) by the empirical variance is the bootstrap step. The theorem proves that step’s conditional calculation, not that its estimate is accurate for every sample.
Compute and interpret
Enter decimals without units. Each problem states its tolerance and offers hints and a worked solution. The first tasks use the exact conditional formulas; the last interprets a percentile interval.
Refresher: a bootstrap percentile interval
Sort the bootstrap statistics. For a nominal central interval, use the lower and upper empirical quantiles as endpoints. This page uses the inverse empirical CDF convention: at level \(p\), take rank \(\lceil Bp\rceil\) among \(B\) sorted replicates, without interpolation.
That construction describes the bootstrap distribution, conditional on this sample. A nominal confidence level is a target for repeated-sample coverage of a fixed population parameter. It is not a probability that the fixed parameter moves in or out of the realized interval. Actual coverage can differ, especially for small or biased samples, nonsmooth statistics and extreme quantiles. No interval coverage theorem is proved here.
Continue with sampling distributions. The normal distribution gives another language for location and spread, but the bootstrap histograms here do not assume normality.
Further reading
- B. Efron and R. J. Tibshirani, An Introduction to the Bootstrap, chapter 6, “The Bootstrap Estimate of Standard Error.”