Inference✓ Mathematical
◆ The PatternHow sure are you? — bootstrap and parametric CIs, and interpreting their width
A confidence interval gives a range of plausible values for an unknown parameter. A 95% CI means: if we repeated this experiment many times, 95% of the intervals computed this way would contain the true value. Width = uncertainty.
CI = x̄ ± z · (σ / √n)
Parametric CI for means. z = 1.96 for 95%. Width shrinks with √n.
Bootstrap CI: [θ*2.5%, θ*97.5%]
Bootstrap CI = percentiles of the resampled distribution. No normality assumption needed.
// Interactive — sample size vs CI width
Sample size50
Confidence95%
Width—
# Python — confidence intervals import numpy as np from scipy.stats import sem, t # Parametric (t-distribution for small samples) n = len(data) ci = t.interval(0.95, df=n-1, loc=np.mean(data), scale=sem(data)) # Bootstrap boots = [np.mean(np.random.choice(data, size=n, replace=True)) for _ in range(10000)] ci_boot = np.percentile(boots, [2.5, 97.5])
Pattern bridge: CIs quantify uncertainty. In ML, report metric ± CI from cross-validation. In markets, Monte Carlo confidence bands are CIs for portfolio outcomes.