Skip to content
Pass Duke Elder
Textbook / Chapter 16 / Statistics, epidemiology and public health

Diagnostic tests: sensitivity, specificity and predictive values

No test is perfect, and the exam expects you to work out how imperfect from a two-by-two table without a calculator. This lesson builds the table, derives sensitivity, specificity, predictive values and likelihood ratios from it with worked examples, and explains why the same test performs differently in a clinic and in a screening programme.

8 minute read6 linked questions

The two-by-two table

To judge a test, it is given to a group of people whose true disease status is already known from the best available method, called the reference standard or gold standard. Each person then falls into one of four cells. A true positive has the disease and tests positive. A false negative has the disease but the test misses it. A true negative is healthy and tests negative. A false positive is healthy but the test wrongly flags them.

Disease presentDisease absentTotal
Test positiveTrue positive (TP)False positive (FP)All who test positive
Test negativeFalse negative (FN)True negative (TN)All who test negative
TotalAll with diseaseAll without diseaseEveryone
The two-by-two table

Every measure in this lesson is a fraction taken from this table. The skill is knowing which direction to read. Sensitivity and specificity read down the columns: they start from the truth and ask what the test said. Predictive values read across the rows: they start from the test result and ask what the truth is. Always draw the table with disease in the columns and the test in the rows, and fill in the numbers before calculating anything.

Sensitivity and specificity

Sensitivity is the proportion of people with the disease whom the test correctly identifies. It answers: if the patient has the disease, how likely is a positive result. Specificity is the proportion of people without the disease whom the test correctly clears. It answers: if the patient is healthy, how likely is a negative result.

Sensitivity = TP / (TP + FN)The denominator is everyone with the disease (the first column).
Specificity = TN / (TN + FP)The denominator is everyone without the disease (the second column).

Worked example 1: a new imaging test for glaucoma is tried on 1,000 people in a hospital clinic, of whom 100 have glaucoma, a prevalence of 10%. The test is positive in 90 of the 100 with glaucoma and negative in 720 of the 900 without. So TP = 90, FN = 10, TN = 720 and FP = 180. Sensitivity = 90 / 100 = 90%. Specificity = 720 / 900 = 80%.

A highly sensitive test has few false negatives, so a negative result makes disease unlikely. A highly specific test has few false positives, so a positive result makes disease likely. The mnemonics are SnNout (Sensitive test, Negative result, rules out) and SpPin (Specific test, Positive result, rules in). They only hold when the value is very high. Screening tests are chosen for sensitivity so that cases are not missed, and confirmatory tests for specificity so that healthy people are not treated.

Predictive values

Sensitivity and specificity describe the test. A clinician holding a result needs the reverse: given this result, does the patient have the disease. The positive predictive value (PPV) is the proportion of positive results that are true. The negative predictive value (NPV) is the proportion of negative results that are true.

PPV = TP / (TP + FP)The denominator is everyone who tests positive (the first row).
NPV = TN / (TN + FN)The denominator is everyone who tests negative (the second row).

Continue worked example 1. A total of 90 + 180 = 270 people test positive, of whom 90 have glaucoma. PPV = 90 / 270 = 33%. A total of 720 + 10 = 730 test negative, of whom 720 are healthy. NPV = 720 / 730 = 99%. A test that is 90% sensitive and 80% specific sounds good, yet two out of three positive results in this clinic are wrong.

Why predictive values depend on prevalence

Sensitivity and specificity are each calculated within one column, so the ratio of diseased to healthy people does not enter the sum. Predictive values mix the two columns, so they change whenever that ratio changes. When disease is rare, the healthy column is enormous, and even a small false positive rate applied to it produces more false positives than there are true positives.

Worked example 2: use the same test (sensitivity 90%, specificity 80%) on 1,000 people from a specialist clinic where half have glaucoma. Of the 500 with glaucoma, 450 test positive and 50 are missed. Of the 500 without, 400 test negative and 100 test positive. PPV = 450 / 550 = 82%. NPV = 400 / 450 = 89%.

Worked example 3: now screen 1,000 people from a population where 1% have glaucoma. Of the 10 with glaucoma, 9 test positive and 1 is missed. Of the 990 without, 20% test positive, which is 198, and 792 test negative. PPV = 9 / 207, about 4%. NPV = 792 / 793, nearly 100%.

PrevalenceTrue positivesFalse positivesPPVNPV
1% (population)9198About 4%Nearly 100%
10% (general clinic)9018033%99%
50% (specialist clinic)45010082%89%
The same test (sensitivity 90%, specificity 80%) at three prevalences

As prevalence rises, PPV rises and NPV falls. This is why a test that works well in a hospital clinic can fail as a population screen: at 1% prevalence, 198 healthy people are referred to find 9 cases. It is also why clinicians raise the pre-test probability before testing, by taking a history and examining, and it is one of the arguments against population screening for glaucoma, covered in the next lesson.

Likelihood ratios

A likelihood ratio (LR) says how much a test result shifts the odds of disease. It compares how often the result occurs in people with the disease to how often it occurs in people without. It is built only from sensitivity and specificity, so unlike predictive values it can be carried from one setting to another.

LR+ = sensitivity / (1 − specificity)The true positive rate divided by the false positive rate.
LR− = (1 − sensitivity) / specificityThe false negative rate divided by the true negative rate.

For the test above, LR+ = 0.9 / 0.2 = 4.5 and LR− = 0.1 / 0.8 = 0.125. An LR above 1 makes disease more likely and an LR below 1 makes it less likely. An LR of 1 means the result is useless. As a rule of thumb, an LR+ above 10 or an LR− below 0.1 shifts probability enough to change management.

To use one, convert the pre-test probability to odds, multiply by the LR, and convert back. Take the clinic with 10% prevalence. A probability of 1 in 10 is odds of 1 to 9. Multiply by the LR+ of 4.5 to get post-test odds of 4.5 to 9, which is 1 to 2. Odds of 1 to 2 are a probability of 1 in 3, or 33%. That matches the PPV from the table, as it must: the PPV is the post-test probability after a positive result.

Cut-offs and ROC curves

Many tests give a number, and someone has to choose the value that counts as abnormal. Take intraocular pressure as a test for glaucoma. If the cut-off is lowered, more people with glaucoma are caught, so sensitivity rises, but more healthy people are flagged, so specificity falls. Raise the cut-off and the reverse happens. Sensitivity and specificity trade against each other, and the right balance depends on the cost of a missed case compared with the cost of a false alarm.

A receiver operating characteristic (ROC) curve displays this trade-off. Sensitivity (the true positive rate) is plotted on the vertical axis against 1 minus specificity (the false positive rate) on the horizontal axis, with one point for every possible cut-off. A good test climbs steeply towards the top left corner, where sensitivity and specificity are both 100%. A useless test follows the diagonal, where true and false positives rise together.

The area under the curve (AUC) summarises the whole curve in one number. An AUC of 1 is a perfect test and an AUC of 0.5 is no better than tossing a coin. Two tests can be compared by their AUCs, and the curve helps pick a cut-off: a point high on the curve for a rule-out test, a point to the left for a rule-in test.

Summary

  • Sensitivity is true positives divided by everyone with the disease.
  • Specificity is true negatives divided by everyone without the disease.
  • Positive predictive value is true positives divided by everyone who tests positive.
  • Negative predictive value is true negatives divided by everyone who tests negative.
  • Sensitivity and specificity belong to the test, while predictive values change with prevalence.
  • As prevalence falls, positive predictive value falls and negative predictive value rises.
  • A negative result on a very sensitive test rules disease out, and a positive result on a very specific test rules it in.
  • LR+ is sensitivity divided by 1 minus specificity, and LR− is 1 minus sensitivity divided by specificity.
  • A ROC curve plots sensitivity against 1 minus specificity across all cut-offs.
  • An area under the ROC curve of 1 is perfect and 0.5 is chance.

Check yourself

Quick recall on this lesson. These are easier than the question bank.

1. A test is positive in 80 of 100 people who have a disease. What is its sensitivity?
2. Which measure changes when the same test is used in a population with a lower prevalence of disease?
3. A test has a sensitivity of 90% and a specificity of 80%. What is the positive likelihood ratio?
4. What is the area under the ROC curve for a test that performs no better than chance?
Practise 6 questions on this lesson

Written for revision. It is not a source of clinical advice, and guidance changes.