12 Diagnostic tests and biostatistics
If the test is 95% accurate, why is the result probably wrong?
Mira’s watch was right. Is everyone’s?
Mira’s smartwatch flagged an irregular rhythm, and the ECG confirmed atrial fibrillation. It is tempting to conclude that the watch is accurate. But whether a positive alert means disease depends on more than the device. It also depends on who is wearing it.
Four numbers that describe a test
Every yes-or-no test, whether a lab cut-off, an alert rule or a machine-learning flag, sorts people into four groups: true positives, false positives, missed cases (false negatives) and true negatives. Two numbers describe the test:
- Sensitivity: of the people with the disease, the share the test catches.
- Specificity: of the people without it, the share the test correctly clears.
Two numbers describe what a result means for the person in front of you:
- Positive predictive value (PPV): of the positive results, the share that are real.
- Negative predictive value (NPV): of the negative results, the share that are truly negative.
Sensitivity and specificity stay roughly fixed for a given test. PPV and NPV move with prevalence, the share of the tested population who actually have the disease. Clinicians and patients usually want to know PPV, yet test reports usually give only sensitivity and specificity.
Lab: Bayes in natural frequencies
People reason about probabilities far better when they are shown as counts of people, not percentages. Start with smartwatch owners under 40, then move to those over 65, then to Mira’s emergency department.
Pick a population, or move the sliders.
Sensitivity and specificity here are illustrative values for a consumer rhythm alert, not figures for any device.
18.4% of positive alerts are real AF (PPV)
Negative result correct: 99.95% (NPV)
| Has AF | No AF | |
|---|---|---|
| Alert | 45 | 199 |
| No alert | 5.0 | 9,751 |
true positive false positive missed true negative
In a young population, most alerts are false even though the test is good, because there are so few true cases to find. This is not a hypothetical. In the Apple Heart Study, more than 400,000 people wore a watch. About 0.5% received an irregular-pulse notification. Among notified participants who then wore a confirmatory ECG patch, about a third had AF on the patch. Notifications that happened while the patch was being worn matched AF far more often. Who gets tested, and when, is part of the test.
A likelihood ratio turns this into one number that does not depend on prevalence. LR+ = sensitivity ÷ (1 − specificity). Multiply the pre-test odds by LR+ to get the post-test odds.
Thresholds and ROC curves
Most modern tools do not output yes or no. They output a score, such as a troponin level or a model’s risk estimate, and someone chooses a threshold. Every threshold gives a different pair of sensitivity and specificity. The ROC curve plots all those pairs. The area under the curve (AUC) is the probability that a randomly chosen patient with the disease scores higher than a randomly chosen patient without it.
AUC measures ranking, not usefulness. A model with an AUC of 0.85 can still be useless if its threshold produces more alerts than anyone can act on. It can also be harmful if its scores are miscalibrated in your population. Module 15 covers calibration.
Lab: one model, two hospitals
The plot below shows a sepsis model’s scores for patients with and without sepsis. Move the threshold and watch your point travel along the ROC curve. Then switch to another hospital, where the two groups overlap far more.
- Sensitivity
- 77%
- Specificity
- 73%
- AUC
- 0.83
From the Failure Museum: the sepsis model at another hospital
A sepsis prediction model built into a widely used EHR was deployed at hundreds of hospitals, with vendor-reported AUCs of about 0.76 to 0.83. In 2021, researchers at the University of Michigan published an independent validation on about 27,000 patients. They found an AUC of 0.63. At the threshold in use, the model missed about two thirds of sepsis cases. It alerted on 18% of all hospitalised patients, and it flagged only a small share of cases that clinicians had not already recognised.
Lesson: a model’s reported performance belongs to the population and setting where it was measured. Before you switch on a predictive tool, validate it on your own patients, and report it using a standard such as TRIPOD+AI.
Check your understanding
Answer every question, then check. Each answer comes with an explanation. Score 80% or more to mark the module complete. Your progress is saved only in this browser.
Sources
- Perez MV, Mahaffey KW, Hedlin H, et al. Large-scale assessment of a smartwatch to identify atrial fibrillation. N Engl J Med. 2019;381:1909-1917.
- Wong A, Otles E, Donnelly JP, et al. External validation of a widely implemented proprietary sepsis prediction model in hospitalized patients. JAMA Intern Med. 2021;181(8):1065-1070.
- Hoffrage U, Gigerenzer G. Using natural frequencies to improve diagnostic inferences. Acad Med. 1998;73(5):538-540.
- Hanley JA, McNeil BJ. The meaning and use of the area under a receiver operating characteristic (ROC) curve. Radiology. 1982;143(1):29-36.
- Collins GS, Moons KGM, Dhiman P, et al. TRIPOD+AI statement: updated guidance for reporting clinical prediction models that use regression or machine learning methods. BMJ. 2024;385:e078378.