Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

L2-05 · Reverse a condition with Bayes' rule

P(positive | condition) and P(condition | positive) are different numbers. To turn one into the other, count the people in an imagined group. When a condition is rare, most positive tests can be false alarms, even from a fairly good test.

Level 2 icon Level 2 · Grades 7–9 · about 45 minutes
Big idea. P(positive | condition) and P(condition | positive) are different numbers. To turn one into the other, count the people in an imagined group. When a condition is rare, most positive tests can be false alarms, even from a fairly good test.
Before this lesson. L2-04, L1-01
Grown-ups. The guide for adults is at the end of this page.

What you will learn

Story: A positive test at Maya’s school

Maya’s imagined school has 1,000 students. It runs an imagined screening test for a rare, made-up allergy. All the numbers in this story are made up. The base rate is 1 percent, so 10 have the allergy and 990 do not.

The test catches 90 percent of people who have the allergy. So 9 of the 10 test positive, and 1 is missed. The test also has a false positive rate of 9 percent. That sounds small, but 9 percent of 990 is 89.1. So about 89 without the allergy also test positive.

Leo’s friend Priya gets a positive result and panics. “The test is 90 percent right, so I almost surely have it!” Maya draws the counts. About 98 students test positive in all: the 9 true positives plus about 89 false ones. Only 9 of them have the allergy.

So P(allergy | positive) is 9 out of 98, about 9 percent. The 90 percent was a different number, P(positive | allergy). It answers the question “of the students with the allergy, how many test positive?” Priya’s question was the reverse: “of the students who test positive, how many have the allergy?”

The reason is the base rate. The 990 students without the allergy are a huge group, so even a small error rate makes many false alarms. Counting this way is Bayes’ rule in disguise. The short version is P(allergy | positive) = true positives / all positives.

Of 1,000 imagined students, the few true positives are outnumbered by false positives.

What the animation shows. A grid of 1,000 grey dots stands for the students of an imagined school, with made-up numbers. First, 10 have the allergy and turn red. Next, 9 of the 10 test positive and turn violet. Then, about 89 without the allergy also test positive, shown as amber dots scattered across the grid. Everyone with a negative test fades away. The 98 positive dots gather into one block. Only 9 out of 98 are violet, about 9 percent.

Hands-on: Grow a frequency tree

About 20 minutes.

You need:

Steps:

  1. At the top of the page, write 1,000 students. This is an imagined school with made-up numbers.

  2. Draw two branches down. Label one “has the allergy” and the other “does not”. Use the base rate of 1 percent to write 10 and 990.

  3. Under “has the allergy”, draw two branches: “positive” and “negative”. The test catches 90 percent, so write 9 and 1.

  4. Under “does not”, draw the same two branches. The false positive rate is 9 percent. Work out 9 percent of 990 and round to a whole person.

  5. Circle every positive count. Add them to find all the positives.

  6. Write P(allergy | positive) as true positives out of all positives. Change it to a percentage.

  7. Now draw a new tree with a base rate of 10 percent. Keep the same test rates. Compare the two answers.

Practice together

Redo the tree with a base rate of 10 percent. The test still catches 90 percent and has a false positive rate of 9 percent. What is P(allergy | positive)?

Check your answer

Of 1,000 students, 100 have the allergy and 900 do not. The test catches 90 of the 100. It also flags 9 percent of 900, which is 81. That makes 90 + 81 = 171 positives. So P(allergy | positive) = 90/171, about 53 percent. The test did not change. Only the base rate did.

Try it yourself

1. An imagined test (made-up numbers) is used on 1,000 people. The base rate is 2 percent. The test catches 90 percent of cases and has a false positive rate of 5 percent. Find P(condition | positive).

Check your answer

20 people have the condition and 980 do not. The test catches 18 of the 20. It also flags 5 percent of 980, which is 49. There are 18 + 49 = 67 positives, so the answer is 18/67, about 27 percent.

2. A friend says, “The test catches 90 percent of cases, so a positive means a 90 percent chance.” Which conditional probability is your friend mixing up?

Check your answer

The 90 percent is P(positive | condition). The friend wants P(condition | positive). These have different groups on the bottom, so they can be far apart. You need the base rate to get from one to the other.

Talk about it

Check yourself

1. In Maya’s imagined school, what is P(allergy | positive)?

Show the answer

C. 9 out of 98

The condition is “tested positive”, so the whole is all 98 positives. Only 9 of them have the allergy, which is 9 out of 98.

2. The base rate rises from 1 percent to 10 percent, with the same test. What happens to P(allergy | positive)?

Show the answer

A. It goes up.

With more students who have the allergy, true positives grow and false positives shrink. The answer rises from about 9 percent to about 53 percent.

3. Remember Lesson 4. In the imagined survey, 36 of the 60 instrument players like math, and 100 students like math in all. What is P(instrument | math)? (Review of L2-04)

Show the answer

B. 36 out of 100

The condition is “likes math”, so the 100 math fans are the whole. Of them, 36 play an instrument, which is 36 out of 100.

Words to know

base rate
How common something is in the whole group before any test. For example, 1 percent of students.
false positive
A test result that says “yes” for someone who does not have the condition.
natural frequencies
Counts of people, like “9 out of 98”, used in place of percentages so the groups stay easy to see.
For grown-ups: about this lesson

Why it matters. The lesson teaches Bayes’ rule through natural frequencies: a frequency tree of 1,000 people in place of the formula. Gigerenzer and Hoffrage found that natural frequency formats make this kind of reasoning much more accurate than single-event probabilities Gigerenzer & Hoffrage, 1995. Tree diagrams for conditional events follow OpenStax Barbara Illowsky and Susan Dean, 2023, and finding probabilities of compound events with trees and tables matches 7.SP.8 NGA Center and CCSSO, 2010. The numbers come from the course function bayes(0.01, 0.9, 0.09): positives are 0.0981 of the group (98.1 per 1,000), and the posterior is about 0.092. The lesson rounds 89.1 false positives to about 89, so it says 9 out of 98.

Watch for these mix-ups.

  • A test that catches 90 percent of cases gives a 90 percent chance after a positive. (That confuses P(positive | condition) with P(condition | positive); the base rate matters.)

  • A small false positive rate means few false positives. (A small rate times a huge group of people without the condition can still be many people.)

  • A positive test with a low posterior means the test is useless. (The chance rose from 1 percent to about 9 percent; a second, separate test could raise it further.)

To make it easier. Do only the 1 percent tree with the counts already filled in at the first level, and ask for the final fraction 9 out of 98.

To make it harder. Write the general formula P(A | B) = P(B | A) P(A) / P(B) and check it against the tree. Then find the base rate at which half of all positives are true, using the same test rates.

Limits. The test, the allergy and every rate here are invented. Real screening tests have rates that vary by group and setting, and real results need a doctor to interpret them. Rounding to whole people changes the answer by about 0.0001 (9/98 is 0.0918; the exact value is 0.0917).

On the computer. Grown-ups can see where this idea leads later in Lab: Bayes’ rule, written for older learners.

Sources for this guide. Gigerenzer & Hoffrage, 1995Barbara Illowsky and Susan Dean, 2023NGA Center and CCSSO, 2010

Next: L2-06 · See a reversed comparison

References
  1. Gigerenzer, G., & Hoffrage, U. (1995). How to improve Bayesian reasoning without instruction: Frequency formats. Psychological Review, 102(4), 684–704. 10.1037/0033-295X.102.4.684
  2. Barbara Illowsky and Susan Dean. (2023). 3.5 Tree and Venn Diagrams. OpenStax, Introductory Statistics 2e. https://openstax.org/books/introductory-statistics-2e/pages/3-5-tree-and-venn-diagrams
  3. NGA Center and CCSSO. (2010). Common Core State Standards for Mathematics. Common Core State Standards Initiative. https://learning.ccsso.org/wp-content/uploads/2022/11/Math_Standards1.pdf