Try Enough Rules and One Will Work: Multiple Comparisons and Backtest Overfitting

Test twenty rules on the same history and the best one will look impressive even if all twenty are noise. How big the effect is, how to count your attempts, and how to correct for them.

Synthetic dataExamples on this page use synthetic data created for illustration.

Not adviceThis is educational material. It is not investment, business or other professional advice.

On this page
  1. The arithmetic of many tries
  2. How big is the effect on a backtest?
  3. Counting your attempts
  4. Correcting for them
  5. Designing so that you need fewer corrections
  6. Questions to ask of any claim

Imagine twenty people each flip a coin ten times. Somebody will probably get eight or nine heads, and a newspaper could call that person a “coin-flipping genius”. Nothing about their skill is special; with twenty tries, someone is bound to do well. The same thing happens when an analyst tries twenty rules on the same data and reports the best. The result is real, but it describes luck, not the rule. This is the multiple comparisons problem, and when it hits a historical test it is called backtest overfitting (Backtesting, Overfitting).

The arithmetic of many tries

A single test judged at the 5% level has a 5% chance of “finding” an effect that does not exist. With more independent tests, the chances of at least one false find add up:

Number of testsChance of at least one false “significant” result
15.0%
522.6%
1040.1%
2064.2%
10099.4%

The formula is 1 − 0.95ᵐ for m independent tests. The tests do not have to be formal. Every time window, threshold, subgroup, filter or version of a rule that you look at is a comparison, including the ones you drop without writing them down. Andrew Gelman and Eric Loken call these hidden choices the “garden of forking paths”.

How big is the effect on a backtest?

A simulation makes it concrete. Twenty rule variants are given no skill at all: each earns the same true return, about 6% a year, plus random monthly noise. Each is tested on 8 years of data; the best is picked and then followed for two more years it has never seen. The experiment is repeated 3,000 times and averaged.

Annualised return
An average variant, in the 8-year test6.2%
The best of the 20, in the 8-year test16.3%
That same best variant, in the next 2 years6.0%

The winner earns 10 points more than any variant deserves, and the advantage vanishes the moment it meets new data. The more variants tried, the larger the gap. How much better the best of N random results looks, measured in standard deviations above average:

Variants tried (N)Expected best result, in standard deviations above average
10.0
51.2
201.9
1002.5
1,0003.2

With a thousand variants, the best random one looks like a 3-sigma discovery. A researcher who reports only the winner, and not that a thousand were tried, is not necessarily dishonest, but the report misleads.

Counting your attempts

The first defence is bookkeeping. Keep a log of every variant you evaluate (the rule, the parameters, the data, the result), including the abandoned ones. The number of entries is the number that matters when you judge the survivor. It is easy to underestimate: ten parameters with five values each is already about ten million combinations.

Correcting for them

Two standard corrections let you keep a claim honest when you cannot avoid many tests.

Bonferroni: divide the significance threshold by the number of tests. With 20 tests, each must reach 0.05 / 20 = 0.0025. It is simple and strict, and it protects against any false find.

False discovery rate (Benjamini–Hochberg): rather than avoiding every false find, control the share of false finds among the discoveries. Sort the p-values and compare the i-th smallest with (i / m) × 0.05. Everything up to the largest p-value that passes is declared a discovery. It is less strict and finds more.

A worked example with ten p-values from ten tests:

Rankp-valueBonferroni threshold (0.05 / 10)BH threshold (rank / 10 × 0.05)Passes Bonferroni?Passes BH?
10.0010.0050.005YesYes
20.0080.0050.010NoYes
30.0120.0050.015NoYes
40.0300.0050.020NoNo
50.0400.0050.025NoNo
6–100.20 to 0.900.0050.030 to 0.050NoNo

Judged one at a time at 5%, five results look “significant”. After Bonferroni one remains; after Benjamini–Hochberg three. Which correction fits depends on the cost of a false find against the cost of a missed one.

Designing so that you need fewer corrections

  • Decide before you look. Write down the rule, the metric, the data and the success criterion before running the test (Pre-registration). A rule chosen in advance is one comparison, not twenty.
  • Keep a holdout. Reserve data that no variant has seen, and test only the finalist on it, once (Holdout Set).
  • Prefer simple rules with few knobs. Every free parameter multiplies the forks.
  • Demand a reason. A result with a plausible mechanism and consistent behaviour across periods is better evidence than a number that merely cleared a threshold.
  • Look at all the variants, not just the winner. If neighbouring parameter values do much worse, the winner is probably a fluke.

Questions to ask of any claim

  1. How many things were tried before this one was reported?
  2. Was the rule fixed before the data were examined?
  3. Does it hold on data that were not used to find or tune it?
  4. Is the effect large and consistent, or just past a threshold?

If the answers are “many”, “no”, “no” and “just past”, the claim is a lottery winner and should be treated as one.

References

  1. David H. Bailey, Jonathan M. Borwein, Marcos López de Prado, Qiji Jim Zhu. Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance . Notices of the American Mathematical Society, 2014. DOI: 10.1090/noti1105
  2. Yoav Benjamini, Yosef Hochberg. Controlling the False Discovery Rate: A Practical and Powerful Approach to Multiple Testing . Journal of the Royal Statistical Society: Series B, 1995. DOI: 10.1111/j.2517-6161.1995.tb02031.x
  3. Joseph P. Simmons, Leif D. Nelson, Uri Simonsohn. False-Positive Psychology: Undisclosed Flexibility in Data Collection and Analysis Allows Presenting Anything as Significant . Psychological Science, 2011. DOI: 10.1177/0956797611417632