PART XIII · Chapter 106 · 597 / 660

Lesson 597. Bayesian updating and base rates: the chance that a good-looking backtest is real

Chapter 106. Statistical Foundations of Backtesting: Fat Tails, Bayes, CLT & Bootstrap

A rule's five-year backtest cleared a pass criterion set in advance. The criterion was set so that "a rule with no edge clears it by chance with a probability of 5%." Is the probability that this rule is fake then 5%? It is not. The 5% is the share of rules with no edge that pass, and the share of passing rules that have no edge is a completely different number.

Bayes' theorem connects the two numbers, and the base rate sits between them. The base rate is the share of the ideas you test that had a true edge from the start. This lab applies the same pass criterion to a synthetic pool of candidates built with a known base rate, and counts directly how many of the passing candidates are real. The null comparison and the pre-registered plan were covered in Lesson 581, the inflation from testing many times in Lesson 588, and the probabilistic Sharpe ratio in Lesson 589.

1. Experiment design: a synthetic pool of candidates with a known base rate

One candidate is a column of returns over 1,260 daily periods (about 5 years). All are synthetic data made with a fixed seed, with a standard deviation of 1%. Candidates with no edge have a mean of 0, and candidates with an edge have a mean set so that the annualized Sharpe ratio is exactly 0.5. The candidates with an edge are a setting made on purpose for the experiment; they are not a claim about how many such candidates exist in real markets.

For each seed, we build 1,000 candidates with no edge and 1,000 candidates with an edge, and from them we form a pool of 1,000. With a base rate of 5%, that is 50 candidates with an edge and 950 without. There are four base rates, 1%, 5%, 20% and 50%, and the experiment is repeated with 5 seeds starting from seed 20261117, recording the median and the range.

The pass criterion is hypothetical, for teaching, and was set before looking at results. A candidate passes if its probabilistic Sharpe ratio (Lesson 589) against a benchmark of 0, computed under the normal assumption, is 0.95 or more. For five years of data, the annualized Sharpe ratio has to exceed roughly 0.74. A candidate is only a column of returns, not a trading rule.

2. It passed, but how many are real

First, measure two properties of the criterion itself. The share of candidates with no edge that passed (the false positive rate) was 5.5% as the median of 5 seeds, and the share of candidates with an edge that passed (the power) was 29.8%. Even candidates with a true Sharpe ratio of 0.5 pass only three times in ten on a five-year sample.

Base rate (synthetic experiment) Candidates that passed Of which with a true edge Share with a true edge among those passing
1% 56 2 3.7% (1.8 to 7.9%)
5% 65 14 20.9% (17.4 to 26.6%)
20% 101 60 58.5% (52.3 to 61.9%)
50% 181 152 85.5% (80.5 to 88.0%)

The numbers in the table are medians of 5 seeds, and the parentheses give the range. With the same criterion and the same power, the share of passing candidates that are real varies from about 4% to about 85% with the base rate.

Bar chart comparing, by base rate, the share of passing candidates that have a true edge. It is 3.7% at a base rate of 1%, 20.9% at 5%, 58.5% at 20% and 85.5% at 50%; the pass criterion and the power are the same throughout.

At a base rate of 5%, a median of 65 candidates passed, and a little over 50 of them had no edge. Someone holding only one passing result cannot know whether their candidate is among the 14 or among the 50. The point of this table is that a false positive rate of 5% does not mean "if it passes, it is 95% real."

3. Working it out by hand with Bayes' theorem

Bayes' theorem recomputes the probability after seeing a result (the posterior probability) from the probability before seeing it (the prior probability) and the likelihood of that result. Applied here: the probability that a passing candidate has a true edge = base rate × power ÷ (base rate × power + (1 − base rate) × false positive rate).

Assumptions: base rate 5%, power 30%, false positive rate 5%. The numerator is 0.05 × 0.30 = 0.015 and the denominator is 0.015 + 0.95 × 0.05 = 0.0625, so the posterior probability is 24.0%. The same formula gives about 5.7% for a base rate of 1%, 60.0% for 20% and about 85.7% for 50%. These are almost the same as the medians of the experiment; the differences are the sampling noise of 5 seeds.

The power of 30% also comes out of an approximation. Observing a true annualized Sharpe ratio of 0.5 for five years gives an expected standardized value of about 0.5 × √5 = 1.12, and the probability of exceeding the threshold of 1.645 is about 30%. Extending the observations to 10 years raises the power to about 47% and the posterior probability at a base rate of 5% to about 33%. Even with a longer record, when the base rate is low the weight of a passing result does not grow much.

The number of trials enters the same formula. Assumptions: if you test 20 independent variants of each idea and put only the best one up against the criterion, the probability that an idea with no edge passes grows to 1 − 0.95^20 = about 64.2%. Even with a generous power of 100%, the posterior probability at a base rate of 5% stays at about 7.6%. This is the path by which the multiple testing of Lesson 588 cuts the posterior probability.

4. The numbers that passed are inflated too

The sample Sharpe ratios of the passing candidates show one more problem. At a base rate of 5%, the passing candidates with a true edge had an annualized Sharpe ratio with a median of 1.00, twice the true value of 0.5 that was set. The passing candidates with no edge had 0.92.

Bar chart comparing the annualized Sharpe ratio of 0.5 set for candidates with a true edge with the sample Sharpe ratios of candidates that cleared the pass criterion. Passing candidates with a true edge show 1.00 and passing candidates with no edge 0.92; both are above the true value and close to each other.

If you keep only the candidates that cleared the criterion, you keep only the samples that were lucky. So the numbers of passing candidates come out higher than the true values, and the real and the fake ones, at 1.00 and 0.92, can hardly be told apart. If you read the Sharpe ratio of a passing backtest as the value to expect in the future, you expect twice the true value even when it is real. That is why the result of the out-of-sample segment (Lesson 590) has to be written separately.

5. How to record when the base rate is unknown

In real research the base rate cannot be known. So write it as a range instead of one number, and record how the posterior probability changes across that range. For example, write: "If the base rate is taken as 1 to 20%, the probability that a result that passed this criterion is real is about 6 to 60%."

You cannot change the base rate directly, but you can change the other two terms with a plan. If you fix the criterion and the number of trials before seeing results (Lesson 581, Lesson 306), the false positive rate stays at the value you wrote. Lengthening the observation period or setting an out-of-sample segment in advance increases the power and the weight of the confirmation. Conversely, if discarded trials are not counted, the false positive rate grows out of sight, like the 64.2% of section 3.

The idea in Lesson 267 of separating decisions from outcomes connects here too. More than the single outcome of passing a criterion, the process that produced it (the assumed base rate, the number of trials, the period) sets the posterior probability. If you write the range of the posterior probability next to the Lesson 306 verdict, you avoid reading a pass too heavily as evidence of an edge.

The record for this lesson is a posterior-probability box. On one line, write the pass criterion and its false positive rate, the approximate power, the number of trials, the range of the assumed base rate, and the range of the posterior probability that goes with it.

Try it yourself

  1. Assumptions: base rate 10%, power 40%, false positive rate 5%. Compute the probability that a passing candidate has a true edge.
  2. From the results table, read the number of candidates that passed at a base rate of 20% and the number of them with a true edge, and check the share.
  3. Assumptions: you tested 5 independent variants of the same idea and put only the best one up against the criterion (false positive rate 5%). What is the probability that an idea with no edge passes?
  4. A colleague wrote: "The probabilistic Sharpe ratio exceeded 0.95, so the probability that this rule is real is 95%." Rewrite this with the numbers of this lesson.

Answers

First, the numerator is 0.10 × 0.40 = 0.04 and the denominator is 0.04 + 0.90 × 0.05 = 0.085, so the answer is about 47.1%. Even after passing the criterion, it is below one half.

Second, 101 candidates passed, and 60 of them had a true edge, so the share is 58.5% (medians of 5 seeds). It is almost the same as the 60.0% worked out by hand in section 3.

Third, 1 − 0.95^5 = about 22.6%. The false positive rate grows more than four times from 5%, so the 5% written in the plan is no longer the false positive rate of this test. Write the 4 discarded variants in the trial record too.

Fourth, 0.95 is an approximation of the probability that the true Sharpe ratio is above 0; it is not a posterior probability that reflects the base rate. With the settings of this experiment, the share of passing candidates with a true edge at a base rate of 5% was about 21%. Write the assumption and the range together, for example: "If the base rate is assumed to be 1 to 20%, the probability that a result that passed this criterion is real is about 6 to 60%."

Data: synthetic data (5 fixed seeds, 20261117 to 20261121; normal returns over 1,260 daily periods with a standard deviation of 1%). For each seed there are 1,000 candidates with a mean of 0 and 1,000 candidates with a mean set for an annualized Sharpe ratio of 0.5. Every experimental number was read from the results tables computed from these data, and the hand calculations of section 3 use assumed numbers.

Related lessons