Bayes' Theorem as Areas

Category: Probability   Level: 301

P(D | +) = P(D)P(+ | D) / (P(D)P(+ | D) + P(H)P(+ | H))

Draw all possibilities as a square of area 1. Split it into sick and healthy, then split each part by test result. The answer is one slice of positive area over all of it.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Draw everyone as a square

The whole square has area 1: every person, every outcome.

total area = 1

Step 1: Draw everyone as a square

Step 2: Split by disease

A thin strip on the left stands for the 1% who are sick. It is drawn wider than true scale so you can see it at all.

P(D) = 0.01; P(H) = 0.99

Step 2: Split by disease

Step 3: Split each part by the test

In the sick strip, 90% of the height tests positive. In the healthy part, only 9% does. Positive area is shaded.

P(+ | D) = 0.90; P(+ | H) = 0.09

Step 3: Split each part by the test

Step 4: Compute the two positive areas

Each area is a width times a height. The purple area is about ten times the red one, even though it looks thin.

0.01 × 0.90 = 0.0090, 0.99 × 0.09 = 0.0891

Step 4: Compute the two positive areas

Step 5: Take the sick share of the positive area

Given a positive test, you are somewhere in the shaded area. The red part is your chance of being sick.

0.0090 / (0.0090 + 0.0891) ≈ 0.092

Step 5: Take the sick share of the positive area

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render bayes-area-square --out /tmp/bayes-area-square

Source: svgmath/diagrams/probability.py