Probabilistic Reasoning
Bayes' Theorem
Updating a prior belief with evidence to get a posterior: P(H|E) = P(E|H)·P(H) / P(E).
A screening test on 1,000 people. Each icon is 5 people: green icons are sick, grey are healthy. Icons inside the orange circle tested positive. Move the sliders and watch who ends up inside it.
Sick and positive
45 peopleHealthy but positive
95 peopleAll positives
140 peopleP(sick | positive)
32.1%Inside the orange circle there are 140 people, but only 45 of them are sick: 45 ÷ 140 ≈ 32.1%.
Why it works
Call “has the disease” A and “tests positive” B. The overlap A ∩ B can be measured from either circle:
Set the two equal and divide by P(B):
The denominator splits B into the part inside A and the part outside it:
Once you know you tested positive, the orange circle becomes your whole world. P(sick | positive) is the share of that circle taken up by green icons.
Things to try
- With the defaults (5% prevalence, 90% sensitivity, 10% false positives), only about 32% of positives are actually sick. The disease is rare, so false alarms from the large healthy group outnumber real cases.
- Raise prevalence to 30%, or drop false positives to 1%, and the green icons take over the orange circle.
- Check it by hand: (0.9 × 0.05) / (0.9 × 0.05 + 0.1 × 0.95) = 0.045 / 0.14 ≈ 0.321.
Circle areas are drawn to scale. Icons are rounded to the nearest 5 people, so very small groups may show no icon; the counts in the cards are exact.