πŸŽ‰ 75% of content is free forever β€” Unlock Premium from $10/mo β†’
CW
Search courses…
πŸ’Ό Servicesℹ️ Aboutβœ‰οΈ ContactView Pricing Plansfrom $10

Bootstrapping

StatisticsResampling🟒 Free Lesson

Advertisement

Bootstrapping


Overview

The bootstrap principle treats the empirical distribution as an approximation of the true population distribution . By resampling from (with replacement), we approximate the sampling distribution of any statistic. The algorithm: (1) resample data with replacement times (typically 10,000), (2) compute the statistic on each resample, (3) take percentiles of the bootstrap distribution as the confidence interval. The percentile method is simple and intuitive. The BCa (bias-corrected and accelerated) method improves accuracy by adjusting for bias and skewness. Permutation tests complement bootstrapping by building exact null distributions for hypothesis testing.


Key Concepts

Bootstrap CI Methods

MethodDescriptionBest WhenAccuracy
PercentileDirect quantiles of bootstrap distributionStatistic is symmetricGood
BCaBias-corrected and acceleratedStatistic is biased or skewedBetter
Basic (Pivotal)Symmetric distributionsGood
StudentizedUses bootstrap estimate of SEMost accurateBest (expensive)

Quick Example

When to Use Bootstrap vs. Parametric Methods

ScenarioRecommended Approach
Normal data, known ΟƒZ-interval (parametric)
Normal data, unknown Οƒt-interval (parametric)
Skewed data, Bootstrap CI
Any statistic (median, ratio)Bootstrap CI
Small sample ()BCa bootstrap or double bootstrap
Hypothesis test, any distributionPermutation test
Model comparisonPaired bootstrap or permutation

Python Implementation Tips

import numpy as np

def bootstrap_ci(data, stat_fn=np.mean, n_boot=10000, ci=0.95):
    """Bootstrap confidence interval for any statistic."""
    n = len(data)
    boot_stats = np.array([
        stat_fn(np.random.choice(data, n, replace=True))
        for _ in range(n_boot)
    ])
    lower = np.percentile(boot_stats, (1 - ci) / 2 * 100)
    upper = np.percentile(boot_stats, (1 + ci) / 2 * 100)
    return lower, upper, boot_stats

Key points: (1) Always set a random seed for reproducibility. (2) Use np.random.choice(data, n, replace=True) for with-replacement resampling. (3) At least resamples for stable bounds.


Key Takeaways


Deep Dive

For detailed explanations, worked examples, and Python implementations, explore the dedicated statistics lessons:

Bootstrap Methods

  • Bootstrap Methods β€” Complete theory, algorithms, when each method is appropriate, and Python implementation

Bootstrap Confidence Intervals

Related Topics

Need Expert Mathematics Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement