Bayes' Theorem and Diagnostic Test Interpretation
You can interpret a positive test result by combining the test’s sensitivity and specificity with the probability of disease before the test. Bayes’ theorem gives that calculation, and a table of expected counts shows where each term comes from.
This tutorial uses an invented disease with a prevalence of one in 1,000 and an invented test with 99% sensitivity and 99% specificity. Its overall accuracy is 99%. Among positive results, the expected proportion with disease is approximately 9.02%. Both statements describe the same test in the same population.
Read conditional probability first if the notation P(A | B) is unfamiliar. The vertical bar means “given,” so the condition to its right identifies the group under consideration.
Define the probabilities
Section titled “Define the probabilities”Let D denote disease present, not D disease absent, and + a positive test result. Prevalence describes the proportion with disease in the population to which the calculation applies.
| Quantity | Definition | Value in this example |
|---|---|---|
| Prevalence | P(D) |
0.1% |
| Sensitivity | P(+ | D) |
99% |
| Specificity | P(negative | not D) |
99% |
| False positive rate | P(+ | not D) |
1% |
| Positive predictive value | P(D | +) |
To calculate |
Sensitivity asks how often the test is positive among people with disease. Positive predictive value asks how often disease is present among people with a positive result. The condition changes, and so does the denominator.
The false positive rate equals one minus specificity. Here, 1% of people without disease receive a positive result. This percentage does not describe the proportion of positive results that are false.
Construct the expected counts
Section titled “Construct the expected counts”Consider 100,000 people from the specified population. At a prevalence of one in 1,000, 100 have disease and 99,900 do not.
Among the 100 people with disease, 99% test positive. That gives 99 true positives and one false negative. Among the 99,900 people without disease, 1% test positive. That gives 999 false positives and 98,901 true negatives.

Each dot represents one positive result. The 99 filled teal dots represent people with disease. The 999 open orange dots represent people without disease.
| Test result | Disease present | Disease absent | Total |
|---|---|---|---|
| Positive | 99 | 999 | 1,098 |
| Negative | 1 | 98,901 | 98,902 |
| Total | 100 | 99,900 | 100,000 |
These are expected counts under the stated probabilities. An observed population of 100,000 would not necessarily produce these exact counts.
Once a result is positive, use the positive row. Of its 1,098 people, 99 have disease.
Positive predictive value = true positives / all positive results = 99 / (99 + 999) = 99 / 1,098 ≈ 0.090164 ≈ 9.02%The denominator includes both sources of positive results. Although the false positive rate is small, it applies to a group that is 999 times larger than the group with disease.
Derive Bayes’ theorem for a positive result
Section titled “Derive Bayes’ theorem for a positive result”Conditional probability defines the quantity we want as follows.
P(D | +) = P(D and +) / P(+)The numerator describes people who both have disease and test positive. The multiplication rule gives P(D and +) = P(+ | D) × P(D).
A positive result occurs in either of two mutually exclusive groups, people with disease or people without disease. Add their contributions to obtain the denominator.
P(+) = P(+ | D) × P(D) + P(+ | not D) × P(not D)Write prevalence as p, sensitivity as s, and the false positive rate as f. Substitution gives a form of Bayes’ theorem for positive predictive value.
P(D | +) = (s × p) / [s × p + f × (1 − p)]Use proportions in the formula. A prevalence of 0.1% is 0.001, sensitivity of 99% is 0.99, and a false positive rate of 1% is 0.01.
P(D | +) = (0.99 × 0.001) / [0.99 × 0.001 + 0.01 × 0.999] = 0.00099 / (0.00099 + 0.00999) = 0.00099 / 0.01098 ≈ 0.090164Multiplying the numerator and denominator by 100,000 recovers 99 / 1,098. The count table and the probability formula express the same calculation.
Distinguish accuracy from predictive value
Section titled “Distinguish accuracy from predictive value”Overall accuracy measures the proportion of all results that agree with disease status. It includes true negatives as well as true positives.
Accuracy = (true positives + true negatives) / population = (99 + 98,901) / 100,000 = 99%| Measure | Numerator | Denominator | Result |
|---|---|---|---|
| Sensitivity | 99 true positives | 100 people with disease | 99% |
| Specificity | 98,901 true negatives | 99,900 people without disease | 99% |
| Accuracy | 99,000 correct results | 100,000 people tested | 99% |
| Positive predictive value | 99 true positives | 1,098 positive results | 9.02% |
There is no contradiction between 99% accuracy and 9.02% positive predictive value. Accuracy describes every tested person; positive predictive value describes only those with a positive result. A statement about accuracy must retain its definition and population when it informs another calculation.
Change prevalence while holding test performance fixed
Section titled “Change prevalence while holding test performance fixed”Keep sensitivity at 99% and the false positive rate at 1%. Changing prevalence changes the balance of true and false positives.
| Prevalence | Expected true positives per 100,000 | Expected false positives per 100,000 | Positive predictive value |
|---|---|---|---|
| 0.1% | 99 | 999 | 9.02% |
| 1% | 990 | 990 | 50.00% |
| 10% | 9,900 | 900 | 91.67% |
| 50% | 49,500 | 500 | 99.00% |
At 1% prevalence, true and false positives are equally numerous, so positive predictive value is 50%. That equality follows from the expected counts. The existence of two possible disease states alone does not make them equally probable.
Overall accuracy remains 99% throughout this particular table because sensitivity and specificity both equal 99%. More generally, accuracy is sensitivity × prevalence + specificity × (1 − prevalence). When sensitivity and specificity differ, changing prevalence also changes accuracy.
This comparison holds the test’s conditional performance fixed. In actual studies, changes in the population, disease severity, or test procedure can also change sensitivity and specificity.
Interpret the change after a positive result
Section titled “Interpret the change after a positive result”In the original example, a positive result changes the probability of disease from 0.1% to approximately 9.02%. The test provides evidence even though disease remains less probable than its absence.
The probability before the test is the prior probability. The probability after the result is the posterior probability. Population prevalence supplies the prior in this example because it describes a randomly selected member of that population. Symptoms, exposure, or selection into a referral clinic can give a person a different prior probability.
The same calculation applies to a variant detector or biomarker classifier. Sensitivity describes detection among true cases, while positive predictive value describes the composition of positive calls. In machine learning, positive predictive value is also called precision. The ROC lesson explains how a score threshold changes sensitivity and the false positive rate.
Check your understanding
Section titled “Check your understanding”Suppose prevalence and sensitivity stay fixed, while the false positive rate decreases. What happens to positive predictive value?
The expected number of true positives stays fixed, and the expected number of false positives decreases. True positives therefore form a larger proportion of positive results, so positive predictive value increases. In the formula, the numerator stays fixed while the denominator decreases.
Further reading
Section titled “Further reading”Stanford’s Bayes rule lesson derives the probability of disease after a positive result using another rare disease example. It provides a second set of values for practice with the numerator and denominator.
The Detection section of the NCI screening overview defines sensitivity, specificity, and predictive values. It explains how prevalence changes predictive values when sensitivity and specificity stay fixed.
Manrai and Mandl’s 2020 STAT article illustrates the same denominator with a different hypothetical example. It assumes one infected person among 51, 100% sensitivity, and a 10% false positive rate, giving one true positive among six positive results.