The formula
From a 2×2 table (TP, FP, FN, TN):
Sensitivity = TP ÷ (TP + FN)
Specificity = TN ÷ (TN + FP)
PPV = TP ÷ (TP + FP)
NPV = TN ÷ (TN + FN)
LR+ = sensitivity ÷ (1 − specificity)
LR− = (1 − sensitivity) ÷ specificity
Accuracy = (TP + TN) ÷ total
From rates, PPV = sens × prev ÷ (sens × prev + (1 − spec) × (1 − prev))
Worked example
- A test has 95% sensitivity and 90% specificity, and 5% of the people tested have the condition.
- Out of 10,000 people, 500 have the condition and 9,500 don't.
- True positives = 95% × 500 = 475; false negatives = 25.
- False positives = 10% × 9,500 = 950; true negatives = 8,550.
- PPV = 475 ÷ (475 + 950) = 33.3%: only one in three positive results is a true case.
- NPV = 8,550 ÷ (8,550 + 25) = 99.7%.
- LR+ = 0.95 ÷ 0.10 = 9.5, and LR− = 0.05 ÷ 0.90 = 0.06.
Four numbers that describe a test
Any test that gives a positive or negative result can be summarised with a 2×2 table: true positives (people with the condition who test positive), false positives, false negatives and true negatives. Sensitivity is the share of people with the condition who test positive: how good the test is at catching cases. Specificity is the share of people without the condition who test negative: how good it is at ruling them out. These two are properties of the test itself and don't change with how common the condition is.
Predictive values depend on prevalence
Patients and doctors usually want to know something different: if my test is positive, how likely is it that I have the condition? That's the positive predictive value (PPV), and the negative predictive value (NPV) is the equivalent for a negative result. Both depend heavily on prevalence, the proportion of people tested who actually have the condition. In the example, a test that's 95% sensitive and 90% specific has a PPV of only 33% when prevalence is 5%, because the many people without the condition generate more false positives than there are true cases. At a prevalence of 30% the same test has a PPV of about 80%. This is why screening for rare diseases in the general population produces many false alarms, and why positive screening results are confirmed with a second, more specific test.
Likelihood ratios
Likelihood ratios combine sensitivity and specificity into a single number that tells you how much a result changes the probability of disease. An LR+ above 10 or an LR− below 0.1 produces a large, often conclusive change. Values of 5–10 and 0.1–0.2 are moderately useful, while values close to 1 barely change anything. Because they don't depend on prevalence, likelihood ratios can be applied to any patient: multiply the pre-test odds by the LR to get the post-test odds. A Fagan nomogram does the same thing graphically.
Choosing between sensitivity and specificity
There's usually a trade-off: moving a test's cut-off to catch more cases raises sensitivity but lowers specificity. A highly sensitive test is best for ruling a condition out when it's negative, remembered by the mnemonic SnNout. A highly specific test is best for ruling a condition in when it's positive: SpPin. Screening tests are usually chosen for high sensitivity so few cases are missed, and confirmatory tests for high specificity.
A worked screening example
Imagine screening 1,000 people for a condition that affects 1%, using a test that's 90% sensitive and 91% specific. Of the 10 people with the condition, 9 test positive. Of the 990 without it, about 89 also test positive. So 98 people get a positive result, but only 9 of them, about 9%, actually have the condition. The NPV, though, is excellent: of the 902 negative results, only 1 is a missed case. This is why national screening programmes carefully weigh the harms of false positives, such as anxiety and unnecessary follow-up tests, against the benefits of early detection.
Other measures
Accuracy, the proportion of all results that are correct, can be misleading when prevalence is very low or high, because a test that always says negative can look accurate for a rare disease. The F1 score, the harmonic mean of PPV and sensitivity, is popular in machine learning for the same reason. To compare outcomes between two groups rather than evaluate a test, use our odds ratio and relative risk calculator.