The bootstrap makes two approximations (Section 8.2): the unknown F is replaced by the empirical F̂n, and the variance under F̂n is computed by simulation with B replications. Only the second error depends on B, and it shrinks like 1/√B. Here K independent bootstrap runs on the same data show how fast the running standard error (panel a) and the percentile-interval endpoints (panel b) settle on the ideal values that B = ∞ would give.
Run k uses its own seeded generator (seed + 7919 k); resample b picks indices ⌊u n⌋ (pairs are resampled together). The running se uses divisor B (equation 8.1). The dashed band is the approximate ±2 Monte Carlo standard deviations se∞(1 ± 2√((κ − 1)/(4B))), with κ the kurtosis of all the replications drawn. The gold lines are the ideal values: exact for the median (whose bootstrap distribution has a closed form) and for the se of the mean, otherwise from 200 000 replications. Estimates are recorded at B = 10, …, 20 and then at about 30 values per decade.
code/ch08_bootstrap.py (bootstrap, boot_median_exact, mc_rel_sd, breps_demo; Figure 8.S1).