A health camp has come to a school in Bhaktapur, and every student in the hall is being checked for a rare condition. (It is made up, so that we can choose easy numbers; real tests come later.) One person in every 1,000 has it. The test is good: it says “positive” to 99 of every 100 people who have the condition, and it wrongly says “positive” to only 1 of every 100 who don’t. The poster on the wall calls it “99% accurate”.
Pasang’s slip comes back marked positive. His friends go quiet. Ninety-nine percent accurate, and it says yes: surely he has it?
Before you read on, make your guess. Then the next section lets you count.
Guess first. Pasang has tested positive. What is the chance that he really has the condition?
Pick an answer to see why.
Count the people
Chances are hard to picture; people are easy. So think of a whole crowd.
In a crowd of 1,000 people, about 1 has the condition, and the test almost surely catches them. The other 999 are healthy, and 1 in 100 of them gets a false alarm: about 10 people. So about 11 people are ringed, and only 1 of them has it. A positive result puts you in that ringed group, and in that group the chance of having the condition is about 1 in 11.
A crowd of 1,000 is too small for exact counts (a test can’t catch 0.99 of a person), so take 100,000 people, where every count comes out whole. This is a tree diagram, as in Grade 10, but with the number of people on each branch instead of the probability: these numbers are called natural frequencies, or expected frequencies.
Read the bottom row of Figure 14.1. Everyone who tests positive is in one of the two tinted boxes: 99 people who have the condition and 999 who don’t. So
about 9%. Pasang is far more likely to be one of the 999 than one of the 99.
Nothing is wrong with the test: it gives the right answer to 99,000 of the 100,000 people. But almost all of the 1,000 it is wrong about are healthy people with a false alarm, because healthy people are 999 in every 1,000 of the crowd.
In the tree, which number decides most of the answer?
Pick an answer to see why.
Two questions that sound alike
Here is the whole trick in one line. “The test is 99% accurate” answers one question, and Pasang is asking a different one:
- Of the people who have the condition, how many test positive? 99%.
- Of the people who test positive, how many have the condition? 9%.
The two questions use the same words in a different order, and their answers are eleven times apart. In the notation of probability, a vertical bar is read “given”: is the chance of A given that B has happened, a conditional probability. Then the two questions are
Mixing them up, by forgetting how rare the condition is (its base rate), is so common that it has a name: the base rate fallacy.
You already know these two questions are different when the words are everyday ones. Almost everyone who lives in Bhaktapur is Nepali: is nearly 1. But only a small share of Nepalis live in Bhaktapur: is small. Nobody mixes those up. A test result hides the same difference behind numbers that sound medical.
Reading it from a table
Results like these are often written as a two-way table: one way across for the condition, the other for the test. Here is a different test, for a condition that 1 in 100 people have; it catches 90% of them, and gives false alarms to 5% of the rest. For 10,000 people:
| Test positive | Test negative | Total | |
|---|---|---|---|
| Has it | 90 | 10 | 100 |
| Doesn’t | 495 | 9,405 | 9,900 |
| Total | 585 | 9,415 | 10,000 |
Each conditional probability is a share of one row or one column. Given that a person has it, you are in the first row, so . Given a positive result, you are in the first column, so . Same corner cell, 90 people, divided by a different total.
That is the general rule. Out of everyone for whom B happens, what share also has A?
With the table’s numbers, : the 10,000s cancel, leaving 90 ÷ 585 again. Counting people and the formula are the same calculation.
The table also shows that having the condition and testing positive are not independent events. Over everyone, P(has it) = 100 ÷ 10{,}000 = 1%; among the positives it is 15%. Two events are independent when knowing that one has happened doesn’t change the chance of the other, , as in Grade 10. A test is worth taking only because its result is not independent of the condition.
In the table above, what is ?
Pick an answer to see why.
Bayes’ rule
The tree and the table did everything by counting. Write the same counting with letters and you get a formula that works for any test. Call the base rate p (the share who have the condition), the share of them the test catches s, and the false alarm rate f (the share of healthy people who test positive). Out of N people,
- those who have it and test positive: Nps;
- those who don’t and test positive: N(1 − p)f.
A positive result means you are one of these, so
This is Bayes’ rule (also called Bayes’ theorem), after Thomas Bayes (below). With p = 0.001, s = 0.99, f = 0.01: , Pasang’s 9%.
In medicine the three numbers have names. The share of those with the condition whom the test catches, s, is the test’s sensitivity. The share of healthy people it correctly clears, 1 − f, is its specificity: a false alarm rate of 1% is a specificity of 99%. The base rate is the condition’s prevalence. And the answer, the chance that a positive is real, is the positive predictive value. “99% accurate” meant a sensitivity and a specificity of 99%; the positive predictive value depends on the prevalence too.
The quick way: odds
There is a way to do Bayes’ rule in your head. Instead of a chance, use odds: the number of people who have it against the number who don’t. Before the test, the odds are 1 to 999 (written 1 : 999).
Now ask how much more likely a positive result is from someone who has it than from someone who doesn’t: s ÷ f = 0.99 ÷ 0.01 = 99 times. This number, the likelihood ratio of a positive result, belongs to the test alone. A positive result multiplies the odds by it:
Why does multiplying work? Of N people, those who test positive are Nps who have it and N(1 − p)f who don’t, so the odds among the positives are
the odds before the test, p:(1 − p), with the first side multiplied by s ÷ f.
Odds of 99 to 999 are a chance of 99 ÷ (99 + 999) = 99 ÷ 1,098, the 9% again. The 99 people and 999 people are the tree’s two tinted boxes. The test multiplied the odds by 99, which is a lot; but they started at 1 to 999, so after one positive they are still about 1 to 10 against.
Who is being tested?
The last answer is worth stopping on. A positive result from one and the same test means 9% in a school hall and 92% in a clinic. The test hasn’t changed; the people have. Before you can say what a result means, you must know who was tested and how common the condition is among them.
Where 1 in 100,000 people have the condition, about a thousand false alarms come with every real case, and one positive means almost nothing (0.10%). At 1 in 100, real cases and false alarms are equal in number: an even chance. At 1 in 10 it is 92%. That is why a doctor asks about your symptoms before ordering a test: the answers change the base rate, and so what the result will mean.
A better test moves the whole curve to the left. With false alarms of 1 in 1,000 (a specificity of 99.9%), a positive in the school hall means about 50% instead of 9%. For a positive to be more likely right than wrong where 1 in 1,000 have the condition, the false alarm rate has to be a little below 1 in 1,000: the test must be at least as rare in its mistakes as the condition is in the crowd.
Test again
What happens if every positive is tested a second time? Go back to the crowd at the top of the page and press Test the positives again. Of the 1,098 positives in 100,000 people, a second positive comes for 99% of the 99 who have it (98 people) and for only 1% of the 999 false alarms (10 people). Now 98 of 108 have it: about 91%.
In odds, each independent positive multiplies by the likelihood ratio again:
| Odds (has it : doesn’t) | Chance | |
|---|---|---|
| Before any test | 1 : 999 | 0.1% |
| After one positive | 99 : 999, about 1 : 10 | 9.0% |
| After two positives | 9,801 : 999, about 10 : 1 | 90.8% |
| After three positives | 970,299 : 999, about 971 : 1 | 99.9% |
The first positive turned 1 in 1,000 into 1 in 11; the second turned that into 10 in 11. The same multiplication, ×99, did both, but it starts each time from what the last test left.
Even doctors find it hard
If this was surprising, you are in good company. In 2007 the psychologist Gerd Gigerenzer gave 160 gynecologists, doctors who need exactly this number to explain a screening result, this problem at the start of a training session: 1% of the women in a region have breast cancer; a mammogram (an X-ray screening test) is positive for 90% of those who have it, and for 9% of those who don’t. A woman tests positive. Is the chance that she has breast cancer about 81%, about 9 in 10, about 1 in 10, or about 1%?
The answer, which you can now work out, is about 1 in 10 (with Bayes’ rule, 9.2%). Most of the doctors chose 90% or 81%, their answers ran all the way from 1% to 90%, and only 21% chose the right one, fewer than would have by picking at random. Then the session taught them to turn such percentages into natural frequencies: of 1,000 women, 10 have cancer, and 9 of them test positive; of the 990 who don’t, about 89 test positive. Afterwards, 87% of them chose 1 in 10.
So the difficulty isn’t in people’s heads so much as in the way the numbers are given. Percentages of percentages are hard; people are easy to count. Gigerenzer and his colleagues report the same pattern from other studies: in one from 1978, only 18% of the doctors and medical staff asked could work out the chance that a positive result was real.
In Gigerenzer’s problem, the doctors’ favorite answers were 90% and 81%. What makes both of them wrong, whatever the working behind them?
Pick an answer to see why.
Courts and inboxes
In a courtroom the mix-up is called the prosecutor’s fallacy: reading “how likely is this evidence if the person is innocent?” as “how likely is the person to be innocent, given this evidence?”. A trace that matches only 1 person in 1,00,000 by chance sounds damning, but in a city of ten lakh about 10 other people would match it too (Question f).
In your inbox, the mix-up is avoided on purpose. In 2002 the programmer Paul Graham described a spam filter that learns, from mail a person has already sorted, how often each word turns up in spam and in other mail, and combines the words of a new message by Bayes’ rule into the chance that it is spam. In his mail, the word “guarantee” meant about a 98% chance of spam; he treated a message as spam above 90%. Graham reported that, on his own mail, his filter missed fewer than 5 in every 1,000 spams, with no good mail wrongly caught.
A story from maths
Questions
★ A condition affects 1 in 50 people. A test catches 90% of them and gives false alarms to 5% of those who don’t. About what is the chance that a positive result is real?
Pick an answer to see why.
Use the two-way table in “Reading it from a table” (10,000 people, 1 in 100 with the condition). Find P(positive), and . Say in words what the last one means.
Hint
Answer
In a fever clinic, 1 patient in 10 has a certain infection. A quick test catches 90% of infections and correctly clears 95% of patients who don’t have it. Draw a tree for 1,000 patients and find the chance that a patient with a positive result has the infection, and the chance that a patient with a negative result has it.
Hint
Answer
Half of the mail that reaches an inbox is spam. The word “lottery” appears in 20% of the spam and in 0.5% of the other mail. A new message contains “lottery”. What is the chance that it is spam? What if only 1 message in 10 were spam?
Hint
Answer
Pasang’s condition affects 1 in 1,000 people and his test catches 99% of them. The makers want a positive result to be right at least half the time. What is the largest false alarm rate they can allow? What specificity is that?
Hint
Answer
A shop buys its mangoes from three farms: 50% from farm A, 30% from farm B and 20% from farm C. Of A’s mangoes 2% are bad, of B’s 5%, and of C’s 10%. A customer finds a bad mango. Which farm is it most likely from, and with what chance?
Hint
Answer
In a city of 10,00,000 people, a crime leaves a trace that would match 1 person in 1,00,000 by chance. The police test a man picked only because he lives in the city, and his trace matches. A newspaper writes: “The chance that he is innocent is 1 in 1,00,000.” What is wrong, and what is a better estimate of the chance that he is the one, if there is no other evidence?
Hint
Answer
Where to go next
- Will Two People in Your Class Share a Birthday? Another chance that intuition gets badly wrong, worked out by the multiplication principle.
- Should You Switch Doors? A host who knows where the prize is, and a conditional probability that fooled professors.
- What Is a Game Worth on Average? Expected value, for weighing what each choice costs and gains, as in deciding whom to test.
- Can a Treatment Win in Every Group but Lose Overall? Simpson’s paradox: when who is in each group changes what the totals say.
- Is This Game Fair? (Grades 6–8) Counting equally likely outcomes to see who really has the better chance.
- Grade 10 Math: Tree diagram and Independent and dependent events, the tools this page is built on.
- Grade 12 Computing: When one kind is rare Precision, recall and the confusion matrix: the same table, for a filter.
Where these facts come from
- The gynecologists’ problem (2007, 160 gynecologists; 1%, 90%, 9%; the four answers; most answering 90% or 81%; estimates from 1% to 90%; 21% right; the natural-frequency version with 10, 9, 990 and 89; 87% right after training) and the 1978 study’s 18% (Casscells, Schoenberger and Graboys, New England Journal of Medicine 299 (1978), as these authors report it; the paper itself not opened): G. Gigerenzer, W. Gaissmaier, E. Kurz-Milcke, L. M. Schwartz and S. Woloshin, “Helping Doctors and Patients Make Sense of Health Statistics”, Psychological Science in the Public Interest 8 (2007), 53–96, read October 2026.
- WHO’s 99% positive predictive value, three consecutive reactive tests below 5% positivity, and the move from two to three: World Health Organization, Consolidated guidelines on HIV testing services for a changing epidemic, policy brief, November 2019, read October 2026.
- Sally Clark (solicitor, convicted 1999, 1 in 73 million from 1 in 8,543 squared, the Royal Statistical Society’s point about genetic or environmental factors and its words of January 2002, convictions overturned at the second appeal in January 2003, undisclosed microbiology results): Wikipedia, “Sally Clark”, read October 2026. The names base rate fallacy and prosecutor’s fallacy: Wikipedia, “Base rate fallacy”, read October 2026.
- The spam filter (August 2002, a Bayesian combination of words’ spam probabilities, “guarantee” at 0.976, the 0.9 threshold, under 5 in 1,000 spams missed with no false positives): Paul Graham, “A Plan for Spam”, read October 2026. That Bayesian filters spread after it is our summary, not his.
- Thomas Bayes (minister at Tunbridge Wells from about 1733, Fellow of the Royal Society 1742, died 1761, Price’s letter, the essay printed in 1764, Laplace accepting his results in 1781): MacTutor, “Thomas Bayes”, read October 2026. Price’s two years of editing, the reading on 23 December 1763, Laplace’s independent work of 1774 and his Théorie analytique des probabilités (1812), Stigler’s 1983 case for Nicholas Saunderson and that it is disputed, and the rule in its medical-test form: Wikipedia, “Bayes’ theorem”, read October 2026.
- Every number on this page (the crowd and the tree, 99/1,098, the table of 10,000, the 2% example, the odds table, 92% in the clinic, the base-rate curve’s values, the negative results, 49.8% and 1 in 1,009, Gigerenzer’s 9.2% and 81%, the city of ten lakh, and every answer to the questions) was computed by a script (
checks/textbooks/math-further-9-12/14/tmp/answers.py).
