Probability, lesson 4
Bayes' rule
Turning a test result into what you actually want to know.
A test is described by how often it's positive for people who have a condition. You want the reverse: how likely someone is to have it, given a positive. This lesson turns one into the other, using P(A | B) and splitting into cases from the last lesson.
By the end, you can:
Part 1. A positive test
Find what a positive test means by counting a crowd.
Guess first
A condition affects 1 person in 100. A test for it is positive for 90% of people who have it, and for 9% of people who don't. Someone tests positive. How likely are they to have it?
90% is how often the test catches a real case. The question asks something else: of everyone who tests positive, how many have the condition? Counts of people show it.
Example 1.1
A positive test, in people
1 person in 100 has a condition. A test is positive for 90% of people who have it and for 9% of people who don't. Picture 10,000 people taking it. What share of the positives have the condition?
- Split the crowd10,000 × 1% = 100
100 people have the condition, and the other 9,900 don't.
- Positives who have it100 × 90% = 90
The test catches 90 of the 100 real cases.
- Positives who don't9,900 × 9% = 891
False alarms. A small rate on a big group is a lot of people.
- All the positives90 + 891 = 981
Everyone who gets a positive result.
- Share who have it90 / 981 ≈ 0.092
Only these 90 of the positives are real cases.
AnswerAbout 9%, not 90%.
Why so low? The test runs on everyone, and people without the condition outnumber people with it 99 to 1. A 9% false alarm rate on 9,900 people makes 891 positives. A 90% hit rate on 100 people makes only 90, even though the rate is ten times higher.
Base rate, prior and posterior
How common something is before you see any evidence is its base rate, also called the prior: here 1%. The chance after the evidence is the posterior: here about 9%. Answering 90% leaves the base rate out, a mistake called base rate neglect.
P(has it | positive) = true positives / all positives
This is the last lesson's trap again, at higher stakes. P(positive | has it) = 90% and P(has it | positive) = 9% count the same 90 people over different bottoms: the 100 who have it, or the 981 who test positive. Tests are described by the first. The person holding the result needs the second.
Your turn
The same test is used where 1 person in 1,000 has the condition. A positive now means a chance of about:
Part 2. Bayes' rule
Turn P(B | A) into P(A | B) with Bayes' rule.
Keep going with Pro
You've done the first part. Pro opens the rest of this lesson, and every other one.
- Bayes' rule
- Evidence that keeps coming
Probability overviewSpotted a mistake? Tell us.