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

Bootstrap, permutation tests and multiple comparisons

Repeating an analysis changes the procedure being evaluated. Resampling, metric selection and early stopping need their own null distributions and error policies, not just a familiar test call.

You'll be able to

  • Derive the conditional sampling variance of a bootstrap mean and explain when permutation exchangeability holds.
  • Implement Bonferroni and Benjamini-Hochberg, naming FWER and FDR and the assumptions behind each guarantee.
  • Measure optional-stopping inflation and explain why selecting a winning estimate exaggerates apparent effects.

Covers

Bootstrap and permutation testsMultiple comparisons, optional stopping and winner's curse
1

Read

In this order, only the parts listed

0 of 4 done

  1. 18.05 Class 24 reading: the empirical bootstrapMIT 18.05 - Inference practice

    Sections 4 to 7: empirical distribution, resampling, bootstrap principle, percentile and basic intervals

    Derive the conditional distribution for a three-point empirical population. Do not repeat the later paired-bootstrap implementation.

  2. SciPy: the unpaired permutation nullPermutation nulls and false discovery control

    Notes, Unpaired statistics (permutation_type='independent'); alternative parameter's exact and randomized p-value definitions

    Read the null it states, one common distribution with labels assigned at random, and the exact-partition counting. Skip paired APIs and the numerical examples; do not reuse their randomly generated samples.

  3. SciPy: false discovery controlPermutation nulls and false discovery control

    Notes on independence and positive regression dependence; Examples, the 15-hypothesis thrombolysis comparison of Bonferroni and Benjamini-Hochberg

    Use the example to distinguish error criteria. Do not infer that FWER is the false-positive rate of one individual test.

  4. Johari, Pekelis and Walsh: why monitoring changes inferenceAlways Valid Inference

    Version 3, July 16, 2019: Section 1, Introduction, pp. 1 to 3, especially Figure 1 and the continuous-monitoring motivation

    Stop before the technical construction of always-valid tests. Understand the failure and the need for a predeclared fixed horizon or a valid sequential procedure.

2

Focus on

  • Condition on observed data: each bootstrap draw has mean and variance . Independent draws of size therefore give . This approximates a sampling variance; it does not create new population information.
  • A permutation null makes labels exchangeable, for example under identical independent group distributions or a sharp no-effect randomization null. Equal means alone do not make unequal-variance observations exchangeable.
  • Bonferroni rejects at and controls by the union bound for valid marginal p-values, without independence. BH sorts p-values, finds the largest with , and rejects ranks 1 to . It controls under independence or suitable positive dependence, not arbitrary dependence.
  • The maximum of noisy estimates is selected for positive noise as well as signal. Its original pointwise interval is not automatically a post-selection interval. Repeated looks also select noise, even though successive cumulative tests are dependent.
Common mistakes · 3
  • Permuting labels to test only equal means when variances or sampling schemes differ. The exchangeability null is stronger.
  • Treating BH as a guarantee that at most q of this particular rejection list is false. It bounds an expectation over repeated analyses.
  • Reporting only the first significant look or best metric, then quoting its original fixed-analysis error rate.
3

Try it yourself

Closed-book, before checking anything

By hand derive the conditional bootstrap-mean variance for data [0, 1, 2]: 2/9. Enumerate all 27 ordered length-three resamples in NumPy float64 with itertools.product(range(3), repeat=3), index the data array and take each row mean. Their mean is 1 and variance with ddof=0 is 0.222222; absolute difference from 2/9 was below 1e-15. Separately implement Bonferroni and the BH step-up rule for = [0.001, 0.012, 0.020, 0.080, 0.200], = = 0.05. Bonferroni rejects only rank 1; BH rejects ranks 1 to 3. Compute BH adjusted values by reverse cumulative minima of , capped at 1: displayed to six decimals they are [0.005, 0.030, 0.033333, 0.100, 0.200]. Compare the unrounded values with scipy.stats.false_discovery_control(p, method='bh'), requiring infinity-norm difference below 1e-12. Finally use rng = numpy.random.default_rng(44); draw rng.normal(0, 1, size=(10000, 200)) once in float64. Compute cumulative row sums at divided by ; reject when abs(Z) > scipy.stats.norm.ppf(0.975). Rejection at the final look is 0.0516, versus 0.2495 for any look. Against the fixed-horizon target 0.05, allow absolute Monte Carlo error 0.01. Do not compare the any-look rate to : these looks are dependent. Seeded values came from NumPy 2.5.4 with SciPy 1.18.1.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.Prove Bonferroni control and identify where independence is used.Answer

    Let contain the true nulls. Valid p-values give for each in . The union bound gives , since . No independence is used. The family and thresholds must describe the full analysis, not a selected subset.

  2. 2.If all hypotheses are null, how are FDR and FWER related?Answer

    , so is 1 exactly when any hypothesis is rejected and 0 otherwise. Hence . With genuine alternatives present they need not coincide.

  3. 3.Why can a percentile bootstrap fail for the endpoint of a uniform distribution?Answer

    Every resampled maximum is at most the observed maximum. The true upper endpoint exceeds the observed maximum almost surely in a continuous uniform sample, so a percentile interval made only from resampled maxima cannot cover it. The plug-in bootstrap fails for this boundary statistic.

  4. 4.What must a sequential alternative to fixed-horizon inference guarantee?Answer

    It must control the probability of a false rejection over the allowed data-dependent stopping times, not merely at each single fixed n. Looking early for safety does not license an ordinary fixed-n efficacy claim at the selected stopping time.

5

Practice

  • 18.05 Problem Set 9, Problem 2: the interrupted coin experiment

    Problem 2(a to d), p. 1: fixed flips, stopping at the third head, partial data and Bayesian likelihoods

    Attempt before reading the official solutions linked on the course Problem Sets page. The section mini-project should add bootstrap coverage, Bonferroni/BH simulations and selection of the largest noisy metric; these are not checked by this coin problem.

You're done when

You derive and enumerate the bootstrap variance, match the BH oracle, reproduce stopping inflation, and solve the coin problem while naming the error controlled by each rule.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 5 more in the section
  • MIT 18.05 - Inference practiceMIT OpenCourseWare · required

    Use classes 17-20, 22-24 and 26 with their problem sets for tests, intervals, bootstrap and regression.

  • Always Valid InferenceJohari, Pekelis & Walsh · depth

    Use the introduction and worked motivation to understand optional-stopping failure. Reproducing the theory is outside this gate.

  • Permutation nulls and false discovery controlSciPy · reference

    Read permutation_test Notes, Unpaired statistics, for exchangeability and exact partitions; false_discovery_control Notes and the named thrombolysis example for Bonferroni and Benjamini-Hochberg. Use as an independent implementation oracle, not as a substitute for stating assumptions.

Also in this section

  • MIT 14.310x - Data Analysis for Social ScientistsMIT OpenCourseWare · primary

    Follow lectures 11-15, 17-20 and 22 with matching slides and problem sets for inference, regression, causality and experiment design.

  • Causal Inference: What IfHernán & Robins · required

    Read Chapters 1-3 and 6-8 for causal effects, DAGs, confounding, selection bias and identification reasoning.

  • Patterns of trustworthy experimentationMicrosoft ExP · required

    Read after the course to connect health checks, guardrails and statistical interpretation to production launch decisions.

  • Probabilistic Machine Learning: An IntroductionKevin P. Murphy · reference

    Use the April 18, 2025 online edition: Sections 4.2.3 to 4.2.5, 4.5.1 and 4.6.4.1 for Bernoulli and Gaussian MLE/MAP; the definition and central intervals in 4.6.6; 2.1.2 and 11.7.4 for predictive uncertainty. Exercises 4.1 and 4.2 supply derivation practice.

  • Probability calibration: the statistical propertyscikit-learn · reference

    Read the opening calibration definition, the proper-scoring-rule note, and Section 1.16.1, Calibration curves. Stop before recalibration methods; the later Classical ML unit implements them.