13 — Measuring performance

A threshold turns a score into a decision.

+ The questionA model outputs a score; who chooses where yes begins, and what does moving that point trade?

Four counts

Of the 819 participants whose results could be analyzed in the IDx-DR trial, 198 had more than mild retinopathy according to the reference standard and 621 did not. The program flagged 173 of the 198 and missed 25; it cleared 556 of the 621 and flagged 65 who did not have the disease. Every performance figure for the trial comes from those four counts. Sensitivity, the share of diseased participants flagged, is 173 out of 198, 87.4 percent, and specificity, the share of disease-free participants cleared, is 556 out of 621, 89.5 percent. The positive predictive value, the share of flagged participants who had the disease, is 173 out of 238, 72.7 percent; the negative predictive value, the share of cleared participants who did not have it, is 556 out of 581, 95.7 percent.

Each figure is an estimate from a sample and carries uncertainty. The exact 95 percent confidence interval for the observed sensitivity runs from about 81.9 to 91.7 percent; for specificity, it runs from about 86.9 to 91.8 percent. An exact interval is computed directly from the counts rather than by an approximation. The paper's own estimates are slightly different, 87.2 and 90.7 percent, because the trial deliberately recruited extra participants with poorly controlled diabetes, and the authors corrected for that enrichment with a statistical model.

The trial's statistical test asked whether the lower end of each interval cleared a floor set in advance: 75 percent for sensitivity and 77.5 percent for specificity. Two higher values, 85 and 82.5 percent, were the alternatives used to size the trial: the performance the program was assumed to have when the trial's designers calculated how many participants were needed. The FDA's summary calls these higher values the prespecified thresholds, and the estimates exceeded both the floors and the thresholds. Because the test applies to the lower end of each interval, a study has to clear its floor with room to spare. A small study cannot, because its intervals are wide.

25 — Four counts behind every figure
IDx-DR trial, n = 819 REFERENCE: DISEASE (198) REFERENCE: NO DISEASE (621) PROGRAM: DETECTED (238) PROGRAM: NOT DETECTED (581) TRUE POSITIVES 173 FALSE POSITIVES 65 FALSE NEGATIVES 25 TRUE NEGATIVES 556 sensitivity 173/198 = 87.4% exact 95% CI 81.9–91.7 specificity 556/621 = 89.5% exact 95% CI 86.9–91.8 PPV 173/238 = 72.7% NPV 556/581 = 95.7% depends on how common the disease is prevalence in the analyzed set 198/819 = 24%; predictive values hold only at that prevalence
SpecificationCodeFaultReadoutFocal detail
Plate 25 — Every figure from the IDx-DR trial comes from four counts: 173 true positives, 65 false positives, 25 false negatives and 556 true negatives. Sensitivity and specificity describe the device; the predictive values hold only at the trial's 24 percent prevalence.

A threshold turns a score into a decision

Most models do not output a decision. They output a score, and a threshold turns the score into a decision: above the threshold, refer; below it, do not. Moving the threshold trades one error for the other. A lower threshold flags more patients, catching more disease and raising more false alarms; a higher one does the reverse. The receiver operating characteristic curve, or ROC curve, plots that trade across every possible threshold: sensitivity against the false-positive rate, which is the share of disease-free patients wrongly flagged. The area under the curve of Chapter 11 is the area beneath this curve. It summarizes how well the score separates the two groups whatever the threshold, from 0.5 for a coin toss to 1 for perfect separation.

The Google network of Chapter 10 shows the choice in practice. Its authors scored it on 8,788 gradable images from EyePACS-1, a set they kept apart from all the data used to train and tune the network, and its area under the curve was 0.991. The authors call such a held-out set a validation set; in the terms of Chapter 11 it is a test set. Each threshold gives one operating point on the curve, with its own sensitivity and specificity, and the authors reported two: a high-specificity point with 90.3 percent sensitivity and 98.1 percent specificity, and a high-sensitivity point with 97.5 percent sensitivity and 93.4 percent specificity. The model was the same at both points. Which point to ship depends on what a false alarm and a missed case each cost in the setting of use. That is a clinical judgment rather than a property of the model, and the point must be fixed before the test, because a threshold tuned on the test set inflates the result, as Chapter 11 warned.

A single summary number hides the operating point

An area under the curve describes the whole curve, including thresholds nobody will use. Two models with the same area can have very different sensitivity at the specificity a clinic needs. A claim can be interpreted only when it comes with the threshold, the sensitivity and specificity at that threshold, their confidence intervals, the prevalence in the test population and the share of cases the device declined.

26 — One model, two operating points
0 0.05 0.10 0.15 0.20 0.25 0.30 0.80 0.85 0.90 0.95 1.00 SENSITIVITY FALSE-POSITIVE RATE (1 − SPECIFICITY) high-specificity threshold: 90.3% / 98.1% high-sensitivity threshold: 97.5% / 93.4% sensitivity / specificity AUC 0.991 on 8,788 gradable images (EyePACS-1) axes zoomed: x 0 to 0.30, y 0.80 to 1.00 schematic between the marked points moving the threshold same model; the threshold is a clinical choice
ReadoutFocal detail
Plate 26 — One model gives different sensitivity and specificity depending on where its threshold is set. The Google network of 2016 reported two points on the same curve; which to use depends on what a missed case and a false alarm cost in the setting of use.

Prevalence changes what a positive means

Sensitivity and specificity describe the device; predictive values describe what its answers mean in a particular population, and they change with how common the disease is. The PCR and immunoassay guides in this library work through the same arithmetic for laboratory tests, and the arithmetic applies unchanged to software.

Solved example: the same program in two populations

Take a population in which 24 percent have the disease, as among the trial's analyzed participants, and apply IDx-DR's observed sensitivity of 87.4 percent and specificity of 89.5 percent. Of every 1,000 people, 240 are diseased and the program flags 210 of them; 760 are healthy and it flags 80 of them by mistake. A positive answer is right 210 times out of 290, about 72 percent, close to the trial's 72.7 percent. Now take a population in which 7 percent have the disease, closer to an unselected screening population than the trial's enriched sample: 70 diseased, of whom 61 are flagged, and 930 healthy, of whom 98 are flagged. A positive answer is now right only 61 times out of 159, about 38 percent, while a negative answer is right about 99 percent of the time. The program is unchanged, but the meaning of its answers has changed.

Low prevalence and a weak score together produce a heavy burden of false alarms. In 2021 researchers at Michigan Medicine tested a sepsis prediction model on 38,455 hospitalizations, 7 percent of which involved sepsis, the body's life-threatening response to an infection. The model was built into a widely used electronic health record. Its area under the curve was 0.63, against 0.76 to 0.83 reported in the developer's own documentation. At the alert threshold the hospital used, the model flagged 18 percent of hospitalizations, caught 33 percent of sepsis cases and missed 67 percent. Only 12 percent of the hospitalizations it flagged involved sepsis: if the model alerted once per patient, clinicians would evaluate about eight patients to find one with sepsis. Each rate follows from the published counts; for instance, 843 of the 6,971 flagged hospitalizations involved sepsis.

Answers the program declines to give

A diagnostic program can also decline to answer, and how those cases are counted changes the figures. IDx-DR returned "insufficient quality" for some participants even after their pupils had been dilated, and its labeling states that such patients should be referred. The trial's headline sensitivity and specificity exclude them: the program gave a usable answer for 96.1 percent of participants whose reference images could be graded. A complete account therefore reports how often the device answers, as well as its sensitivity and specificity when it does. Chapter 17 recomputes IDx-DR's sensitivity with the declined cases counted. The immunoassay guide takes up the same question for a blood test that has a zone of results giving no answer.

Fix the operating point from the clinical costs, before the test

Decide with clinicians what a missed case and a false alarm each cost in the intended setting, choose the threshold on the tuning data accordingly, and freeze it before the test set is opened. Report sensitivity, specificity and their intervals at that threshold, the prevalence of the test population, predictive values for the populations where the device will be used, and the rate of declined answers.

+ What this chapter established
  • Sensitivity, specificity and predictive values all come from four counts; IDx-DR's trial gave 87.4 percent sensitivity and 89.5 percent specificity.
  • A threshold turns a model's score into a decision, trading missed cases against false alarms along the ROC curve; it should be chosen with clinicians and fixed before the test.
  • Predictive values change with prevalence: the same program's positive answers are right about 72 percent of the time at 24 percent prevalence and about 38 percent at 7 percent.
  • A full account also reports how often the device declines to answer, and the operating point behind any summary number.
Created with Claude (Anthropic).
Educational reference material, not engineering, regulatory or clinical advice. Product and company names referenced are the property of their respective owners.