Bayes' theorem and medical tests:
what a positive result really tells you
Test accuracy and the probability that you are actually ill after a positive are different numbers. Counting 10,000 people makes the gap obvious.
Calcylator Editorial Team
Updated · 4 min read
The puzzle that surprises almost everyone
A screening test catches 90% of people who have a condition and wrongly flags 5% of people who do not. One person in a hundred has the condition. You test positive. What is the probability you actually have it? Most people say something near 90%. The correct answer is about 15%.
The mistake is to confuse two different conditional probabilities: the chance of a positive result given disease, and the chance of disease given a positive result. They share the same words in a different order and have very different values when the condition is rare. Bayes' theorem is the rule that converts one into the other.
Medical examples dominate textbooks because the stakes make the lesson stick, but nothing about the arithmetic is specific to health. The same two-by-two table of true and false alarms sits behind every question of the form: given that an alarm sounded, how likely is a real event? Learning to draw that table, with a bold row for the people who are actually affected, is worth more than memorising the symbolic formula.
The theorem written for a test
- sensitivity:
- P(positive | disease), the share of sick people the test catches
- prevalence:
- share of the tested group that has the condition
- false positive rate:
- P(positive | no disease)
The top line counts the sick people who test positive. The bottom line counts every positive, whether true or false. The ratio is therefore the share of positives that are real. Nothing in this expression is mysterious; it is a head-count in disguise, and the next section does exactly that count.
It also helps to name the pieces. The prevalence is the prior, the chance before any test. The sensitivity and false positive rate are the likelihoods of the evidence under each hypothesis. The answer is the posterior, the updated chance once the evidence is in. Those labels recur in every statistics course, so the example serves as a template.
Worked example: counting 10,000 people
Picture 10,000 people with a prevalence of 1%. That means 100 have the condition and 9,900 do not.
Sick people
10,000 × 1% = 100
True positives
100 × 0.90 = 90
Healthy people
9,900
False positives
9,900 × 0.05 = 495
All positives
90 + 495 = 585
Probability of disease given positive
90 ÷ 585 ≈ 15.4%
Formula check: 0.009 ÷ (0.009 + 0.0495) = 0.1538.
Of 585 people who test positive, 495 are healthy and only 90 are ill. The false positives swamp the true ones, because a small error rate applied to a huge healthy group produces more people than a high detection rate applied to a tiny sick group.
How strongly prevalence drives the result
| Prevalence | True positives (per 10,000) | False positives | Chance of disease given positive |
|---|---|---|---|
| 0.1% | 9 | ≈ 500 | 1.8% |
| 1% | 90 | 495 | 15.4% |
| 10% | 900 | 450 | 66.7% |
| 30% | 2,700 | 350 | 88.5% |
The same test, applied to a group in which the condition is common, becomes far more informative. That is why a doctor who sees a patient with symptoms, and therefore a higher pre-test probability, reads a positive differently from a result produced by population screening.
This is also the logic behind confirmatory testing. A second, independent test applied only to people who tested positive starts from a prevalence of 15%, not 1%. If the two tests were truly independent, a second positive would raise the probability to roughly 77%. Real tests often share causes of error, so the true figure is usually lower.
Notice also that the table holds sensitivity and the false positive rate constant while prevalence moves, which is a simplification. In practice, a test's error rates can differ between a general population and patients with advanced disease, so the figures in any real table need to come from studies of a population like the one being tested.
The odds form, and what a negative result says
Some people find a second way of writing the rule easier. Start with the prior odds, 1 sick to 99 healthy, which is about 0.0101. Multiply by the likelihood ratio, the sensitivity divided by the false positive rate, 0.90 ÷ 0.05 = 18. The posterior odds are 0.0101 × 18 = 0.1818, which is 0.1818 ÷ 1.1818 = 15.4% as a probability. A positive result multiplies the odds by 18, but when the starting odds are tiny, even an 18-fold boost leaves them modest.
The negative result deserves the same care. Among the 9,900 healthy people, 9,405 test negative (9,900 − 495), and among the 100 sick, 10 test negative (100 × 0.10). Those figures give 9,405 of 9,415 negatives who are truly healthy, which is 99.9%. A negative is far more reassuring than a positive is alarming, because the condition is rare and most people have nothing wrong.
This asymmetry is why screening programmes follow a positive with a more specific second test before anything is concluded, and why a single positive from a rare-condition screen is treated as a prompt for further checking, not as a diagnosis.
Beyond medicine
- Spam filters, where most mail is legitimate and a small misclassification rate can flag many harmless messages.
- Fraud detection, where genuine transactions greatly outnumber fraudulent ones.
- Airport and security screening, where the threat is extremely rare.
- Quality control, where a defective item is the unusual case.
In all of these the rare event is the base rate, and ignoring it is called the base-rate fallacy. The cure is always the same: begin with how common the event is, then update with the test's detection and false-alarm rates.
Limits and care when using it
The inputs are rarely exact. Sensitivity and false positive rates vary between populations and between laboratories, and prevalence depends on who is being tested. Treat the output as an illustration of reasoning, not as a personal diagnosis.
Results from a real test must be read by a qualified clinician who knows the patient's history, symptoms and the performance of the particular test used. The numbers here are teaching values. A simple probability tool can handle the counting of favourable outcomes out of a total, but it does not apply Bayes' rule itself; for that, use the formula above or the frequency table.
Common questions
What is Bayes' theorem in simple terms?
It updates the probability of something after you see new evidence. For a test, it gives the chance of disease given a positive by weighing true positives against all positives. With sensitivity 0.9, prevalence 0.01 and false positive rate 0.05, the answer is about 15.4%.
Why is the probability of disease low even with a positive result?
Because when the condition is rare, healthy people vastly outnumber sick ones, so even a small false positive rate produces many more false alarms than true detections. In 10,000 people at 1% prevalence, 495 false positives compare with 90 true ones.
What is positive predictive value?
It is the share of positive results that are true positives, which equals the probability of disease given a positive test. It depends on prevalence as well as on sensitivity and the false positive rate, so the same test has different values in different groups.
What is the difference between sensitivity and positive predictive value?
Sensitivity is the share of sick people the test detects, a property of the test. Positive predictive value is the share of positives that are truly sick, which also depends on how common the condition is. Mixing them up causes the classic error.
Can I use this to interpret my own test result?
It can help you understand the reasoning, but not to diagnose yourself. Real sensitivity, false positive rate and your own pre-test probability are rarely known precisely. Ask a clinician, who can interpret the result with your history and any confirmatory tests.
Was this guide helpful?
Continue reading
View all blogsMargin of Error: Why a 1,000-Person Poll Is ±3.1 Points
For a proportion, margin of error is z × √(p(1−p)/n). With n = 1,000 and p = 50 percent at 95 percent confidence it is ±3.1 points. Steps and traps.
4 min read
Odds to Probability: Convert 3:1, 2.5 and More
Odds of 3 to 1 against are a 25% chance, 3 to 2 in favour is 60%, and decimal 2.50 is 40%. Convert any odds format with one short rule.
5 min read
What a P-Value Is, and What It Is Not
A p-value is the chance of a result at least this extreme if the null hypothesis is true. A two-sided z of 1.96 gives p ≈ 0.050; here is how to read it.
5 min read




