Interactive guide
Same picture, two directions, and they're not the same number
A medical test is 92% sensitive: given someone has the disease, it catches them 92% of the time. That is not the same claim as "given a positive result, they have the disease 92% of the time." Confusing those two directions is the single most common mistake in applied probability. This page exists to make the difference impossible to un-see.
One box, split twice
Picture the whole population as one square. Split it left/right by disease status: the left slice's width is the prevalence, how rare or common the disease actually is. Now split each side up/down by test result: the disease side splits by sensitivity, the healthy side splits by the false-positive rate.
Conditional probability is just: pick one slice of that box, throw away everything outside it, and ask what fraction of what's left has some other property. "Given disease, what fraction tested positive?" is one slice. "Given a positive test, what fraction actually have the disease?" is a completely different slice: same box, cut the other way.
Bayes' theorem is nothing more than the formula for that second slice, built entirely out of numbers from the first one. It exists because the first direction is usually what you're given, and the second direction is usually what you actually want to know.
The four pieces of the box
-
1
Prevalence: P(Disease)
How wide the "Disease" column is. Usually small; most people don't have any given disease.
-
2
Sensitivity: P(+ | Disease)
Of the Disease column, how much is "Positive" at the top. The test's ability to catch real cases.
-
3
Specificity: P(− | No Disease)
Of the No-Disease column, how much is "Negative." High specificity keeps the false-positive sliver small.
-
4
PPV: P(Disease | +)
Collect every "Positive" piece from both columns, then ask what share of that combined slice is real disease.
Pick what you're conditioning on; everything outside that slice fades out.
disease, positive disease, negative no disease, positive no disease, negative
—
- P(? | ?)
- —
The same box, always sliced on "tested positive": the direction Bayes' theorem computes.
Both "Positive" pieces (outlined), one from each column. Bayes' theorem asks what share of that combined outline is the blue piece.
Bayes' theorem
P(D|+) = [ P(+|D)·P(D) ] / [ P(+|D)·P(D) + P(+|¬D)·P(¬D) ]
Plugged in
- Sensitivity P(+|D): the "easy" direction
- —
- PPV P(D|+): the "hard" direction
- —
—
Try the Rare disease, accurate test preset: a test that's 99% sensitive and 99% specific sounds nearly perfect. But at 1% prevalence, P(Disease | Positive) is exactly 50% , a coin flip. The test isn't broken; there are just so many more healthy people than sick ones that even a tiny 1% false-positive rate among them produces as many false alarms as true detections among the rare sick group. This is why real screening programs always follow a positive result with a second, more specific test before treating it as a diagnosis.
The jargons
Sensitivity and specificity describe the test in isolation; PPV describes what a positive result actually means for the person who got it. Prevalence is the hidden variable connecting the two, and Bayes’ theorem is the formula that connects them properly.
The probability of A once you already know B happened. Restrict to the world where B is true, then ask what fraction of that world also has A.
P(Disease): how common the condition is in the whole population, before any test is run.
P(+ | Disease): the chance a test catches someone who actually has the disease.
P(− | No Disease): the chance a test correctly clears someone who's actually healthy. 1 − specificity is the false-positive rate.
P(Disease | +): given a positive result, the chance it's real. Not fixed by the test alone; it swings with prevalence.
The formula for flipping a conditional probability: turning P(+|D), which the test gives you directly, into P(D|+), which is what you actually want to know.
Ignoring prevalence and treating sensitivity as if it were PPV: the exact mistake that makes a 99%-accurate test on a rare disease feel far more conclusive than it is.