Last lesson you met the cast — prior, likelihood, posterior — and watched them combine to update a belief. This lesson promotes that intuition into an actual machine: Bayes’ theorem, written out in full, with every term named and the arithmetic shown to the last digit. Then we use it to expose the single most expensive mistake in quantitative trading: confusing “this signal fires when there’s a real edge” with “when this signal fires, there’s a real edge.” Those two sentences sound like twins. They are not even cousins, and the gap between them is where strategies — and careers — quietly go to die.
Here’s the trap in one breath: a detector that fires on 90% of genuine trading edges can still be wrong two times out of three about whether any given firing is real. Sounds impossible. It’s arithmetic, and by the end of this page you’ll compute it yourself.
Before you read — take a guess
A backtested signal fires on 90% of the days that turn out to have a real, profitable edge. On a fresh day, the signal fires. What is the probability that today actually has a real edge?
Bayes’ theorem, written out in full
The analogy. Think of Bayes’ rule as a currency converter for evidence. You walk in holding a belief in one currency — your prior, what you thought before seeing the data. The data arrives at an exchange rate — the likelihood, how strongly this data favors your hypothesis. The converter hands you back your belief in a new currency — the posterior, what you should think now. The whole formula is just the exchange desk’s receipt.
The formula. For a hypothesis (say, “today has a real edge”) and observed data (say, “the signal fired”):
Name every piece, because confusing them is exactly how the disasters happen:
- — the posterior: probability the hypothesis is true given you saw the data. This is what you actually want to know.
- — the likelihood: probability of seeing this data if the hypothesis were true. (Your signal’s sensitivity, “fires on 90% of real edges.”)
- — the prior: probability of the hypothesis before any data. (The base rate of edges.)
- — the marginal (or evidence): the total probability of seeing this data at all, across every way it could happen. It’s the normalizer that makes the posterior a proper probability.
- — “not ”: every world where the hypothesis is false. is your false-positive rate.
The bottom line is doing the heavy lifting. It says: the data can appear two ways — when is true and when is false — and you must count both sources. Skip the second term and you’ve already committed the fallacy below.
Name the four terms of Bayes' rule.
Pick the right option for each blank, then check.
The thing you want — probability the hypothesis is true after seeing the data — is the . The probability of the data assuming the hypothesis is true is the . What you believed before any data is the . The total probability of the data across all hypotheses, which normalizes the answer, is the .
The inversion fallacy: P(D|H) is not P(H|D)
This is the load-bearing idea of the entire lesson, so we’ll hammer it. The likelihood and the posterior are different numbers, and swapping them is the inversion fallacy — known in courtrooms as the prosecutor’s fallacy.
The courtroom version. A prosecutor announces: “There’s only a 1-in-a-million chance this DNA matches an innocent person — so the defendant is a million-to-one guilty!” That’s being passed off as . But in a city of ten million, roughly ten innocent people also match. The probability the defendant is the culprit given the match isn’t a million-to-one; with one true culprit and ten innocent matches, it’s closer to 1 in 11. Same evidence, wildly different conclusion — because the prosecutor ignored how many innocent people there were to begin with (the base rate).
The trading version. “My signal fires on 90% of real edges” is . It tells you how good the detector is. It does not tell you that a firing is 90% likely to be real — that would be , which also depends on how rare edges are and how often the signal cries wolf on edge-less days. A backtest that brags about hit rate while hiding the base rate is selling you the wrong conditional.
The prosecutor's fallacy, in trading clothes
“The signal is 90% accurate” almost never means “a firing is 90% likely to be a real edge.” Accuracy describes P(fire given edge) — a property of the detector. What your money cares about is P(edge given fire) — and to get it you must also know the base rate of edges and the false-positive rate. Quote one conditional, imply the other, and you’ve built a strategy on a number that was never there.
Base rates and natural-frequency reasoning
Why does a rare prior wreck a strong test? Because the test runs against a population, and when real edges are rare, the huge pile of edge-less days generates a flood of false alarms that can drown out the genuine hits — even if each individual day is only rarely a false alarm.
Raw probabilities make this hard to feel. The fix, due to the psychologist Gerd Gigerenzer, is natural-frequency reasoning: stop juggling percentages and instead imagine a concrete crowd — “of 1000 signals…” — and count heads. The same Bayes’ rule falls out, but now it’s just sorting people into boxes, and the base rate is impossible to forget because it’s literally the size of a box.
How natural frequencies rebuild Bayes
Walk a population of 1000 through the test:
- Split by the prior. A base rate of 5% means 50 of the 1000 are real edges; 950 are not. (There’s the base rate, front and center.)
- Apply the likelihood to the real ones. Sensitivity 90% means 45 of the 50 real edges fire.
- Apply the false-positive rate to the rest. A 10% false-positive rate means 95 of the 950 edge-less days also fire.
- Read the posterior off the flagged box. Total flagged = 45 + 95 = 140. Of those, only 45 are real. So P(edge given fire) = 45 of 140.
No formula anxiety, no flipped conditional — just four counts. That’s the whole method.
Fully worked example: the “90% accurate” signal
Let’s nail the numbers from the natural-frequency walk above, with the arithmetic laid bare.
The setup.
- Base rate of a real edge: .
- Sensitivity: .
- False-positive rate: .
Count out of 1000 signals.
| Group | Count | Fires? | Number that fire |
|---|---|---|---|
| Real edges | 90% of them | (true positives) | |
| Not real edges | 10% of them | (false positives) | |
| Total flagged |
The posterior.
Read that and let it sting: a signal everyone would call “90% accurate” is, when it fires, wrong about the edge roughly two times out of three. The 90% sensitivity was real; it just answered a question — “how many real edges do I catch?” — that nobody’s P&L was asking. The question your money asks — “given a firing, is it real?” — comes back 32%, because the 950 edge-less days threw off 95 false alarms, and 95 is more than double the 45 true ones.
Plugging into the formula confirms the count-based answer exactly:
Watch the posterior collapse
The grid below is this example, made of 1000 little squares. Brand-blue squares are real edges the signal caught (true positives); the villainous accent squares are false alarms (false positives). The badge up top is P(real given flagged) — the posterior — computed live as TP / (TP + FP).
Now do the experiment that teaches the whole lesson: drag the base-rate slider DOWN toward 1% and watch the posterior collapse even though you never touched the sensitivity or the false-positive rate. The detector didn’t get worse — the world just got rarer, and a rarer prior means almost every firing is a false alarm. Then drag the base rate up and watch the posterior climb. Same test, opposite verdicts, decided entirely by the base rate.
- Real edge, flagged
- 45
- No edge, flagged (false alarm)
- 95
- P(real edge | flagged)
- 32.1%
signals: 1,000; flagged: 140; truly real: 50.
Of 1000 signals at a 5% base rate, 45 are real edges that fire and 95 are false alarms — so only 45 of 140 flagged signals are real, about 32%. Drag the base rate down toward 1% and the posterior collapses toward single digits, even though the detector's sensitivity and false-alarm rate never changed.
Compute it. Base rate of a real edge is 5%, sensitivity is 90%, false-positive rate is 10%. Out of 1000 signals, what is P(real edge given the signal fired)?
Same test, different prior: the posterior swings
The posterior is not a property of the test — it’s a property of the test times the world. Change only the base rate and the conclusion can flip from “ignore it” to “act on it.” Hold the signal fixed (sensitivity 90%, false-positive rate 10%) and compare two worlds: edges rare (5%) versus edges common (30%).
| Quantity | Base rate 5% | Base rate 30% |
|---|---|---|
| Real edges (of 1000) | 50 | 300 |
| Non-edges (of 1000) | 950 | 700 |
| True positives () | 45 | 270 |
| False positives () | 95 | 70 |
| Total flagged | 140 | 340 |
| P(edge given fire) |
Same detector, untouched. In the rare world a firing is 32% likely to be real — mostly noise, ignore it. In the common world the identical firing is 79% likely to be real — worth acting on. The conclusion more than doubled, and nothing about the test changed. This is why “is the signal good?” is an incomplete question: a signal is only as trustworthy as the base rate it’s hunting in. Hunt for rare edges and even a sharp signal mostly lies; hunt where edges are plentiful and the same signal becomes reliable.
Spot the trap. A quant says: 'My pattern detector is right 85% of the time it fires in my backtest, so live it should flag a real edge about 85% of the time.' What is the flaw?
P(D|H) or P(H|D)? Sort the statements
The fastest way to inoculate yourself against the prosecutor’s fallacy is to drill which conditional a sentence is actually stating. Each statement below is either a likelihood P(D given H) — a property of the test, “given the truth, how does the data behave?” — or a posterior P(H given D) — what you actually want, “given the data, what’s the truth?”
Which conditional is each statement? Sort into P(data | hypothesis) — a likelihood, a property of the test — versus P(hypothesis | data) — the posterior you actually want.
Place each item in the right group.
- A guilty match occurs in 99.9% of true-culprit cases
- Given the signal fired, there is a 32% chance today has a real edge
- Given the DNA matched, the chance the suspect is the culprit is 1 in 11
- The false-positive rate is 10%: the signal fires on 10% of edge-less days
- The signal fires on 90% of days that truly have an edge
- Given the strategy passed the backtest, the chance it has a real live edge is 20%
Misconceptions that cost real money
Misconception 1 — ignoring the base rate entirely. The headline error: quoting sensitivity (“90% accurate!”) and treating it as the chance a firing is real. It forgets the 950 edge-less days that throw off false alarms. Always demand the prior.
Misconception 2 — treating “test accuracy” as the answer. “Accuracy” is a slippery word. A signal that never fires is “95% accurate” when edges are 5% rare — it’s right on every quiet day. Accuracy bundles together two conditionals you need separated (sensitivity and specificity) and still tells you nothing about P(edge given fire) without the base rate. Ask for sensitivity, false-positive rate, and the prior — never a single “accuracy” number.
Misconception 3 — double-counting correlated signals. Bayes’ rule multiplies in independent evidence. Stack three signals that all secretly read the same momentum factor and you’ll multiply their likelihoods as if you had three independent witnesses — when really you have one witness shouting three times. The posterior balloons toward false confidence. Genuinely independent confirmations are gold; correlated ones are the same evidence wearing disguises.
Misconception 4 — “the p-value is the probability the strategy is junk.” A backtest p-value is — a likelihood, conditioned on the null. It is not , the posterior you actually want. Flipping them is the inversion fallacy in a lab coat. To get the posterior you’d need the prior odds that a randomly tried strategy has an edge — usually grim — which is exactly why a “significant” backtest so often dies live.
How to not get fooled
A three-part field kit for the next time someone waves a flashy signal at you:
- Always ask for the base rate. “How often is this true before the signal?” If they can’t tell you the prior, they can’t tell you the posterior — full stop. A hit rate without a base rate is half a fraction.
- Reason in counts, not percentages. Translate every claim into “of 1000…” and physically sort the crowd into true positives, false positives, and the rest. The base rate becomes a box you can’t misplace, and the prosecutor’s fallacy becomes visibly absurd.
- Beware multiple testing and data mining. Test 1000 random signals at a 5%-significance threshold and roughly 50 will look “significant” by pure luck — a pile of false positives manufactured by the search itself. The more signals you try, the lower the prior that any survivor is real, and the harder the posterior collapses. The cure is honest accounting: track how many hypotheses you tried, demand out-of-sample confirmation, and treat a single dredged-up backtest with the suspicion it deserves.
Big picture
Bayes' rule & base rates — the whole picture
- Bayes' Rule & Base Rates
- The formula
- P(H|D) = P(D|H) P(H) / P(D)
- P(D) = P(D|H)P(H) + P(D|¬H)P(¬H)
- Posterior, likelihood, prior, marginal
- Inversion fallacy
- P(D|H) is NOT P(H|D)
- Prosecutor's fallacy
- 90% sensitivity is not 90% real
- Base rates
- A rare prior drowns the posterior in false alarms
- Natural frequencies: "of 1000…"
- Same test, different prior, different verdict
- The worked case
- 5% base, 90% sens, 10% FPR
- 45 true vs 95 false firings
- P(edge | fire) = 45/140 ≈ 32%
- How not to get fooled
- Always ask for the base rate
- Reason in counts
- Beware multiple testing / data mining
- p-value is not P(strategy junk)
- The formula
Putting it together
Bayes’ theorem, , converts the conditional you can measure — the likelihood , your signal’s sensitivity — into the one you actually need — the posterior , the chance a firing is real. The bridge between them is the base rate , and forgetting it is the inversion fallacy (a.k.a. the prosecutor’s fallacy): “90% of edges fire” is not “a firing is 90% an edge.” When edges are rare, the marginal fills up with false alarms, and even a 90%-sensitive signal can be right only 32% of the time — wrong about the edge two tries in three. The antidote is natural-frequency reasoning: sort 1000 events into true and false positives, where the base rate is a box you can’t lose. Always ask for the prior, always reason in counts, and always treat a flashy backtest — born from a search over many signals — as the false positive it most likely is.
Recap: Bayes' rule & base rates
In Bayes’ rule P(H|D) = P(D|H)P(H)/P(D), which term is the prior and which is the posterior?
Check your answer to continue.
Next up, we leave detectors behind and turn Bayes into a continuous dial. When the evidence arrives bit by bit and the hypotheses live on a spectrum rather than a true/false switch, we’ll meet conjugate priors — the elegant trick that lets you update a belief with a pencil instead of an integral — and watch a prior distribution sharpen into a posterior as the data rolls in.