12 Diagnostic tests and biostatistics
If the test is 95% accurate, why is the result probably wrong?
In plain language
- No test is perfect. Every test misses some sick people and wrongly flags some healthy ones.
- Whether a positive result is probably true depends on how common the condition is in the people being tested, not only on the test itself.
- A prediction model that works well at one hospital can work much worse at another, so it has to be checked locally before it is trusted.
The core sections below build on these ideas. Sections marked "Going deeper" are optional and go further.
Why this matters for you
What it means for each role
- Students
- Predictive values and ROC curves are the language every AI and screening claim is made in.
- Physicians and residents
- You will explain positive results to patients, and judge whether a vendor's model works on your patients.
- Nurses and allied health
- Sepsis and deterioration scores often alert you first. Knowing their false-alarm rate helps you weigh them.
- Researchers and analysts
- External validation and calibration decide whether a model is publishable and safe to deploy.
- IT and administration
- Before switching on a predictive tool, someone has to ask how it performed locally. This gives you the questions.
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.
“Roughly” matters. A test can perform differently in a different kind of patient. Older people have more harmless extra heartbeats that can confuse a rhythm sensor, for example. This is called spectrum bias.
A likelihood ratio combines sensitivity and specificity into one number that does not depend on prevalence. The positive likelihood ratio (LR+) is sensitivity ÷ (1 − specificity). A positive result multiplies the odds of disease by LR+.
Lab: Bayes in natural frequencies
People reason about probabilities far better when they are shown as counts of people, not percentages. The lab uses a hypothetical rhythm alert with 90% sensitivity and 98% specificity.
Predict first: among smartwatch owners under 40, what share of alerts do you think are real? Write a number down. Then start with that group, move to those over 65, and finally to Mira’s emergency department. How far off was your guess, and which number changed: sensitivity, specificity or PPV?
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. Real devices are tuned for this. In the Apple Heart Study, more than 400,000 people wore a watch. About 0.5% received an irregular-pulse notification: 0.16% of those under 40 and 3.1% of those 65 or older. Notified participants were sent an ECG patch to wear later, and about a third of them had AF on it. That is not a false-alarm rate: AF often comes and goes, so it may not show up a week later. When a notification happened while the patch was being worn, 84% matched AF. Who gets tested, and when, is part of the test.
Population matters for a whole country, too. Most of Dubai’s residents are working-age expatriates, and relatively few are over 65. A rhythm alert worn across that population will behave closer to the “under 40” preset than to the “over 65” one. Mira, at 57, sits between the two. The device is identical; the meaning of its alert is not.
Going deeper Using likelihood ratios at the bedside
Convert the pre-test probability to odds, multiply by the likelihood ratio, and convert back. With a pre-test probability of 0.2% (odds about 1 in 499) and LR+ of 45, the post-test odds are about 45 in 499, a probability of about 8%. That matches the natural-frequency count in the lab. A Fagan nomogram does the same thing graphically.
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.
Going deeper Why a high AUC is not enough
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.
Your task: at the developer’s hospital, find a threshold with a sensitivity of at least 70% and a specificity of at least 75%, so that no more than one in four patients without sepsis gets a false alarm. Note the values you settle on. Then switch to MENA Academic Hospital, where a silent local validation found that the two groups overlap far more, and try the same task. Can you still meet both targets? What would you tell the committee that wants to switch the model on?
- 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, measured per hospitalisation and with a different definition of sepsis from the vendor’s. At the threshold in use, the model missed about two thirds of sepsis cases. It alerted on 18% of all hospitalisations, and it flagged only a small share of cases that clinicians had not already recognised. The vendor later released a new version that hospitals train on their own data.
Most published validations of such models come from North America, Europe and East Asia; very few come from the Gulf, Africa or South Asia. For a hospital in those regions, the honest starting assumption is that nobody has yet measured how the model performs on its patients, until it runs its own silent validation.
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.