Quiz 2
Registry Synced

Bootstrap Methods

203 words
1 min read

Reading compass

Now · 2.1 Intuition: The Plug-in Principle

Bootstrap Methods

2.1 Intuition: The Plug-in Principle

The bootstrap treats the sample as if it were the population. By resampling with replacement, we approximate the sampling distribution of a statistic.
🔑 Key Insight: The bootstrap works because the empirical distribution function converges to the true distribution.
python
import numpy as np
# original sample
data = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
n = len(data)
# bootstrap estimate of mean's standard error
B = 1000
boot_means = np.zeros(B)
for i in range(B):
    sample = np.random.choice(data, size=n, replace=True)
    boot_means[i] = np.mean(sample)
se = np.std(boot_means)
ci = np.percentile(boot_means, [2.5, 97.5])
print(f"SE: {se:.3f}, 95% CI: {ci}")

2.2 Bootstrap Confidence Intervals

MethodDescription
Percentile[θ^(α/2),θ^(1α/2)][\hat{\theta}_{(\alpha/2)}, \hat{\theta}_{(1-\alpha/2)}]
BCaBias-corrected and accelerated — adjusts for skewness
Bootstrap-tUses bootstrap estimate of standard error with tt -table

2.3 Bootstrap for Regression

python
# Bootstrap for regression coefficients
from sklearn.linear_model import LinearRegression
X = np.random.randn(100, 2)
y = X[:, 0] * 2 + X[:, 1] * 3 + np.random.randn(100)
B = 500
coefs = np.zeros((B, 2))
for i in range(B):
    idx = np.random.choice(100, 100, replace=True)
    model = LinearRegression().fit(X[idx], y[idx])
    coefs[i] = model.coef_
# Standard errors from bootstrap
se_boot = np.std(coefs, axis=0)
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.