Quant Memo
Core

p-Hacking and the Garden of Forking Paths

Search hard enough and noise will hand you a beautiful result. This is how selection manufactures significance, why it happens even to honest analysts who ran only one test, and how to price the search you actually did.

Prerequisites: Hypothesis Testing, p-values and Multiple Testing

Somebody shows you a strategy with a stellar backtest and a t-statistic of 3.2. It looks unarguable. Six months of live trading later it has made nothing. This story repeats so reliably across finance, medicine and psychology that it needs its own name, and the cause is almost never fraud. It is search. Somewhere between the raw data and the final chart, a great many choices were made, and the result you are being shown is the one that survived them.

The tipster scam

A con artist emails 1,024 strangers. Half are told a stock will rise this week; half are told it will fall. Next week he drops everyone who got the wrong call and splits the remaining 512 the same way. After ten rounds, one person has received ten correct predictions in a row and is ready to wire their savings to a man with no skill whatsoever.

Nobody lied at any point. Every individual email was an honest guess. The magic came entirely from showing you only the survivors. In research you play both roles at once: you generate the forecasts and you select the winner, and because you never see the discarded branches, the survivor looks miraculous.

What noise actually looks like

Before any maths, look at what pure randomness delivers when you test it twenty times. Below are twenty strategies with genuinely zero edge — every bar is noise. The dashed lines mark the conventional significance cutoff.

+2 −2 0 t = 2.2 t = −2.4 twenty worthless strategies, tested in turn →
All twenty have zero true edge. Two still clear the bar. Report only those two and you have a research note that looks rigorous and means nothing.

Putting a number on it

Write α\alpha for the false-alarm rate of a single test, conventionally 0.05, and mm for the number of tests you ran. If nothing is real, each test independently fails to raise a false alarm with probability 1α1 - \alpha, so all mm stay quiet with probability (1α)m(1-\alpha)^m. Therefore

P(at least one false positive)=1(1α)m.P(\text{at least one false positive}) = 1 - (1-\alpha)^m .

In words: the chance of being fooled at least once climbs quickly with the number of things you tried, and it climbs whether or not you meant to try them.

Worked example one: twenty strategies, no edge

Twenty candidate signals, all worthless, each tested at the 5% level.

Step 1 — chance a single test stays quiet: 10.05=0.951 - 0.05 = 0.95.

Step 2 — chance all twenty stay quiet: 0.95200.95^{20}. Taking logs, 20×ln(0.95)=20×(0.0513)=1.02620 \times \ln(0.95) = 20 \times (-0.0513) = -1.026, and e1.026=0.359e^{-1.026} = 0.359.

Step 3 — chance at least one fires:

10.359=0.641.1 - 0.359 = 0.641 .

About a 64% chance of finding a "significant" strategy among twenty pieces of pure noise. The expected count of false positives is simply 20×0.05=120 \times 0.05 = 1 — you should expect one winner every time you run a sweep of twenty. Push to 100 candidates and the chance of at least one false positive is 10.95100=99.4%1 - 0.95^{100} = 99.4\%. At that point a significant result is not evidence; it is arithmetic.

Worked example two: pricing a t-statistic of 3.2

Now the harder case. Your best strategy has t=3.2t = 3.2, whose one-off p-value is about 0.0014 — apparently overwhelming. But you built it by sweeping 200 variations of a signal.

Step 1 — the crude correction. Bonferroni multiplies the p-value by the number of tests:

padjusted=0.0014×200=0.28.p_{\text{adjusted}} = 0.0014 \times 200 = 0.28 .

In words: to survive 200 attempts at the 5% level, a result must be strong enough that it would have looked significant at the 0.025% level on its own. Yours is nowhere close.

Step 2 — the sharper check. Ask what the best of 200 worthless strategies typically scores. For mm independent standard-normal draws the largest is close to

E[max]2lnm.\mathbb{E}[\max] \approx \sqrt{2\ln m} .

In words: the champion of a large search grows, but only with the square root of the log of how many things you tried — slowly, yet relentlessly. With m=200m = 200:

2×ln200=2×5.298=10.60=3.26.\sqrt{2 \times \ln 200} = \sqrt{2 \times 5.298} = \sqrt{10.60} = 3.26 .

Step 3 — compare. A search over 200 pure-noise strategies produces a champion with t3.26t \approx 3.26 on average. Yours scored 3.2. Your best strategy is, if anything, slightly worse than what you would expect from searching a shelf of random numbers.

Path explorer
13055time →
end (bold path) 100.38spread of ends 58.966 independent paths, same settings

Redraw the paths above a few times. Every one is a pure random walk with no drift at all, yet in most batches at least one climbs steadily enough to pass as a live track record. Pick that path afterwards and you have "found" a strategy.

A p-value answers "how surprising is this result?" — but only for the one test it was computed on. The moment you select the best of many, the honest question becomes "how surprising is the best of everything I tried?", and that bar is far higher. Roughly 2lnm\sqrt{2\ln m} in t-units.

The forking paths: it happens even with one test

Here is the part that catches careful people. Suppose you ran exactly one regression and reported it faithfully. Are you safe? Only if you would have run that same regression no matter what the data looked like.

You almost certainly would not. If the effect had been stronger among small caps you would have split by size. If the first year looked odd you would have trimmed it. If monthly rebalancing had disappointed you would have tried weekly. Each of those is a fork in a garden of paths, and you walked the one the data suggested. The number of tests you effectively ran is the number of paths you would have been willing to take — not the number you actually typed.

Count a routine equity study: 3 choices of universe, 4 holding periods, 3 ways of defining the signal, 2 weighting schemes, 2 outlier rules. That is 3×4×3×2×2=1443\times4\times3\times2\times2 = 144 paths. Even a scrupulously honest analyst who ran one of them has, in effect, searched a garden of 144, because the data guided every turn.

What this means in practice

Decide the analysis before you see the outcome. Write down the universe, the horizon, the signal definition and the test — then run it once. This is what pre-registration does in clinical trials and what a locked-down research protocol does on a good quant desk. It costs nothing except the freedom to change your mind after peeking, which is precisely the freedom that causes the damage.

Keep an honest count of the search. Every variation you fit, including the ones you abandoned in an afternoon, belongs in mm. Then raise your bar accordingly: False Discovery Rate (FDR) control if you want a portfolio of discoveries with a known contamination rate, Bonferroni-style corrections if you need every single claim to hold, or a The Deflated Sharpe Ratio if the object is a trading strategy. Harvey, Liu and Zhu argued that after accounting for decades of published factor searching, the credible cutoff in asset pricing is roughly t>3t > 3, not t>2t > 2.

Finally, hold back data you never look at. An out-of-sample period, untouched until the very end, is the only cheap defence that survives contact with a determined researcher — yourself included. See Backtest Overfitting for how quickly that defence erodes if you peek more than once.

The classic confusion is believing p-hacking requires dishonesty. It does not. The most common version is an analyst who ran a single test, reported it exactly, and still produced a meaningless p-value — because the choice of which test to run was made after looking at the data. Intent is irrelevant; what matters is how many analyses the data could have led you to.

Ask any result one question: "how many things did you try?" If the answer is "I don't know", treat the p-value as decoration. If it is a number, compare the reported t-statistic against 2lnm\sqrt{2\ln m} before you get excited.

The formal machinery for all of this lives in p-values and Multiple Testing, and its trading-specific form in Data-Snooping Bias.

Related concepts

Practice in interviews

Further reading

  • Gelman & Loken, The Garden of Forking Paths (2013)
  • Simmons, Nelson & Simonsohn, False-Positive Psychology (2011)
  • Harvey, Liu & Zhu, ...and the Cross-Section of Expected Returns (2016)
ShareTwitterLinkedIn