Unit 6 of 10 · about 4 hours · implement, measure

Paired bootstrap, permutation tests and multiplicity

Two models sharing a test set produce correlated scores. Unpaired uncertainty is wider than honest, and unadjusted selection is optimistic.

You'll be able to

  • Report a paired bootstrap interval for a model difference with the resampling unit matched to the comparison.
  • Run a paired permutation test with the correct permutation type and state its null in words.
  • Report an effect size beside every p-value and adjust for multiplicity with the search history on record.

Covers

Paired bootstrap intervals, permutation tests and effect sizesMultiplicity, search history and winner's curse
1

Read

In this order, only the parts listed

0 of 3 done

  1. The Bootstrap and paired-sample permutation testsSciPy - Resampling and Monte Carlo methods tutorials

    The notebooks linked from this page: Tutorial 3 (The Bootstrap: scipy.stats.bootstrap with paired=True, BCa and percentile intervals, standard errors) and Tutorial 2b (Paired-Sample Permutation Tests: permutation_test with permutation_type='samples')

    Stay inside Tutorials 2b and 3. The independent-sample and Monte Carlo tutorials solve different comparisons.

  2. ISLP Chapter 5 lab: the bootstrap standard errorISLP - resampling and multiple testing

    The Bootstrap (Portfolio standard error 0.0912 via boot_SE with B=1000 and seed 0, then the linear-regression coefficient SEs)

  3. ISLP Chapter 13 lab: FWER, FDR and the double-dipISLP - resampling and multiple testing

    Family-Wise Error Rate (Bonferroni rejects only Manager One; Holm rejects Managers One and Three at FWER 0.05; the best-versus-worst paired test at rises to 0.186 under Tukey's method) and False Discovery Rate (Benjamini-Hochberg on all 2,000 managers)

2

Focus on

  • Resample pairs, not models: one index stream (paired=True) must score both models, or shared example difficulty becomes noise.
  • The paired-difference test is permutation_type='samples' (sign flips within pairs). 'pairings' tests association instead; 'independent' shuffles labels across groups.
  • Pairing shrinks intervals. In the reproduce simulation a 4.8-point gap on 500 items has a paired 95% interval about 0.038 wide, against about 0.120 when each model is resampled on its own, which then covers zero.
  • Every tuned, selected or re-run comparison spends error budget. Record the search history and report Holm (FWER) or BH (FDR) adjustments beside raw p-values and effect sizes.
Common mistakes · 3
  • Bootstrapping each model's scores with its own rng stream. Unpaired resampling destroys the pairing and inflates the interval.
  • Using permutation_type='pairings' (or 'independent') for a paired model comparison. That tests correlation (or cross-group exchangeability), not the mean paired difference.
  • Reporting the winning p-value after many seeds, splits or metrics. In the ISLP Fund lab the best-versus-worst managers, picked after looking, give ; Tukey's method over the implied 10 comparisons raises it to 0.186.
3

Try it yourself

Closed-book, before checking anything

Closed-book, implement a paired bootstrap for an accuracy difference (one index stream for both models, 9999 resamples, percentile interval) plus a paired permutation test. Simulate shared difficulty: default_rng(0), uniform on 500 items, model right when and model when , so 's hits are a subset of 's, the strongest pairing. Accuracies are 0.662 and 0.614; expect a paired interval near [0.030, 0.068] against near [-0.010, 0.110] when each model is resampled independently.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Two models share the test set. Why must the bootstrap indices be identical for both?Answer

    Scores on the same items correlate through item difficulty. Identical indices keep the pairing, so shared difficulty cancels in the difference; independent streams add it as noise.

  2. 2.Which permutation_type tests a paired accuracy difference, and what does it shuffle?Answer

    'samples': within each pair it swaps the two models' outcomes (sign flips). The null is a zero mean paired difference.

  3. 3.Your paired interval is [0.030, 0.068] and the permutation is 0.0002 from 9999 resamples. What do you report?Answer

    A 3.0-to-6.8 point gain (observed 4.8) separated from zero, the effect size, the count of comparisons that preceded it, and below 0.001. With 9999 resamples 0.0002 is the smallest two-sided the test can return, so it is a floor, not a measurement.

  4. 4.After 20 metric looks, one comparison gives . Ship it?Answer

    No. With 20 looks the family-wise error is near 1 minus = 0.46. Adjust with Holm or BH, or pre-register the primary comparison, and report the effect size either way.

5

Practice

  • ISLP Ch05 lab: bootstrap standard errors

    Reproduce SE 0.0912 (B=1000, seed 0) and the OLS bootstrap SEs from The Bootstrap

  • ISLP Ch13 lab: Bonferroni, Holm and Benjamini-Hochberg

    Reproduce the Bonferroni and Holm verdicts (only Manager One, then One plus Three at FWER 0.05), the Tukey adjustment from 0.038 to 0.186, and the Benjamini-Hochberg rejections on all 2,000 managers

    Run both labs before your own paired comparison, then report it with an effect size and a comparison count.

You're done when

Your paired bootstrap and permutation test agree on a model comparison, the interval uses one index stream, and every p-value ships with an effect size and a comparison count.

Only when you can do this without notes.

Leads to

Notes

Resources · 2 for this unit, 5 more in the section
  • ISLP - resampling and multiple testingJames, Witten, Hastie, Tibshirani and Taylor · required

    Use Chapter 5 and the relevant selection-history parts of Chapter 13 with their Python labs. Connect resampling to uncertainty and multiplicity without repeating the full statistics stage.

  • SciPy - Resampling and Monte Carlo methods tutorialsSciPy developers · reference

    Work the notebooks linked from this page: Tutorial 3 (The Bootstrap) with scipy.stats.bootstrap, including paired=True, and Tutorial 2b (Paired-Sample Permutation Tests) with permutation_test and permutation_type='samples'. Keep one resampling index stream across compared models.

Also in this section

  • scikit-learn - model selection and evaluation routescikit-learn · primary

    Follow Cross-validation, Hyperparameter tuning, Decision threshold tuning, Metrics and scoring, Probability calibration, Validation curves, Permutation importance and Common Pitfalls. Retain raw predictions and independently hand-check central metrics.

  • Classical ML Scientific InvestigationRoadmap-Final · reference

    Use Core requirements, architecture constraints, Milestones A-F and failure injection as the standard for end-to-end evidence. The full project remains a later capstone route.

  • D2L - Environment and Distribution ShiftD2L authors · support

    Read 4.7, then construct one controlled covariate, label and concept shift. Record what changes, which signal detects it and what response the evidence supports.

  • Deep-ML candidate - evaluation problemsDeep-ML · optional

    After the platform admission check, use at most one of 18 K-Fold CV, 260 Expected Calibration Error, 276 ROC, 277 AUC or 840 Stratified K-Fold. Hand-checked local metrics remain the evidence.

  • El-Yaniv and Wiener - On the Foundations of Noise-free Selective ClassificationJMLR · reference

    Read the Abstract and Section 2 (Preliminary Definitions: Definitions 1 and 2 for coverage and selective risk) for the risk-coverage tradeoff. Stop before the noise-free learning bounds.