A research team tries a hundred variations of a trading rule on the same history and reports the variation whose backtest has the smallest p-value. Read as the result of one test chosen in advance, that p-value can look like strong evidence of a positive expected return. The experiment that produced it was a search, though, and the winner of a search has to be judged against what searches produce by chance. This lesson derives how the number of trials changes false-rejection probabilities, proves that the Bonferroni correction controls the family-wise error rate under any dependence, proves the Benjamini-Hochberg bound on the false discovery rate for independent p-values, and sets out what a backtest-overfitting diagnostic can and cannot say.
Key terms
Multiple testing
Definition A multiple testing problem has null hypotheses about one data set, p-values , and a procedure that decides from the p-values which hypotheses to reject. Let be the unknown set of indices of the true nulls, , the number of rejections and the number of rejected true nulls. The p-value of a true null is valid, or super-uniform, if
for every , where is the law that generates the data. An exact p-value, such as one computed from a continuous test statistic with a correctly specified null distribution, satisfies this with equality and is uniform on . If each hypothesis is rejected when , then under any dependence, by linearity of expectation. If all nulls are true and the p-values are independent and exact, then
because all p-values exceed with probability , a product that needs independence.
In plain words Each test alone has a small chance of a false alarm. Running many tests gives many chances, and the chance that at least one of them goes off grows quickly with the number of tests, even though no single test has changed.
Example With independent exact null tests at , the probability of at least one rejection is , and the expected number of false rejections is . Each test still rejects with probability exactly . A rejection in this experiment carries little evidence, because some rejection was almost certain to occur.
Selection bias
Definition Selection bias is the error made when a statistic is reported because it was the best of several and is then judged as if it had been chosen in advance. If the null scores are independent with a common distribution function , then
since the maximum is at most exactly when every score is. Under these assumptions and for a continuous , a winner whose single-test p-value is has the selection-adjusted p-value . If each score has distribution function but the dependence between them is arbitrary, only the bounds
hold in general, the lower one because the maximum is at least and the upper one by the union bound. The count in these formulas is the number of candidates whose results could have influenced the choice, not the number shown. Trial accounting is the record of every configuration evaluated, including changed lookbacks, universes and entry thresholds and the variants that were discarded, together with the data and the score used for each, so that the selection experiment can be stated. When attempts are missing from the record, an adjustment that uses the recorded count corrects for a smaller search than the one that took place.
In plain words The best of many noisy scores is large even when no candidate has any edge. It has to be compared with what the best of that many scores looks like by chance, and that comparison needs an honest count of the attempts.
Example Suppose the null scores are independent standard normal variables. The best of them exceeds the one-sided percent critical value of a single test with probability . A winner at has the single-test p-value , but its selection-adjusted p-value is
With such candidates, the median of the maximum is , so a search over candidates without any edge produces a winning score above half the time.
Family-wise error rate
Definition The family-wise error rate of a procedure is , the probability of at least one false rejection, computed under the true configuration of nulls and alternatives. The Bonferroni correction rejects when . If every true-null p-value is valid, then whatever the dependence between the p-values and whichever hypotheses are true, the union bound gives
The bound is attained when , the p-values are exact and the rejection events are disjoint. Under strong positive dependence it is conservative, and if all the true-null p-values equal one exact p-value, the family-wise error rate is only .
In plain words Bonferroni splits the error budget evenly across the tests. It protects against even one false alarm and needs no assumption about how the tests depend on each other. The price is a much stricter threshold for each test.
Example For and the threshold is . With independent exact null p-values, the family-wise error rate is , below the bound . The exact value uses independence, while the bound holds without it. For the four constructed p-values , , and with , the threshold is , and Bonferroni rejects the first two.
False discovery rate
Definition The false discovery proportion is , the fraction of rejections that are false, which is when nothing is rejected. The false discovery rate is its expectation,
Since , the proportion is at most the indicator , so for every procedure. Under the global null, , every rejection is false, the proportion equals , and the two rates coincide. When some alternatives are true, controlling the false discovery rate at a level bounds the expected fraction of false rejections among the rejections. That is a weaker requirement than control of the family-wise error rate, and it allows several false rejections among many rejections. The false discovery rate is the expectation of a ratio, not the ratio of expectations.
In plain words The family-wise error rate asks how likely it is to make even one mistake. The false discovery rate asks what fraction of the reported discoveries are mistakes, on average over repetitions of the experiment. When there are many true effects, the second question permits more rejections.
Example In a constructed experiment, with probability the procedure makes one rejection, which is false, and with probability it makes nine rejections, all correct. The false discovery rate is , the same as the family-wise error rate, while .
Benjamini-Hochberg procedure
Definition Fix a level and order the p-values as . Let be the largest in with
and if there is none. The procedure rejects the hypotheses with the smallest p-values. It is a step-up rule, which looks for the largest qualifying position, so a failed comparison at a smaller position does not end the search. Equivalently, and the rejected set is , because a p-value at a position beyond that is at most would make that position qualify as well.
The theorem is that if the p-values are mutually independent and every true-null p-value is valid, then
For the proof, fix a true null and let be the number of rejections when is replaced by and the other p-values are kept. Then , because the zero p-value makes position qualify. The count depends only on , and hypothesis is rejected exactly when , in which case . To see this, write for the number of p-values at most , so that a position qualifies exactly when . Lowering can only raise , so . If , which holds in particular when is rejected, the original and modified counts agree at , so the position also qualifies for the original p-values. Then and , so is rejected. Hence
Conditioning on the other p-values fixes , and by independence stays valid, so the conditional expectation is at most . Summing over the true nulls, whose rejection indicators add up to , gives . With exact true-null p-values each step is an equality and . Other dependence structures need their own conditions, such as a form of positive dependence, or a stricter threshold, and those results are not derived here.
In plain words Compare the th smallest p-value with a threshold that grows in proportion to , find the last position where the p-value is under its threshold, and reject everything up to there. A p-value that fails its own comparison is still rejected when a larger p-value further down passes.
Example Take the constructed p-values , , and with and . The thresholds are , , and . The first three p-values are at or below their thresholds and , so , and the procedure rejects three hypotheses where Bonferroni at the same level rejected two. This identifies the rejection set only. Which of the three are true nulls is unknown, and the theorem bounds an expectation over repetitions of the experiment, not the false fraction of this one outcome.
Backtest overfitting
Definition Backtest overfitting is present when a configuration is chosen from a candidate family because of its backtest on a sample and its score on that sample overstates its performance on data that played no part in the choice, because the choice rewarded noise along with any real effect. A diagnostic studies the selection step itself. Combinatorially symmetric cross-validation takes candidates whose performance series are cut into blocks of equal length, even. For each of the ways of choosing half the blocks as the selection sample, it picks the candidate with the best score on that half and records the relative rank of that candidate’s score on the other half, where is the worst of the and the best. The fraction of splits with , the splits in which the selected candidate lands in the bottom half out of sample, is reported as an estimate of the probability of backtest overfitting. That number is conditional on the candidate family, the score, the data and the partition design. The splits also select on later blocks and evaluate on earlier ones, so the diagnostic does not follow the time order of a forecast. The number is not a probability that a future trade or strategy will lose, and trials missing from the family limit what it can say.
In plain words If the winner chosen on one part of the history keeps landing near the bottom on the rest, the search was mostly rewarding luck. The diagnostic counts how often that happens over many ways of cutting the history, for the family that was actually searched.
Example Four candidates have the following constructed mean daily returns, in basis points, on four blocks of equal length, so the score on two blocks is the average of their two entries.
| Candidate | Block 1 | Block 2 | Block 3 | Block 4 |
|---|---|---|---|---|
| A | ||||
| B | ||||
| C | ||||
| D |
Selecting on blocks 1 and 2 gives the scores , , and , so B wins, and on blocks 3 and 4 the scores are , , and , so B is the worst, with and . Over all six splits the winners are B, C, C, D, B and D for the selection halves , , , , and , with out-of-sample ranks , , , , and . Five of the six winners land in the bottom half, so the estimate is for this family, these blocks and this score. Candidate D, which has the best average over all four blocks, wins only two of the six selections.
Check yourself
- Twenty independent exact null tests are each run at . Find the probability of at least one rejection and the expected number of rejections. What threshold does the Bonferroni correction use for a family-wise error rate of , and what is the family-wise error rate with that threshold here?
Show the answer
All twenty p-values exceed with probability , so the probability of at least one rejection is . The expected number of rejections is , which needs no independence. The Bonferroni threshold is . Under independence the family-wise error rate is then
below . The bound would still hold if the tests were dependent, while the value uses independence.
- Apply the Benjamini-Hochberg procedure with to the p-values , , and . A colleague compares them with the thresholds in order and stops at the first failure. How many hypotheses does each approach reject, and which one is the procedure?
Show the answer
The thresholds are , , and . The first p-value passes, the second fails since , the third passes since and the fourth passes since . The largest qualifying position is , so the procedure rejects all four hypotheses. Stopping at the first failure rejects only one, which is a step-down reading, not the step-up rule. The rejected set agrees with for , since every p-value is at most . Bonferroni at level , with threshold , would reject only the first.
- An analyst backtests variants of a rule on the same history, keeps the four with the smallest p-values and applies the Benjamini-Hochberg procedure with to those four. Why is the result not an FDR guarantee, and what does a p-value of need with and ?
Show the answer
The theorem assumes valid p-values for a family fixed in advance. The four p-values kept are the smallest of , so their distribution under the nulls is far from super-uniform, and treating them as a family of four ignores the search. If all nulls were true with independent exact p-values, the smallest would be at most with probability . The family is all variants. With and , a hypothesis is rejected exactly when its p-value is at most , so a p-value of is rejected only if the procedure makes at least four rejections in all. The independence used in the proof is also doubtful for variants of one rule tested on the same history, while Bonferroni over all , with threshold , needs no independence and would not reject .