Sensitivity and Specificity

How the accuracy of a diagnostic or screening test is measured against a reference standard. The 2 x 2 table, sensitivity and specificity as conditional probabilities and why accuracy is a poor summary; what changes when the reference standard is itself a definition, shown by reading the same table with each test as the reference; Wilson intervals and the number of cases a study needs; how sensitivity depends on the severity and make-up of the cases, spectrum bias in studies of severe cases and healthy controls, and verification bias with the Begg-Greenes correction. Worked on HbA1c as a screen for undiagnosed diabetes, defined by fasting glucose, in NHANES adults, with worked problems on a second cut-off, the size of an accuracy study, the correction on one verified sample and a different case mix.

Sensitivity, $P(T^+ \mid D)$, and specificity, $P(T^- \mid D^c)$, measure a test against a reference standard within the diseased and the non-diseased column of the 2 by 2 table, so neither depends on the prevalence. For HbA1c at 6.5% against a fasting glucose of 126 mg/dL or more, in 1,975 undiagnosed NHANES 2017 to 2018 adults, the sensitivity is 0.470 (Wilson 95% interval 0.381 to 0.560) and the specificity 0.987 (0.980 to 0.991). Accuracy, $\pi\,\mathrm{Se} + (1 - \pi)\,\mathrm{Sp}$, hides missed cases when the condition is rare. Both measures depend on the chosen reference and on the case mix: sensitivity runs from 0.25 to 0.88 across glucose bands, and severe cases with healthy controls raise it to 0.845. Verifying mostly positives inflates it; the Begg–Greenes correction undoes that when verification depends only on the result.

A national health survey drew blood from 1,975 adults who had never been told they had diabetes. In 115 of them the fasting glucose was in the diabetic range, and in 79 the glycated hemoglobin was. Only 54 met both. Two accepted definitions of the same disease, applied to the same blood, disagree about 86 people. How well does one measurement detect a condition defined by another, and how should "how well" be measured? Medicine measures it with two numbers, one for the people who have the condition and one for those who do not: here the glycated hemoglobin criterion flags 47.0% of the adults whose fasting glucose is in the diabetic range, and clears 98.7% of the others.

The two measurements come from the National Health and Nutrition Examination Survey (NHANES) of 2017 to 2018. It drew blood from a subsample of adults who had fasted overnight.

  • Fasting plasma glucose (FPG) is the concentration of glucose in the blood after at least eight hours without food.
  • Glycated hemoglobin (HbA1c) is the percentage of hemoglobin that has glucose attached to it. A red blood cell lives about four months, and HbA1c reflects average glucose over roughly the last two to three of them (American Diabetes Association, 2025).

The American Diabetes Association (ADA) accepts either as a criterion for diabetes: an FPG of 126 mg/dL or more, or an HbA1c of 6.5% or more (ADA, 2025, Table 2.1). The two numbers have names. Sensitivity is the share of people with the condition whom the test flags. Specificity is the share of people without it whom the test clears. The later articles of this unit build on both. They turn them into the probability of disease after a given result, summarize a result by a likelihood ratio, and trace the trade-off between the two as the cut-off moves.

First we fix what is being tested and against what, and why the "truth" here is itself a definition. Then we define the two measures on the 2 by 2 table and see why the plain share of correct results misleads. Next we read the same table with the roles of the two tests reversed, and put confidence intervals on the measures. Finally we ask what sensitivity depends on, and how two common study designs distort it. The measures are conditional probabilities, as defined in Conditional Probability and the Law of Total Probability.

The test, the condition and the reference standard

Three things have to be fixed before any accuracy can be measured.

  • The index test is the procedure being evaluated, together with its rule for calling a result positive. Here it is HbA1c, positive at 6.5% or more.
  • The target condition is what the test is meant to detect: diabetes not yet diagnosed.
  • The reference standard is the best available way of deciding who has the target condition. Here it is a single FPG of 126 mg/dL or more.

The adults studied are those who would be screened in practice, adults without a diagnosis. NHANES has 2,366 nonpregnant adults aged 18 to 80 who met its fasting criterion of 8 to 24 hours. All had both blood measurements and an answer to the diabetes question. Of these, 391 already had a diagnosis and are set aside. Their glucose reflects treatment, and nobody screens a person already known to have the disease. The remaining 1,975 adults are treated as a random sample of adults without a diagnosis. NHANES is a complex survey, and its sampling weights would be needed for estimates about the U.S. population. As in the other units of this course, the weights are ignored, so the figures describe these adults (NCHS, 2020a, 2020b, 2020c).

The reference standard deserves suspicion before it is used. Diabetes is a disease of chronically raised blood glucose, and its diagnostic criteria are thresholds on glucose measurements, chosen by expert committees. "Diabetes" in this article therefore means "FPG of 126 mg/dL or more on the morning of the NHANES examination." That is a definition rather than an independent fact about the patient. Three consequences follow.

  • One value is not a diagnosis. Without unequivocal hyperglycemia, the ADA requires two abnormal results. They may be the same test on two occasions, or two different tests, possibly from the same sample (ADA, 2025, Table 2.1). A single NHANES glucose is not a clinical diagnosis.
  • The reference varies. FPG varies from day to day, so some of the 115 would not meet the threshold on another morning.
  • The two tests measure different things. HbA1c is a three-month average and FPG a morning snapshot. Their disagreement is partly a difference between two definitions, not only error in one of them. The ADA acknowledges that the cut-points of the different tests identify groups with incomplete concordance (ADA, 2025).

Choosing FPG as the reference is a modeling decision. It is made here because it lets the methods be shown on real data, and a later section reverses it.

The 2 by 2 table

Each adult falls into one of four cells, according to the test result and the reference standard. The test result is in the rows and the reference in the columns:

HbA1c FPG $\ge$ 126 (diabetes) FPG $<$ 126 (no diabetes) Total
$\ge 6.5\%$ (positive) 54 (true positives, TP) 25 (false positives, FP) 79
$< 6.5\%$ (negative) 61 (false negatives, FN) 1,835 (true negatives, TN) 1,896
Total 115 1,860 1,975

The prevalence of the condition among the adults tested is $(\mathrm{TP} + \mathrm{FN})/N = 115/1{,}975 = 0.0582$.

Write $D$ for the event that a randomly chosen adult has the condition, $D^c$ for its complement, and $T^+$ and $T^-$ for a positive and a negative test. The two standard measures of accuracy condition on the truth.

Sensitivity is the probability that the test is positive in a person who has the condition:

$$\mathrm{Se} = P(T^+ \mid D) = \frac{\mathrm{TP}}{\mathrm{TP} + \mathrm{FN}} = \frac{54}{115} = 0.4696.$$

Specificity is the probability that the test is negative in a person who does not:

$$\mathrm{Sp} = P(T^- \mid D^c) = \frac{\mathrm{TN}}{\mathrm{TN} + \mathrm{FP}} = \frac{1{,}835}{1{,}860} = 0.9866.$$

Their complements are the two error rates. The false negative rate, $1 - \mathrm{Se} = 0.5304$, is the share of the condition the test misses. The false positive rate, $1 - \mathrm{Sp} = 0.0134$, is the share of people without the condition whom it flags.

Both denominators are column totals, and that is the point of the definitions. Sensitivity is computed entirely within the diseased column and specificity entirely within the other. So neither depends on how the population is divided between the two columns. Each is a property of how the test behaves in one kind of person. The names are usually traced to Yerushalmy (1947), who defined a measure of sensitivity and a measure of specificity in a study of diagnosis by X-ray.

Example (twice as many adults without the condition). Suppose the survey had examined twice as many adults with normal fasting glucose, and the test behaved the same way in them. Of sensitivity, specificity and prevalence, only the prevalence would change. Doubling the second column doubles the 25 false positives and the 1,835 true negatives, so specificity stays at 0.9866. The diseased column is untouched, so sensitivity stays at 0.4696. The prevalence roughly halves, from $115/1{,}975 = 0.0582$ to $115/3{,}835 = 0.0300$. This is what "does not depend on prevalence" means.

HbA1c at 6.5% is a specific test with low sensitivity. It almost never flags an adult whose fasting glucose is normal. But it misses more than half of the adults whose fasting glucose is in the diabetic range. The figure shows why: the HbA1c values of the two groups overlap. The threshold sits in the upper tail of the larger group and near the middle of the smaller.

HbA1c among the 1,860 adults with FPG below 126 mg/dL (top) and the 115 with FPG of 126 or more (bottom), each as a share of its own group; the dashed line is the 6.5% cut-off, and bars to its right are test positives. Notice that almost all of the top group lies left of the line (specificity 0.987), but so does more than half of the bottom group (sensitivity 0.470): the median HbA1c of the cases, 6.4%, is below the cut-off.
HbA1c among the 1,860 adults with FPG below 126 mg/dL (top) and the 115 with FPG of 126 or more (bottom), each as a share of its own group; the dashed line is the 6.5% cut-off, and bars to its right are test positives. Notice that almost all of the top group lies left of the line (specificity 0.987), but so does more than half of the bottom group (sensitivity 0.470): the median HbA1c of the cases, 6.4%, is below the cut-off.

Why accuracy misleads

A single number would be simpler. The obvious candidate is the proportion of correct results, $(\mathrm{TP} + \mathrm{TN})/N = 1{,}889/1{,}975 = 0.9565$, which looks impressive.

Example (a test that calls everybody negative). A "test" that calls everybody negative finds no cases at all, and its accuracy in these 1,975 adults is $1{,}860/1{,}975 = 0.9418$, because it is correct for every adult without the condition. That is barely below HbA1c's 0.9565.

The reason is that accuracy is a weighted average of sensitivity and specificity, $\pi\,\mathrm{Se} + (1 - \pi)\,\mathrm{Sp}$, with $\pi$ the prevalence. To see this, split the correct results by column:

$$\frac{\mathrm{TP} + \mathrm{TN}}{N} = \frac{\mathrm{TP} + \mathrm{FN}}{N} \cdot \frac{\mathrm{TP}}{\mathrm{TP} + \mathrm{FN}} + \frac{\mathrm{TN} + \mathrm{FP}}{N} \cdot \frac{\mathrm{TN}}{\mathrm{TN} + \mathrm{FP}} = \pi\,\mathrm{Se} + (1 - \pi)\,\mathrm{Sp}.$$

Here $0.0582 \times 0.4696 + 0.9418 \times 0.9866 = 0.9565$. When the condition is uncommon the weight falls almost entirely on specificity. Accuracy hides exactly the failure that matters in screening, the missed cases. It also changes with prevalence even when the test does not. The library's Binary Classification Metrics makes the same point for machine-learning classifiers. The Academics section's Evaluating Classifiers gives the information retrieval vocabulary, in which sensitivity is called recall.

The same table, read the other way

So far FPG has been the truth. Suppose instead that HbA1c of 6.5% or more is taken as the definition of diabetes, and FPG is the test under evaluation. Nothing in the data changes; the table is transposed.

Example (FPG as the index test). With HbA1c as the reference, FPG's sensitivity is 0.684, higher than HbA1c's 0.470. The 54 adults who meet both definitions are the true positives either way. As the reference, HbA1c has only 79 positives to divide by instead of 115. The sensitivity of FPG is $54/79 = 0.6835$, and its specificity is $1{,}835/1{,}896 = 0.9678$.

Index test Reference Sensitivity Specificity
HbA1c $\ge 6.5\%$ FPG $\ge 126$ 0.470 0.987
FPG $\ge 126$ HbA1c $\ge 6.5\%$ 0.684 0.968

Each test looks imperfect when the other is called the truth. HbA1c misses 53% of the adults whose FPG is diabetic, and FPG misses 32% of the adults whose HbA1c is. Whichever test is chosen as the reference is perfect by definition. Neither statement is wrong; each is a statement about agreement with a chosen reference.

When the reference is itself a measurement with error, every disagreement is booked as an error of the index test. So an imperfect reference makes a test look worse than it is. A test that shares the reference's errors can look better than it is; a second glucose measurement taken the same morning is an example. Reports of diagnostic accuracy should therefore always name the reference standard. A claim such as "HbA1c misses half of diabetes" should be read as "HbA1c at 6.5% misses about half of the adults whose single fasting glucose is 126 or more." Where no test is an acceptable reference, latent class models estimate the accuracy of several tests at once by treating the true state as unobserved. They are beyond this course.

Confidence intervals

The 115 cases are a sample, so 0.4696 is an estimate. A 95% confidence interval puts the sensitivity in the population screened between 0.38 and 0.56.

Sensitivity and specificity are proportions, each estimated from its own column. Sensitivity is $x = 54$ successes in $n = 115$ trials, where $n$ is the number of people with the condition, not the size of the study. All the methods of Confidence Intervals for a Proportion apply, and so do its warnings. Example (a common misstatement: the Wald interval as the interval for sensitivity). The interval for a sensitivity is often given as $\hat{p} \pm 1.96\sqrt{\hat{p}(1-\hat{p})/n}$, the Wald interval. Two points make the statement precise. First, $n$ is the number of people with the condition, not the size of the study. Second, the formula is a large-sample approximation that covers less often than it claims when $n$ is small or $\hat{p}$ is near 0 or 1, as Confidence Intervals for a Proportion shows by exact calculation. Both situations are common for accuracy estimates. Wilson's score interval, derived in the same article, does not have that defect.

Measure Estimate Wald 95% Wilson 95%
Sensitivity, $54/115$ 0.4696 (0.3784, 0.5608) (0.3808, 0.5603)
Specificity, $1{,}835/1{,}860$ 0.9866 (0.9813, 0.9918) (0.9802, 0.9909)
Sensitivity, ages 18–39, $6/12$ 0.500 (0.217, 0.783) (0.254, 0.746)

With 115 cases the two methods nearly agree for sensitivity. For specificity, close to 1, the Wilson interval is shifted downward, because a proportion near 1 is more uncertain below than above. For the 12 cases aged 18 to 39, both intervals are centered on 0.5 and very wide, Wald's wider still. With so few cases, neither says more than that the sensitivity in this group lies somewhere between about a quarter and three quarters.

The width of the sensitivity interval depends on the number of cases, and in a screening population cases are scarce. Solving $1.96\sqrt{p(1-p)/n} = h$ for $n$ gives the number of cases needed for a margin of error $h$: squaring both sides, $1.96^2\,p(1-p)/n = h^2$, so

$$n = \frac{1.96^2\,p(1 - p)}{h^2},$$

rounded up. With $p = 0.470$ it is 383 cases for $h = 0.05$ and 96 for $h = 0.10$. At a prevalence of 5.8%, collecting 383 cases means screening about 6,578 adults. A study that wants a precise sensitivity in a low-prevalence setting must be large, or it must recruit cases separately. Recruiting them separately brings the problem of the next section.

What sensitivity depends on

Sensitivity and specificity do not depend on the prevalence. Does that make them fixed properties of the test? It does not. Sensitivity is an average over the people who have the condition. If the test detects some of them more easily than others, the average depends on who they are.

Splitting the 115 cases by their fasting glucose shows how strongly the case mix matters:

FPG of the case (mg/dL) Cases HbA1c $\ge 6.5\%$ Sensitivity (Wilson 95%) Median HbA1c
126–139 59 15 0.254 (0.161, 0.378) 6.1%
140–179 39 24 0.615 (0.459, 0.751) 6.8%
180 and over 17 15 0.882 (0.657, 0.967) 8.7%

HbA1c detects severe hyperglycemia reliably and mild hyperglycemia rarely. Half of the screen-detected cases are mild, so the overall sensitivity is low. In a population where undiagnosed diabetes is typically found late and severe, the same test would be far more sensitive.

By age the differences are smaller. Sensitivity is 0.500 (6 of 12) at ages 18 to 39, 0.439 (18 of 41) at 40 to 59 and 0.484 (30 of 62) at 60 and over. The intervals overlap heavily. Specificity is higher in the youngest group:

  • 0.9945 (727 of 731) at ages 18 to 39;
  • 0.9813 (576 of 587) at 40 to 59;
  • 0.9815 (532 of 542) at 60 and over.

Adults over 40 whose fasting glucose is below the threshold cross 6.5% more often than younger ones. The dependence can be written as $\mathrm{Se}(x) = P(T^+ \mid D \cap \{X = x\})$ for a patient characteristic $X$ with value $x$. A reported sensitivity is an average over the case mix of the study that produced it. Precisely, by the law of total probability applied within the cases,

$$\mathrm{Se} = \sum_x P(X = x \mid D)\,\mathrm{Se}(x).$$

For the three glucose bands the weights are the shares of the 115 cases in each band, and $\tfrac{59}{115} \cdot \tfrac{15}{59} + \tfrac{39}{115} \cdot \tfrac{24}{39} + \tfrac{17}{115} \cdot \tfrac{15}{17} = \tfrac{54}{115} = 0.4696$. Just over half of the weight, $59/115 = 0.513$, falls on the band the test detects least often.

Sensitivity of HbA1c at 6.5% with 95% Wilson intervals; the count of positives over cases is at the right. Read down the panels: by age group the sensitivity barely changes, by the fasting glucose of the case it rises from 0.25 to 0.88, and among adults already diagnosed whose FPG is 126 or more, a group of severe cases, it is 0.84.
Sensitivity of HbA1c at 6.5% with 95% Wilson intervals; the count of positives over cases is at the right. Read down the panels: by age group the sensitivity barely changes, by the fasting glucose of the case it rises from 0.25 to 0.88, and among adults already diagnosed whose FPG is 126 or more, a group of severe cases, it is 0.84.

Spectrum bias

The dependence becomes a bias when a study of a test recruits a different spectrum of patients from the one in which the test will be used. The cheapest design for a new test collects clear cases, often from a specialty clinic, and clear non-cases, often healthy volunteers, and tests both. This is a diagnostic case-control study. Ransohoff and Feinstein (1978) drew attention to the problem under the name of the "spectrum" of patients studied. It is now usually called spectrum bias.

The NHANES data can imitate the design.

  • Cases: the 264 adults who had already been diagnosed with diabetes and whose fasting glucose was still 126 or more (median FPG 165 mg/dL, median HbA1c 7.55%).
  • Controls: the 444 adults aged 18 to 39 with no diagnosis and an FPG below 100, the normal range.

Example (severe cases and healthy controls). Compared with the screening population, this design makes HbA1c look both more sensitive and more specific. HbA1c at 6.5% is positive in 223 of the cases and negative in 443 of the controls:

Design Sensitivity Specificity
Screening population (1,975 adults) 0.470 (0.381, 0.560) 0.9866 (0.9802, 0.9909)
Severe cases and young healthy controls 0.845 (0.796, 0.883) 0.9977 (0.9874, 0.9996)

These cases imitate the design only roughly. Most adults with a diagnosis are being treated, and treatment lowers both glucose and HbA1c. So the cases are the diagnosed adults whose glucose stayed high, treated or not, and their HbA1c reflects months of treatment as well as the disease. The comparison shows the direction and rough size of the bias, not the accuracy a particular case-control study would report.

The test has not changed. The cases are easier to detect because they are further from the threshold. The controls are easier to clear because the hard non-cases, older adults with glucose just below the diabetic range, were left out. A reader who took the second row to a screening program would expect HbA1c to catch 84% of undiagnosed diabetes, and would find it catches under half. The defense is in the design. Evaluate a test in a consecutive or random series of the patients in whom it will be used, as NHANES does. Then report the spectrum of the patients studied.

Verification bias

A second bias arises when the reference standard is not applied to everyone. In clinical studies the reference is often costly or invasive (a biopsy, an angiogram), and clinicians tend to order it for patients whose index test was positive. If only the verified patients are analyzed, the cases that the test missed are mostly never found, and the test looks more sensitive than it is. This is verification bias, also called work-up bias.

NHANES measured FPG on everyone, so its data have no verification bias. The script imposes an invented verification rule on them to show the effect. Every adult with a positive HbA1c was "verified" by having the FPG reference recorded. Each adult with a negative HbA1c was verified with probability 0.10.

Example (verifying only a tenth of the negatives). Computed from the verified adults alone, sensitivity rises and specificity falls. Over 30 seeds, the sensitivity from the verified adults alone had a median of 0.900 (interquartile range 0.885 to 0.915), nearly double the true 0.470. Specificity fell to a median of 0.880 (0.875 to 0.885). All 25 false positives and all 54 true positives were kept, but only about a tenth of the 1,835 true negatives and of the 61 false negatives. In expected counts the verified sample has 54 true positives and 6.1 false negatives, so the apparent sensitivity is $54/(54 + 6.1) = 0.899$. It has 183.5 true negatives and 25 false positives, so the apparent specificity is $183.5/(183.5 + 25) = 0.880$. The simulated medians agree with both.

The direction of the bias is not special to this rule. Suppose the decision to verify depends only on the test result, and write $v_+$ for the share of the positives that is verified and $v_-$ for the share of the negatives, both positive.

Proposition. If $v_+ > v_-$ and all four cells of the table are positive, then in expected counts the verified adults overstate the sensitivity and understate the specificity. If $v_+ = v_-$ there is no bias in either.

Proof. The verified adults contain $\mathrm{TP}\,v_+$ true positives and $\mathrm{FN}\,v_-$ false negatives in expectation, so the apparent sensitivity is $\mathrm{TP}\,v_+/(\mathrm{TP}\,v_+ + \mathrm{FN}\,v_-)$. Dividing its numerator and denominator by $v_+$ gives $\mathrm{TP}/(\mathrm{TP} + \mathrm{FN}\,v_-/v_+)$. Since $v_-/v_+ < 1$ and $\mathrm{FN} > 0$, the denominator is smaller than $\mathrm{TP} + \mathrm{FN}$, and the quotient is larger than $\mathrm{TP}/(\mathrm{TP} + \mathrm{FN})$. In the same way the apparent specificity is $\mathrm{TN}\,v_-/(\mathrm{TN}\,v_- + \mathrm{FP}\,v_+) = \mathrm{TN}/(\mathrm{TN} + \mathrm{FP}\,v_+/v_-)$. Since $v_+/v_- > 1$ and $\mathrm{FP} > 0$, its denominator is larger than $\mathrm{TN} + \mathrm{FP}$, and the quotient is smaller than $\mathrm{TN}/(\mathrm{TN} + \mathrm{FP})$. With $v_+ = v_-$ both ratios are 1 and both quotients are the true values. $\square$

The expected values 0.899 and 0.880 above are these two formulas with $v_+ = 1$ and $v_- = 0.1$. The statement is about expected counts; a single verified sample scatters around them, as the interquartile ranges show.

The bias can be undone when the decision to verify depends only on the test result. Here is the idea. Within each result the verified patients are then a fair sample, and the whole population can be rebuilt from everyone's test results.

The formal version. Begg and Greenes (1983) gave the correction for this case. Write $V$ for the event that a patient is verified. The assumption is that, among patients with a given test result, verification does not depend on the disease status: $P(V \mid T^+ \cap D) = P(V \mid T^+)$, and the same for $T^-$. A second assumption is needed for the division below and for the estimates: both $P(V \mid T^+)$ and $P(V \mid T^-)$ are positive, so that some patients with each result are verified, and each of $T^+ \cap D$, $T^+ \cap D^c$, $T^- \cap D$ and $T^- \cap D^c$ has positive probability. Then the verified patients with a given result have the same probability of disease as all patients with that result. By the definition of conditional probability and the multiplication rule,

$$P(D \mid T^+ \cap V) = \frac{P(D \cap V \mid T^+)}{P(V \mid T^+)} = \frac{P(D \mid T^+)\,P(V \mid T^+ \cap D)}{P(V \mid T^+)} = P(D \mid T^+),$$

and the same steps with $T^-$ in place of $T^+$ give $P(D \mid T^- \cap V) = P(D \mid T^-)$. (Conditional probabilities given $T^+$ obey all the rules of probability, as the previous unit proved, which justifies using the definition and the multiplication rule inside the condition.) So $P(D \mid T^+)$ and $P(D \mid T^-)$ can be estimated from the verified patients, while $P(T^+)$ and $P(T^-)$ can be estimated from everyone tested. Bayes' theorem, from Conditional Probability and the Law of Total Probability, recombines them. With the partition $T^+$, $T^-$ and the event $D$ it gives the sensitivity, and with the same partition and the event $D^c$ the specificity:

$$\mathrm{Se} = P(T^+ \mid D) = \frac{P(T^+)\,P(D \mid T^+)}{P(T^+)\,P(D \mid T^+) + P(T^-)\,P(D \mid T^-)},$$

$$\mathrm{Sp} = P(T^- \mid D^c) = \frac{P(T^-)\,P(D^c \mid T^-)}{P(T^-)\,P(D^c \mid T^-) + P(T^+)\,P(D^c \mid T^+)}.$$

In the simulation the corrected sensitivity had a median of 0.481 (0.438 to 0.518) and the corrected specificity 0.9866, centered on the true values. Problem 3 below carries out the correction on one of the 30 verified samples. The spread in sensitivity comes from estimating $P(D \mid T^-)$ from about 190 verified negatives. The correction fails if verification also depends on something related to disease that the analyst does not see, such as how ill the patient looked.

Screening and confirmation

Back to the question of whether HbA1c is a good test. Which property matters more depends on what the test is for.

  • A screening test is applied to people without symptoms, to find those who should be examined further. A missed case may not be found again for years, while a false positive costs a confirmatory test. So screening favors sensitivity.
  • A confirmatory test is applied to people who screened positive, to decide on a diagnosis and treatment. A false positive now means a wrong diagnosis, so confirmation favors specificity. The ADA's rule that a diagnosis needs two abnormal results is a confirmation step of this kind (ADA, 2025).

On that view HbA1c at 6.5% is a poor screen and a reasonable confirmer. Its positive results are usually confirmed by fasting glucose, but it misses most cases. A lower HbA1c cut-off, such as the prediabetes boundary of 5.7%, trades specificity for sensitivity. ROC Curves for Diagnostic Tests traces that trade-off over every cut-off. A cut-off chosen to make the fewest errors weighs the two kinds equally, which neither purpose above calls for: against a different reference, a doctor's diagnosis, among 5,210 NHANES adults of the same survey, that cut-off is 6.7% (Empirical Risk Minimization).

Example (a common misstatement: the sensitivity of several tests together). A program that applies several tests and counts a person positive if any test is positive is often said to detect a case with probability $1 - \prod_i (1 - \mathrm{Se}_i)$. The formula holds when the tests' results are independent among the people who have the condition, and not in general. Likelihood Ratios for Diagnostic Tests measures the difference for two real measurements, HbA1c and body mass index: the formula promises a combined sensitivity of 0.944, and the observed one is 0.938.

Summary

Quantity Definition Here
Prevalence $(\mathrm{TP} + \mathrm{FN})/N$ 0.0582
Sensitivity $P(T^+ \mid D) = \mathrm{TP}/(\mathrm{TP} + \mathrm{FN})$ 0.470
Specificity $P(T^- \mid D^c) = \mathrm{TN}/(\mathrm{TN} + \mathrm{FP})$ 0.987
False negative rate $1 - \mathrm{Se}$ 0.530
False positive rate $1 - \mathrm{Sp}$ 0.013
Accuracy $\pi\,\mathrm{Se} + (1 - \pi)\,\mathrm{Sp}$ 0.956

Worked problems

These problems are posed on the unit's own data, the 1,975 NHANES adults and the samples the article's script draws from them, and each is solved from the results above; none is taken from the course text. The script recomputes every number.

Problem 1. Lower the cut-off: call HbA1c positive at 6.0% or more. Of the 115 adults with a fasting glucose of 126 mg/dL or more, 86 are then positive, and of the 1,860 others, 217 are. Build the 2 by 2 table, find the sensitivity, the specificity, the two error rates and the accuracy, and compare each with its value at 6.5%.

The table. The false negatives are $115 - 86 = 29$ and the true negatives $1{,}860 - 217 = 1{,}643$:

HbA1c FPG $\ge$ 126 FPG $<$ 126 Total
$\ge 6.0\%$ 86 217 303
$< 6.0\%$ 29 1,643 1,672
Total 115 1,860 1,975

The measures. Sensitivity is $86/115 = 0.7478$ and specificity $1{,}643/1{,}860 = 0.8833$. The false negative rate is $29/115 = 0.2522$ and the false positive rate $217/1{,}860 = 0.1167$. The Wilson 95% intervals are $(0.661,\ 0.818)$ for the sensitivity and $(0.868,\ 0.897)$ for the specificity.

Accuracy. $(86 + 1{,}643)/1{,}975 = 1{,}729/1{,}975 = 0.8754$. As a weighted average, $0.0582 \times 0.7478 + 0.9418 \times 0.8833 = 0.8754$.

The comparison. Lowering the cut-off from 6.5% to 6.0% finds 32 more of the 115 cases, raising the sensitivity from 0.470 to 0.748, and flags 192 more of the adults without the condition, lowering the specificity from 0.987 to 0.883. The accuracy falls from 0.9565 to 0.8754, below the 0.9418 of the rule that calls everybody negative. So by accuracy the cut-off that detects three quarters of the cases ranks below a rule that detects none. That is the defect of accuracy described above, in numbers.

Problem 2. Use the planning formula $n = 1.96^2\,p(1 - p)/h^2$. (a) How many adults without the condition does a study need to estimate a specificity near 0.9866 to within $\pm 0.005$, and how many adults must be screened to find them? (b) How many cases does it need to estimate the sensitivity of the 6.0% cut-off, near 0.7478, to within $\pm 0.05$, and how many adults must be screened?

(a) With $p = 0.9866$, $p(1 - p) = 0.9866 \times 0.0134 = 0.01326$ (from the unrounded specificity), and

$$n = \frac{3.8416 \times 0.01326}{0.005^2} = \frac{0.05094}{0.000025} = 2{,}037.6,$$

so 2,038 adults without the condition. They are 1,860 of every 1,975 adults screened, so the study must screen $2{,}038 \times 1{,}975/1{,}860 = 2{,}164.01$ adults, which rounds up to 2,165. The 1,860 adults of this unit give a margin of 0.0052, close to the target.

(b) With $p = 0.7478$, $p(1 - p) = 0.1886$, and

$$n = \frac{3.8416 \times 0.1886}{0.05^2} = \frac{0.7245}{0.0025} = 289.8,$$

so 290 cases. Cases are 115 of every 1,975 adults screened, so the study must screen $290 \times 1{,}975/115 = 4{,}980.4$ adults, which rounds up to 4,981. The two answers show where the cost of an accuracy study lies. A specificity can be pinned down to half a percentage point with about two thousand people. A sensitivity known only to within five points needs nearly five thousand, because the cases are scarce.

Problem 3. In the first of the 30 simulated verification studies (seed 0), all 79 adults with a positive HbA1c were verified, and so were 198 of the 1,896 with a negative HbA1c. Among the verified positives 54 had the condition, and among the verified negatives 6 had it. Compute the sensitivity and specificity from the verified adults alone, and then with the Begg–Greenes correction.

The verified table. It has 54 true positives, $79 - 54 = 25$ false positives, 6 false negatives and $198 - 6 = 192$ true negatives, 277 adults in all.

Verified adults alone. Sensitivity is $54/(54 + 6) = 0.900$ and specificity $192/(192 + 25) = 0.8848$. The true values are 0.4696 and 0.9866.

The correction. From everyone tested, $P(T^+) = 79/1{,}975 = 0.0400$ and $P(T^-) = 0.9600$. From the verified adults, $P(D \mid T^+) = 54/79 = 0.6835$ and $P(D \mid T^-) = 6/198 = 0.0303$. Then

$$\mathrm{Se} = \frac{0.0400 \times 0.6835}{0.0400 \times 0.6835 + 0.9600 \times 0.0303} = \frac{0.02734}{0.02734 + 0.02909} = \frac{0.02734}{0.05643} = 0.4845,$$

$$\mathrm{Sp} = \frac{0.9600 \times 0.9697}{0.9600 \times 0.9697 + 0.0400 \times 0.3165} = \frac{0.93091}{0.93091 + 0.01266} = \frac{0.93091}{0.94357} = 0.9866.$$

The corrected sensitivity, 0.4845, is close to the true 0.4696. The corrected specificity equals the true value to four places. The denominator of the sensitivity, 0.05643, is the estimated prevalence: it implies 111.5 cases among the 1,975 adults, against the true 115. The correction works by scaling the 6 verified false negatives back up to the roughly 57 that their share of the negatives implies, $0.0303 \times 1{,}896 = 57.4$.

Problem 4. The sensitivities of HbA1c at 6.5% in the three glucose bands are $15/59 = 0.2542$, $24/39 = 0.6154$ and $15/17 = 0.8824$. Suppose the test were used in a clinic where 20% of the undiagnosed cases are in the lowest band, 30% in the middle band and 50% in the highest, and that the sensitivity within each band is the same as here. Find the overall sensitivity there.

By the case-mix formula, the overall sensitivity is the average of the band sensitivities, weighted by the shares of the cases:

$$\mathrm{Se} = 0.2 \times 0.2542 + 0.3 \times 0.6154 + 0.5 \times 0.8824 = 0.0508 + 0.1846 + 0.4412 = 0.6766.$$

In the NHANES adults the shares are 0.513, 0.339 and 0.148, and the same formula gives 0.4696. The test and its behavior within each band are identical in the two settings; the sensitivity differs by 21 points because the cases differ. The clinic's mix is invented for the problem. The assumption that the band sensitivities carry over is the part that a real comparison would have to check.

What we have learned

Sensitivity and specificity describe a test by conditioning on the truth: HbA1c at 6.5% flags 47.0% of the adults whose fasting glucose is diabetic and clears 98.7% of the others. Because each is computed within one column, neither depends on prevalence, which is why accuracy, a prevalence-weighted average of the two, misleads. They are still not constants. They depend on the reference standard chosen and on the severity of the cases: sensitivity runs from 0.25 to 0.88 across glucose levels. Study designs that pick easy cases and controls, or verify only the positives, distort them further.

Neither number answers the patient's question. The adult with a positive HbA1c knows the result, not the disease status, and needs the probability conditioned the other way. Predictive Values and Bayes' Theorem reverses the conditioning, and shows how strongly the answer depends on how common the condition is.

In Python

from scipy.stats import binomtest

tp, fp, fn, tn = 54, 25, 61, 1835            # HbA1c >= 6.5% against FPG >= 126 mg/dL
for name, x, n in [('sensitivity', tp, tp + fn), ('specificity', tn, tn + fp)]:
    ci = binomtest(x, n).proportion_ci(confidence_level=0.95, method='wilson')
    print(name, round(x / n, 4), round(ci.low, 4), round(ci.high, 4))
# sensitivity 0.4696 0.3808 0.5603
# specificity 0.9866 0.9802 0.9909

Every number in this article is computed by tools/experiments/applied-statistics/sensitivity-and-specificity.py in the site's repository, from the NHANES files loaded by screendata.py; the intervals were checked against scipy 1.15.2.

References

  • American Diabetes Association Professional Practice Committee (2025). 2. Diagnosis and classification of diabetes: Standards of Care in Diabetes–2025. Diabetes Care, 48(Suppl. 1), S27–S49. https://doi.org/10.2337/dc25-S002 record · 7 pages
  • Begg, C. B., and Greenes, R. A. (1983). Assessment of diagnostic tests when disease verification is subject to selection bias. Biometrics, 39(1), 207–215. record
  • National Center for Health Statistics (2020a). NHANES 2017–2018 Laboratory Data: Plasma Fasting Glucose (GLU_J). Data documentation and codebook. Centers for Disease Control and Prevention. https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2017/DataFiles/GLU_J.htm record
  • National Center for Health Statistics (2020b). NHANES 2017–2018 Laboratory Data: Glycohemoglobin (GHB_J). Data documentation and codebook. Centers for Disease Control and Prevention. https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2017/DataFiles/GHB_J.htm record
  • National Center for Health Statistics (2020c). National Health and Nutrition Examination Survey 2017–2018: DEMO_J and DIQ_J data files. Centers for Disease Control and Prevention. https://wwwn.cdc.gov/nchs/nhanes/continuousnhanes/default.aspx?BeginYear=2017 record · 109 pages
  • Pagano, M., Gauvreau, K., and Mattie, H. (2022). Principles of Biostatistics (3rd ed.). CRC Press. The course text. record · 48 pages
  • Ransohoff, D. F., and Feinstein, A. R. (1978). Problems of spectrum and bias in evaluating the efficacy of diagnostic tests. New England Journal of Medicine, 299(17), 926–930. record · 2 pages
  • Yerushalmy, J. (1947). Statistical problems in assessing methods of medical diagnosis, with special reference to X-ray techniques. Public Health Reports, 62(40), 1432–1449. record

Reviewed: verified, 16 Nov 2026 · citations checked, 16 Nov 2026 · editorial review, 23 Nov 2026 · 9 revisions