Bayes' Theorem — How Evidence Updates Belief
PlayHow new evidence changes what you believe
Imagine 10,000 People
Start with 10,000 people. The big square is the whole group. The 'Prevalence P(Disease)' slider controls the width of the left strip, the people who have the disease; everyone in the wider right strip is healthy. At 1% prevalence the left strip holds just 100 people.
Test Accuracy
Each strip now splits by test result. Sensitivity is the share of sick people the test catches (green, true positives); the yellow rest are missed. Specificity is the share of healthy people it correctly clears (blue); the red slice are false alarms. Drag the 'Sensitivity P(Pos|Disease)' slider and watch the green cell grow.
The Surprising Result
Only the positive tests matter now: the bright green and red cells along the top. With 1% prevalence and a 99%-accurate test, 99 sick people test positive and so do 99 healthy ones. A positive means disease only about half the time, because the huge healthy group makes as many false alarms as the tiny sick group makes true signals.
Bayes' Formula Revealed
P(A|B) = P(B|A)·P(A) / P(B). Every piece is an area on the canvas: P(A) is the width of the left strip (the prior), P(B|A) is the green share of that strip (the sensitivity), and P(B) is all the positive area, green plus red. The posterior is simply green divided by green plus red.
Worked Example: Testing Twice
Press 'Classic Example', keep 'Positive result' selected, then press 'Test again'. The first positive turns a 1% prior into 99 ÷ 198 = 50%. That 50% becomes the new prior and the divider slides to the middle: of 10,000 people, 5,000 are now sick, a second independent test flags 4,950 of them and only 50 healthy people, so belief jumps to 4,950 ÷ 5,000 = 99%.
What a Negative Result Tells You
Press 'Negative result' to condition on the bottom cells instead. Now ask how many negatives are actually sick: yellow divided by yellow plus blue. At 1% prevalence that is 1 in 9,802, about 0.010%. A negative from a good test is very reassuring precisely because the disease was rare to begin with — the same base rate that weakened the positive.
How It Works — Step by Step
-
1
Imagine 10,000 People
Start with 10,000 people. The big square is the whole group. The 'Prevalence P(Disease)' slider controls the width of the left strip, the people who have the disease; everyone in the wider right strip is healthy. At 1% prevalence the left strip holds just 100 people.
-
2
Test Accuracy
Each strip now splits by test result. Sensitivity is the share of sick people the test catches (green, true positives); the yellow rest are missed. Specificity is the share of healthy people it correctly clears (blue); the red slice are false alarms. Drag the 'Sensitivity P(Pos|Disease)' slider and watch the green cell grow.
-
3
The Surprising Result
Only the positive tests matter now: the bright green and red cells along the top. With 1% prevalence and a 99%-accurate test, 99 sick people test positive and so do 99 healthy ones. A positive means disease only about half the time, because the huge healthy group makes as many false alarms as the tiny sick group makes true signals.
-
4
Bayes' Formula Revealed
P(A|B) = P(B|A)·P(A) / P(B). Every piece is an area on the canvas: P(A) is the width of the left strip (the prior), P(B|A) is the green share of that strip (the sensitivity), and P(B) is all the positive area, green plus red. The posterior is simply green divided by green plus red.
-
5
Worked Example: Testing Twice
Press 'Classic Example', keep 'Positive result' selected, then press 'Test again'. The first positive turns a 1% prior into 99 ÷ 198 = 50%. That 50% becomes the new prior and the divider slides to the middle: of 10,000 people, 5,000 are now sick, a second independent test flags 4,950 of them and only 50 healthy people, so belief jumps to 4,950 ÷ 5,000 = 99%.
-
6
What a Negative Result Tells You
Press 'Negative result' to condition on the bottom cells instead. Now ask how many negatives are actually sick: yellow divided by yellow plus blue. At 1% prevalence that is 1 in 9,802, about 0.010%. A negative from a good test is very reassuring precisely because the disease was rare to begin with — the same base rate that weakened the positive.
Key Takeaways
Prior Probability Matters Enormously
A rare disease stays unlikely even after a positive test. The base rate (prevalence) dominates the posterior when the condition is uncommon.
Bayes Updates Belief With Evidence
Bayes' theorem is the mathematically correct way to update your belief when you receive new evidence. Start with a prior, observe data, compute the posterior.
Today's Posterior Is Tomorrow's Prior
Evidence accumulates: each independent result updates the previous answer. Two positives on a 99%-accurate test take a 1% prior to 50%, then to 99%.
False Positives Dominate at Low Prevalence
When prevalence is low, the false positives from the large healthy group can outnumber the true positives from the small sick group, while a negative result becomes even more reassuring.
Connected Concepts
Probability Trees
Draw the same 10,000 people as branches: disease first, then test result. Bayes reads the tree backwards.
Normal Distribution
The bell curve — the most important probability distribution, and the foundation for many Bayesian priors.
Binomial Distribution
Counting successes in repeated trials — the likelihood function in many Bayesian problems.
Hypothesis Testing
False positives and false negatives reappear as Type I and Type II errors when you decide with data.
Monty Hall Problem
The host opening a door is evidence; Bayes explains why switching doubles your chances.
Simpson’s Paradox
Conditioning on the right variable can reverse a pooled conclusion, the same care about what you condition on that Bayes’ theorem demands.
Updated
- — New connection to Simpson’s Paradox, where conditioning on a group reverses the totals.
- — The diagram now builds up slowly enough to read each step, and its pace follows the speed slider.
- — New positive/negative result toggle and "Test again" chaining, plus a worked example of testing twice.