The conditional probabilities that are easy to state run from cause to observation, and the ones people actually want run the other way. This lesson derives the formula that turns one into the other, applies it to a real screening test where the honest answer is startling, and shows why the result is so consistently misjudged, including by the professionals who depend on it.
Turning the conditional around
The previous lesson defined , and the intersection can be expanded in either order:
Set the two right-hand sides equal and divide by , which is legitimate whenever :
That is Bayes' theorem, published posthumously in 1763 from an essay by Thomas Bayes and given its general form by Laplace in 1774. The derivation is two lines of algebra with no new assumption, which is worth stressing: nothing about the theorem is contentious. What is contentious is what people are willing to put into it.
The names for the pieces carry the meaning. Write for a hypothesis and for the evidence. Then is the prior, what the hypothesis was worth before the evidence; is the likelihood, how well the hypothesis predicts the evidence; is the probability of the evidence under all hypotheses together; and is the posterior, what the hypothesis is worth after. The denominator is almost never given directly and is nearly always computed by the law of total probability. With two hypotheses, and its negation,
Every term on the right has an operational meaning, and the third one, , the chance of the same evidence when the hypothesis is false, is the term that gets left out when people reason informally. Evidence that fits your hypothesis is worthless unless it fits the alternatives worse.
A test that is right nine times in ten
David Eddy put the following to a group of physicians in 1978. Among women aged forty with no symptoms, about percent have breast cancer. Mammography detects it in percent of the women who have it, and returns a positive result for percent of the women who do not. A woman in this group has a positive mammogram. What is the probability that she has cancer?
Ninety-five of the hundred physicians answered around percent. The correct answer is
about percent, off by a factor of ten. The test is not bad; the base rate is doing the damage. Only one woman in a hundred has the disease, so the percent false positive rate is applied to ninety-nine times as many women as the percent detection rate, and it wins on volume.
Nothing about this depends on medicine. Any test for a rare condition behaves this way, and the rarer the condition the worse it gets. Screen for something present in one person in ten thousand with a test that is percent sensitive and gives percent false positives, and a positive result leaves the probability at , still under one percent. This is why mass screening for rare conditions is a hard policy problem rather than an obvious good, and why confirmatory tests exist.
Example. A drug test detects doping in percent of dopers and returns a positive for percent of clean athletes. Five percent of athletes in a sport dope. An athlete tests positive. What is the probability that they doped?
About percent, high enough to investigate and nowhere near high enough to convict on its own.
Now you. In a different sport only percent of athletes dope, with the same test. What is the probability that a positive athlete doped?
Answer
One third. The same test, the same accuracy, a base rate five times lower, and the conclusion flips from probable to unlikely.
Counting people instead of multiplying fractions
Gerd Gigerenzer showed in the 1990s that the same physicians who fail with percentages mostly succeed when the identical problem is posed in counts, and the reformulation is worth adopting permanently because it makes the answer visible without any formula.
Take women. About of them have cancer, and of those, test positive. The other do not have cancer, and of them test positive anyway. So women test positive in total, of whom have cancer:
the same answer, reached by dividing one count by another. The version with percentages hides the fact that the two groups being compared are of wildly different sizes; the version with counts puts the on the page where it cannot be forgotten. When you want to sanity-check any Bayes calculation, do it this way, with a round population and whole people.
Odds and the weight of evidence
There is a form of the theorem in which the awkward denominator disappears. Write Bayes for and for with the same evidence and divide one by the other. The cancels, leaving
In words: posterior odds equal prior odds times the likelihood ratio. Odds of against convert back to a probability by .
The likelihood ratio is the entire contribution of the evidence, and it is a property of the test alone, free of the base rate. For the mammogram it is : a positive result multiplies the odds by , whoever is tested and whatever they believed beforehand. That is the honest summary of what a test is worth, and it explains the earlier result at once. Prior odds of cancer are to , or . Multiply by to get posterior odds of , and convert: . Multiplying odds by sounds impressive and moves a probability of only to , because odds far from one are hard to shift.
Repeated independent tests multiply their likelihood ratios, which makes sequential updating trivial. Two independent positive mammograms give odds , a probability of . Three give odds and a probability of . Note also that the order of the evidence never appears in the product, so updating on then gives exactly what updating on then gives, and both equal updating on both at once. A Bayesian cannot be led anywhere by the sequencing of the evidence, only by its content.
Example. A blood test has likelihood ratio for a positive result. A patient's prior probability of the condition is . What is the posterior probability after one positive?
Prior odds are . Multiply by to get . Convert back: , so about percent.
Now you. The same patient tests positive a second time, independently. What is the probability now?
Answer
Multiply the odds by again: , giving , about percent.
Negative results and the other error
A test has two ways of being wrong, and the odds form handles the second as easily as the first. The likelihood ratio for a negative result is , which for the mammogram is . A negative multiplies the odds by , cutting them by more than a factor of four.
Starting from prior odds of to , a negative mammogram gives odds , a probability of , down from . So the test does useful work in both directions: it takes a one-in-a-hundred risk down to about one in four hundred and thirty. A likelihood ratio near , in either direction, is the signature of a test not worth doing, since it leaves the odds where it found them.
Example. For the drug test above, what is the likelihood ratio of a negative result, and what does a negative do to an athlete whose prior probability of doping was ?
The ratio is . Prior odds , so posterior odds are and the probability is , roughly one in .
Now you. A test has sensitivity and false positive rate . What are its likelihood ratios for a positive and for a negative result?
Answer
Positive: . Negative: , which is a division of the odds by about .
What the theorem cannot give you
Bayes' theorem is a rule for revising a probability. It is not a rule for having one in the first place, and the prior has to come from somewhere outside it. In the mammography problem the prior was a measured population rate, which is uncontroversial. In a courtroom, or in assessing a scientific hypothesis, there is no population to count, and the prior is a judgement. Two honest people with different priors will reach different posteriors from the same evidence, and the theorem cannot arbitrate between them.
What it does guarantee is that they converge under enough evidence. Each new independent observation multiplies both people's odds by the same likelihood ratio, so a disagreement of a factor of a hundred in the prior is erased by evidence worth a factor of a hundred, and strong evidence swamps any prior that was not dogmatic. The exception is a prior of exactly or , which multiplication can never move: certainty is not a strong opinion but an unreachable one, and this is the mathematical content of the advice to never be completely sure.
The theorem also silently assumes that the hypotheses listed are exhaustive. The denominator sums over the alternatives you thought of, so if the true explanation is not in the list, the posterior is confidently wrong. A high posterior means "best of what was considered", not "true".
So far every hypothesis and every event has been a yes-or-no affair. Most quantities of interest are not: how many defective items in a batch, how long until a component fails, how far a measurement is from its target. Attaching a number to each outcome, and asking what that number does on average, is the next step.