Quant Terminal
A1-06A1·intro·~16 min

Bayes' theorem — updating beliefs with evidence

probabilitybayesbase-ratesbacktesting

▸ Pretest — guess, even if you don't know

A disease affects 1% of a population. A test catches 99% of true cases, but also gives a false positive on 5% of healthy people. You test positive. Roughly what's the probability you have the disease?

Two lines of algebra

You already own everything needed to derive Bayes' theorem. Quick reading reminder from A1-05: P(AB)P(A \mid B) is read "the probability of A given B" — the chance A is true once you know B happened. One new symbol: \cap is read "and", so P(AB)P(A \cap B) is "the probability that A and B both happen" — the joint probability.

From A1-05, that joint probability factors two ways:

P(AB)=P(AB)P(B)=P(BA)P(A)P(A \cap B) = P(A \mid B)\,P(B) = P(B \mid A)\,P(A)

In words: the probability of "A and B both" equals the probability of B, times the probability of A given B. It also equals the probability of A, times the probability of B given A. Two routes, same number.

Divide both sides by P(B)P(B):

P(AB)=P(BA)P(A)P(B)P(A \mid B) = \frac{P(B \mid A)\,P(A)}{P(B)}

In words: the probability of A given B equals the probability of B given A, times the probability of A on its own, divided by the probability of B on its own. (The horizontal bar is a fraction: top divided by bottom.)

That's it — that is Bayes' theorem. It is the exchange rate between the two conditionals from A1-05's inversion trap: it converts "probability of B given A" into "probability of A given B". And P(A)P(A) — the base rate, also called the prior — your probability for A before seeing any evidence — is what you pay at the exchange.

In practice P(B)P(B) is expanded over the ways BB can happen. One more symbol: ¬A\neg A is read "not A" — the event that A does not happen:

P(AB)=P(BA)P(A)P(BA)P(A)+P(B¬A)P(¬A)P(A \mid B) = \frac{P(B \mid A)\,P(A)}{P(B \mid A)\,P(A) + P(B \mid \neg A)\,P(\neg A)}

In words: the bottom adds up the two ways B can occur — B happening when A is true, plus B happening when A is false. So evidence BB can come from the world where AA is true, or from the world where it isn't. The posterior — your updated probability of A after seeing the evidence — is just the share of all BB-occurrences that come from the AA-world.

The diagnostic example, in counts

Formulas hide intuition; counts reveal it. Take 10,000 people. The disease base rate is 1%, so 100 of them actually have it. Sensitivity — the share of real cases the test catches — is 99%. The false-positive rate — the share of healthy people who wrongly test positive anyway — is 5%:

Test positiveTest negativeTotal
Diseased991100
Healthy4959,4059,900

P(diseasepositive)=9999+495=995940.167P(\text{disease} \mid \text{positive}) = \frac{99}{99 + 495} = \frac{99}{594} \approx 0.167

In words: the probability of disease given a positive test is the number of true positives (99) divided by the number of all positives (99 + 495 = 594). The \approx sign reads "approximately equals": about 0.167, i.e. 17%.

The false positives (495) swamp the true positives (99) — not because the test is bad, but because healthy people outnumber diseased ones 99 to 1. When the condition you're testing for is rare, even a good test yields mostly false alarms.

Your backtest passed. So what?

Now the version of this problem you will live inside for the rest of this curriculum. A backtest — a simulation of a trading strategy on historical data — plays the role of the medical test. Replace "disease" with "strategy has a real edge" and "positive test" with "backtest looks good":

P(edgepass)=0.60×0.050.60×0.05+0.05×0.95=0.0300.07750.39P(\text{edge} \mid \text{pass}) = \frac{0.60 \times 0.05}{0.60 \times 0.05 + 0.05 \times 0.95} = \frac{0.030}{0.0775} \approx 0.39

In words: the probability of a real edge given a passing backtest. The top is the chance of "real edge AND pass": 0.60 × 0.05 = 0.030. The bottom is the chance of a pass from either world: passes from real edges (0.030) plus lucky passes from the 95% of no-edge strategies (0.05 × 0.95). Divide: 0.030 / 0.0775, approximately 0.39.

A passing backtest, under honest and even somewhat optimistic assumptions, means roughly a 39% chance the strategy is actually good. Less than a coin flip. The pass moved you from 5% to 39% — genuinely valuable evidence. But treating it as a verdict ("it works!") is the diagnostic fallacy — mistaking "probability of a pass given an edge" for "probability of an edge given a pass" — with money attached.

And it gets worse. If you tested 100 variations and kept the best-looking one, your effective false-pass rate is far above 5%, and the posterior collapses back toward the prior. That is the multiple-testing problem — try enough things and something will pass by pure luck. A2-05 treats it in full; Bayes is why it's lethal.

Beliefs are distributions, not verdicts

The deeper shift Bayes asks of you: stop treating claims as true/false flags waiting to be set. Start treating them as probabilities that move as evidence arrives. Before the backtest: 5%. After one clean pass: 39%. After a year of live trading in line with the backtest: higher still. After a live year that looks nothing like the backtest: back down.

Nothing is ever "proven" — you just accumulate evidence and update. Full Bayesian statistics builds an entire inference framework on this one theorem. There, priors and posteriors are placed over parameters — the unknown numbers inside a model — not just over events. McElreath's Statistical Rethinking is the classic on-ramp. For now, the discipline to internalize is: always ask what the base rate is before celebrating a positive signal.

⧉ Review card
State Bayes' theorem.
P(A given B) = P(B given A) P(A) / P(B). Derived in one step from the two factorizations of P(A and B). It converts one conditional into the other, at the price of the base rate P(A).
⧉ Review card
Disease base rate 1%, test sensitivity 99%, false-positive rate 5%. Why is P(disease given positive) only about 17%?
Per 10,000 people: 99 true positives but 495 false positives (5% of 9,900 healthy). 99 / 594 ≈ 17%. When a condition is rare, false alarms from the huge healthy pool swamp the true hits.
⧉ Review card
Your backtest passed. Why is the probability the strategy is genuinely good still low?
Bayes with an honest prior: most strategy ideas (say 95%) have no edge. Even with 60% power and a 5% false-pass rate, P(edge given pass) ≈ 0.03 / 0.0775 ≈ 39%. A pass is evidence, not a verdict — and multiple testing degrades it further.
⧉ Review card
What is the Bayesian stance toward beliefs about strategies?
Beliefs are probabilities to be updated as evidence arrives, not flags to be set. A backtest pass moves the probability up; contradictory live results move it down. Nothing is ever proven — evidence accumulates.

Predict before the next lesson

Next lesson: the Law of Large Numbers and the Central Limit Theorem — the machinery behind "more data reveals the truth." Predict:

Note your answers. We check them against the math next.

◈ Calibration check

Could you set up and compute a Bayes update from a base rate, a hit rate, and a false-alarm rate?

1 = guessing · 5 = could teach it

⏻ End of lesson

Mark it read to book its 4 review cards into your deck.

Sources & further reading