What Bayes’ theorem does
Bayes’ theorem updates a probability when new evidence arrives: P(A | B) = P(B | A) × P(A) / P(B). In words, how likely A is after seeing B depends on how common A was to begin with and on how well B separates A from not-A. The reasoning is explained step by step in Bayes’ theorem explained.
Worked example: a medical test
A condition affects 1% of people. A test detects 90% of true cases and is negative for 95% of healthy people. Someone tests positive. Out of 10,000 people, 100 have the condition and 90 of them test positive, while 495 of the 9,900 healthy people also test positive. So only 90 of 585 positives are real: 15.4%. A second independent positive raises this to 76.6%. If the condition affected 10% of people instead, a single positive would already mean 66.7%.
Using it for other problems
The same structure fits spam filters (A = spam, B = contains a certain word), quality control (A = faulty part, B = fails an inspection) and diagnostic checks of any kind. Enter how common A is, how often the evidence appears when A is true, and how often it stays absent when A is false.
For combining probabilities more generally, use the probability calculator.
Frequently asked questions
What is the formula for Bayes' theorem?
P(A | B) = P(B | A) x P(A) / P(B), where P(B) = P(B | A) x P(A) + P(B | not A) x P(not A).
Why is a positive test often wrong for a rare disease?
Because healthy people vastly outnumber sick people. Even a small false-positive rate among many healthy people can produce more false positives than there are true cases.
What is the difference between sensitivity and P(disease | positive)?
Sensitivity is the chance of a positive test if you have the disease. P(disease | positive) is the chance you have the disease if you test positive. They can be very different, and confusing them is called the base rate fallacy.
What does the second-positive figure assume?
That the two test results are independent given the true condition. Repeating the same test on the same sample may not be independent, so the real figure can be lower.