School/✦ Research Engineer/Week 33
Module check: forking paths and multiple comparisons
Nothing in this simulation has any real effect. Yet with a few innocent choices, a third of studies 'find' one. How?
About 50 min · 3 goals · Checked by automated tests
1.Why should I care?
p-hacking rarely feels like cheating: each choice seems reasonable. Seeing false positives appear from pure noise, with your own hands on the switches, is the best inoculation there is.
- ◇ Explain how flexible analysis choices inflate false-positive rates.
- ◇ Apply a Bonferroni correction and compute expected false discoveries.
- ◇ Recognise p-hacking and HARKing and state the remedies.
2.Discover
Start with every switch off: the false-positive rate is near 5%. Turn on one fork at a time and note the rate. Turn them all on. Then switch on the Bonferroni correction. Which single fork inflated the rate most?
Loading the interactive…
Can't use the interactive? Read a description instead
The forking-paths simulator runs 400 seeded studies in which there is no real effect. Switches add analysis choices (three outcomes, outlier removal, subgroups, peeking). A bar shows the share of studies reporting a 'significant' finding against a marked 5% line. With all switches on it is far above 5%; a Bonferroni switch brings it back near 5%.
3.Checkpoint: guided practice
Check what you just discovered before going on. Hints appear after a wrong answer.
Practice 1 · a fresh version every time
You test m = 4 metrics in one study and want the family-wise error rate (chance of at least one false positive) to stay at or below α = 0.01. What per-test p-value threshold does the Bonferroni correction give?
4.Predict
You test 20 independent metrics, none with a real effect, at α = 0.05. Chance of at least one 'significant' result?
Guess first. Being wrong here is how the surprise works.
5.Understand
The garden of forking paths
Which outcome, which outlier rule, which subgroup, when to stop: each choice is a fork. If choices are made after looking at data, the analysis effectively tries many paths and reports one. The nominal 5% then hugely understates the real false-positive rate, even with no intent to deceive.
p-hacking and HARKing
p-hacking: trying analyses until p < 0.05. HARKing: Hypothesising After the Results are Known, presenting a post-hoc pattern as if predicted. Both are questionable research practices that manufacture findings. Remedies: pre-registration, one primary analysis, corrections for planned multiple tests, and labelling the rest exploratory.
Expected false discoveries
Run m null tests at α and expect m·α false positives. If only a fraction of ideas are true, the share of significant results that are false can be large: with 90 null and 10 real ideas, α = 0.05 and power 0.8, there are 4.5 false versus 8 true hits, so 36% of 'discoveries' are false.
Explain it another way
Throw enough darts blindfolded and one hits the bullseye. Painting the target around wherever the dart landed is HARKing.
Each data-dependent choice multiplies the effective number of tests; FWER = 1 − (1 − α)^k for k independent paths.
Bonferroni: α* = α/m. FDR among discoveries ≈ m₀α / (m₀α + m₁·power).
Tuning a robot on many metrics and seeds and reporting the best combination is the engineering version of p-hacking; held-out test conditions are the engineering version of pre-registration.
Derivation: Bonferroni from the union bound
Let Eᵢ be the event 'test i is a false positive', with P(Eᵢ) = α* for each of m null tests.
Family-wise error rate FWER = P(E₁ ∪ … ∪ E_m).
Union bound: P(∪Eᵢ) ≤ Σ P(Eᵢ) = m·α*, whatever the dependence between tests.
Choose α* = α/m. Then FWER ≤ m · α/m = α.
For independent tests the exact rate is 1 − (1 − α/m)^m, slightly below α.
Cost: each test is stricter, so power falls. For many tests, false-discovery-rate methods trade a few false positives for more power.
Worked example 1
You pre-register 4 metrics as co-primary. What threshold per test keeps FWER at 0.05?
Bonferroni: 0.05 / 4 = 0.0125. A metric with p = 0.02 is not significant under this plan, and you report it as such.
Common mix-ups
- p-hacking requires deliberately cheating.
✓ It usually happens through many reasonable-looking choices made after seeing the data; good intentions do not prevent it, pre-registration does.
6.Watch
→ Match each p-hacking tactic in the video to a switch in the simulator.
Walks through how trying many analyses and reporting the one that worked manufactures false positives, and what pre-registration does about it.
Length: see YouTube · captions on YouTube · source
Nothing loads from YouTube until you press play.
The video is optional: everything you need is also in the lesson text and the interactive.
7.Practice on your own
Practice, not a test. Wrong answers get a hint and another try.
Practice 2 · a fresh version every time
A team tests m = 40 sensor tweaks and, unknown to them, none has any real effect. Each test uses α = 0.01. How many "significant" results should they expect purely by chance?
Practice 3
Ten independent null tests at α = 0.05. Probability of at least one false positive? (Give 0–1.)
Practice 4
After seeing data, a learner writes the introduction as if the subgroup effect they found was the original hypothesis. This is…
Practice 5
Checking the p-value after every 5 runs and stopping when p < 0.05 is a problem because…
Practice 6
Which is the best remedy for forking paths?
Practice 7 · a fresh version every time
Of 100 tested ideas, 80 truly do nothing and 20 truly work. Tests use α = 0.05 and have power 0.8. What fraction of the "significant" results are false discoveries? (Give a number between 0 and 1.)
8.Apply it
List every analysis choice in your capstone (metrics, exclusions, subgroups, stopping). For each, fix it in the pre-registration or mark it exploratory. If you have several primary tests, state your correction.
9.Reflect
10.Go further
Research mode: limits and open questions
Large-scale replication efforts have linked low replication rates to small samples combined with flexible analysis, the mechanism simulated here.
Concepts: Multiple comparisons and the garden of forking paths · Honest reporting and research integrity · Statistical inference: intervals, effect sizes and p-values