← All MathIsland labs
P(H|E)Bayes' Theorem Lab

The probability trap that even doctors fall into.

A 99%-accurate test comes back positive. What's the probability you actually have the disease?

How far new evidence should move your belief — Bayes' theorem.

Experiment

Hands-on experiment

Predict first — a disease with 0.1% prevalence, a 99%-accurate test, and your result is positive. Probability you're actually sick?

Run the test on 100,000 people

Read more — why it exists · insights · common mistakes · formulasExpand ▾

Why

Why does this exist?

Test results, courtroom evidence, spam words — every day we receive 'evidence' and must update our judgments. And human intuition gets this update systematically wrong.

The classic failure is base-rate neglect. Eyes lock onto the test's accuracy (99%) and forget how rare the disease itself is (0.1%). The rarer the disease, the more the positives are false.

Bayes' theorem performs the update mechanically and correctly. Prior belief × strength of evidence = posterior belief — modern AI, spam filters, and medical diagnosis all run on it.

Insight

Insights from the video

Flipping a probability has a price — and the price is the base rate.

Turning P(positive|disease)=99% into P(disease|positive) brings in the prevalence as a multiplicative factor. The number can change dramatically the moment you flip direction.

Bayes isn't an answer machine — it's an update machine.

It grants no absolute truth; it moves your current belief exactly as far as the evidence warrants. Stack enough evidence and even different priors converge to the same place.

Misconception

Common misconceptions

Positive on a 99%-accurate test means 99% chance of disease.

At 0.1% prevalence, most positives are false positives, so the real chance is about 9%. 'The test's accuracy' and 'the chance of disease given a positive' point in different directions.

Just raise the test's accuracy and the problem disappears.

Even at 99.9% accuracy, 0.1% prevalence gives only a 50% chance. As long as the prior (prevalence) is tiny, the sea of false positives remains — which is why retests exist.

Formula

Writing it as math

Write what you counted in the 100,000-person experiment as a formula and you have Bayes.

Bayes' theorem

The probability of hypothesis H after seeing evidence E. The prior P(H) sits multiplied in the numerator — why the base rate can't be ignored.

Applied to the test

The denominator's second term (healthy people's false positives) is 10x the first — the formula shows directly why most positives are false.

Odds form — the language of updating

Multiply belief (odds) by the evidence's strength (LR) and you get the new belief. Multiple pieces of evidence? Keep multiplying — exactly what a spam filter does.

In Real Life

Where you meet it in real life

Screening policy

Why mass-screening for rare diseases is done cautiously — it manufactures a sea of false positives. Retesting (adding evidence) is how the probability gets pulled up.

Spam filters

Words like 'free' and 'winner' are each a likelihood ratio. A naive Bayes filter multiplies them to update the spam probability.

DNA evidence in court

'A one-in-a-million match' is NOT 'a one-in-a-million chance of innocence' — you must multiply by the prior over possible suspects.

AI inference

A self-driving car updating 'probability that's a pedestrian' through sensor noise is running a Bayes filter.

Try Yourself

Test yourself

Q1If the disease's prevalence were 10%, roughly what would a positive on the same 99% test mean?Show answer ▾

About 92%. Of 100,000 people: 10,000 sick → 9,900 true positives; 90,000 healthy → 900 false positives. 9,900/10,800 ≈ 92%. Higher prevalence makes the same test trustworthy — a doctor ordering the test at all is itself an act that raises the prior.

Q2After one positive, an independent retest also comes back positive. Now what?Show answer ▾

Take 9% as the new prior and update again — it jumps to about 91%. Stacking evidence multiplies the odds by the likelihood ratio repeatedly. The mathematical reason retests exist.

Q3The forecast said '70% chance of rain', you took an umbrella, and it didn't rain. Was the forecast wrong?Show answer ▾

No — 70% is a statement that includes a 30% 'no rain'. Forecast quality is judged not by one day but by calibration: of the days it said 70%, did it rain about 70% of the time? A core habit of Bayesian thinking.

Try answering yourself before revealing it — getting it wrong is where learning starts.

Connection

Concepts connect

Previous concept

P(A|B)

Conditional Probability

You must be able to read P(A|B) before the formula that flips it can mean anything.

← Conditional Probability lab

Leads to next

E(X)

Expected Value

Belief updated — now decide. The next tool multiplies each option's probability by its value and puts them on one scale: expected value.

Go to the Expected Value lab →

Related

Labs worth exploring together

Related lab

P(A|B)

Conditional Probability

Bayes' raw material — build the sense of conditions changing denominators first, and this formula feels natural.

Go to the Conditional Probability lab →