Sensitivity, Specificity and Predictive Values
Every diagnostic test produces a result that is used to classify a patient as likely diseased or likely healthy. The performance of that classification — how often the test is correct, and in what ways it can be wrong — is described by a small family of measures derived from the 2×2 diagnostic table, which cross-classifies test results against the true disease status established by a reference standard. Sensitivity and specificity describe the test's intrinsic discriminating ability, independent of disease prevalence. The positive predictive value (PPV) and negative predictive value (NPV) describe the probability that a given result is correct in a specific population, and depend critically on how common the disease is in that population. Understanding the distinction between these two pairs of measures is essential for interpreting diagnostic research and for applying test results in clinical practice.
The 2×2 Diagnostic Table
A dichotomous test — one that returns a positive or negative result — is evaluated by applying it to a group of subjects whose true disease status has been established by a reference standard (a gold standard or criterion standard). The results are arranged in a 2×2 table:
| Disease present | Disease absent | Total | |
|---|---|---|---|
| Test positive | TP (true positives) | FP (false positives) | TP + FP |
| Test negative | FN (false negatives) | TN (true negatives) | FN + TN |
| Total | TP + FN | FP + TN | $n$ |
The four cells have natural names: true positives (TP) are diseased patients correctly identified by the test; false positives (FP) are healthy patients incorrectly labelled positive; false negatives (FN) are diseased patients missed by the test; and true negatives (TN) are healthy patients correctly cleared. Every measure of diagnostic performance is a ratio computed from one or more of these four quantities.
Sensitivity and Specificity
Sensitivity and specificity are computed within columns of the diagnostic table — they are conditional on true disease status, which is why they do not depend on disease prevalence.
The sensitivity of a test is the proportion of truly diseased patients who test positive:
$$ \text{Se} = \frac{\text{TP}}{\text{TP} + \text{FN}} $$A test with high sensitivity misses few cases. Sensitivity is therefore the key property when the purpose is to rule out disease: a highly sensitive test that comes back negative makes disease unlikely. The complement $1 - \text{Se}$ is the false negative rate — the proportion of diseased patients incorrectly classified as negative.
The specificity of a test is the proportion of truly healthy subjects who test negative:
$$ \text{Sp} = \frac{\text{TN}}{\text{FP} + \text{TN}} $$A test with high specificity generates few false alarms. Specificity is therefore the key property when the purpose is to rule in disease: a highly specific test that comes back positive makes disease very likely. The complement $1 - \text{Sp}$ is the false positive rate — the proportion of healthy patients incorrectly classified as positive. The false positive rate is also the horizontal axis of the ROC curve (see the ROC curve analysis chapter).
Sensitivity and specificity describe different conditional probabilities and they move in opposite directions as a decision threshold is raised or lowered. Raising the threshold makes the test less willing to call a result positive: fewer false positives (higher specificity) but more missed cases (lower sensitivity). This inescapable trade-off is the central problem of threshold selection.
Predictive Values
Sensitivity and specificity answer the question: "How does the test perform in known diseased and healthy subjects?" But a clinician looking at an individual test result needs to answer the inverse question: "Given that this patient's test is positive, what is the probability they actually have the disease?" The predictive values answer this question by reading across the rows of the diagnostic table rather than down the columns.
The positive predictive value is the proportion of positive test results that are true positives:
$$ \text{PPV} = \frac{\text{TP}}{\text{TP} + \text{FP}} $$The negative predictive value is the proportion of negative test results that are true negatives:
$$ \text{NPV} = \frac{\text{TN}}{\text{FN} + \text{TN}} $$Unlike sensitivity and specificity, predictive values depend on the number of diseased and healthy subjects in the study sample — if this reflects the disease prevalence in the population from which the sample was drawn. The same test will have different predictive values in a high-prevalence specialist clinic and a low-prevalence community screening programme.
A further summary measure is the overall accuracy:
$$ \text{Accuracy} = \frac{\text{TP} + \text{TN}}{n} $$Accuracy is intuitive but can be misleading when disease is rare. A test that labels every patient as disease-free will have 99% accuracy in a population with 1% prevalence, yet miss every single case. The clinical consequences of the two error types are usually very different, which is why sensitivity and specificity, rather than overall accuracy, are the primary measures of test performance.
The Effect of Prevalence
The relationship between predictive values and disease prevalence $\pi$ follows directly from Bayes' theorem:
$$ \text{PPV} = \frac{\text{Se} \times \pi}{\text{Se} \times \pi \;+\; (1 - \text{Sp})(1 - \pi)} $$ $$ \text{NPV} = \frac{\text{Sp} \times (1 - \pi)}{\text{Sp} \times (1 - \pi) \;+\; (1 - \text{Se}) \times \pi} $$These formulas show the mechanism clearly. The numerator of PPV is the probability of a true positive: the probability of disease ($\pi$) times the probability that the test is positive given disease ($\text{Se}$). The denominator adds the probability of a false positive: the probability of no disease ($1 - \pi$) times the probability of a positive test in a healthy person ($1 - \text{Sp}$). As prevalence falls, the false positive term in the denominator grows relative to the true positive term, and the PPV falls — sometimes dramatically.
The practical implication is that a test validated in a specialist clinic, where the population presenting already has high pre-test probability, will perform differently — and usually worse in terms of PPV — when deployed as a general population screening tool. Sensitivity and specificity are transferable across settings (they are intrinsic to the test); predictive values are not.
Worked Example
A rapid antigen test for influenza is evaluated during the winter season in an outpatient clinic. A total of 150 patients presenting with acute respiratory illness are tested simultaneously with the rapid antigen test and with RT-PCR as the reference standard. The results are:
| PCR positive | PCR negative | Total | |
|---|---|---|---|
| Rapid test positive | 45 | 3 | 48 |
| Rapid test negative | 5 | 97 | 102 |
| Total | 50 | 100 | 150 |
The four performance measures computed directly from the table are:
$$ \text{Se} = \frac{45}{50} = 90\%, \qquad \text{Sp} = \frac{97}{100} = 97\% $$ $$ \text{PPV} = \frac{45}{48} \approx 93.8\%, \qquad \text{NPV} = \frac{97}{102} \approx 95.1\% $$In this clinical sample, 50 of 150 patients (33.3%) had confirmed influenza — a prevalence that reflects symptomatic patients presenting during peak season. At this prevalence, the test performs well in both directions: a positive result is correct in about 94% of cases, and a negative result is correct in about 95%.
Now consider the same test deployed as a community screening programme, where prevalence is 5%. Applying the Bayes formulas with $\text{Se} = 0.90$ and $\text{Sp} = 0.97$:
$$ \text{PPV} = \frac{0.90 \times 0.05}{0.90 \times 0.05 \;+\; 0.03 \times 0.95} = \frac{0.045}{0.0735} \approx 61\% $$ $$ \text{NPV} = \frac{0.97 \times 0.95}{0.97 \times 0.95 \;+\; 0.10 \times 0.05} = \frac{0.9215}{0.9265} \approx 99.5\% $$The PPV has fallen from 93.8% to 61%: nearly two in five positive results are now false positives, despite the test's characteristics being unchanged. The NPV has risen slightly to 99.5%: a negative result is highly reassuring because disease is already rare. This asymmetry — the NPV is high, the PPV is poor — is the typical pattern for any test applied to a low-prevalence population, and explains why mass screening with a test that is not highly specific generates large numbers of false alarms.
Confidence Intervals
Sensitivity, specificity, PPV, and NPV are all estimated from a finite sample and each should be reported with a 95% confidence interval. The appropriate method differs by measure.
For sensitivity and specificity, MedCalc uses the Clopper–Pearson exact interval. This interval is derived directly from the binomial distribution — inverting the exact binomial test — and is valid for any sample size and any true proportion, including values near 0 or 1. It is more conservative (wider) than interval methods based on normal approximations, but avoids the coverage problems those approximations exhibit with small denominators.
For predictive values (PPV and NPV), MedCalc uses the standard logit confidence interval described by Mercaldo et al. (2007). The logit transformation maps a proportion to the full real line, allowing a symmetric normal-distribution interval to be constructed on the logit scale and then back-transformed to the (0, 1) probability scale. This outperforms the simple Wald interval in the small-sample settings common when disease is rare.
For the likelihood ratios (LR+ and LR−), MedCalc uses the log method described on page 109 of Altman et al. (2000): a confidence interval is constructed on the log scale using a normal approximation to the standard error of $\ln(\text{LR})$, then back-transformed.
The width of confidence intervals for sensitivity and specificity depends on the sample size in the relevant denominator — the number of diseased subjects for sensitivity, the number of healthy subjects for specificity — not the total $n$. A study of 200 subjects with only 20 confirmed cases will yield an imprecise sensitivity estimate regardless of how many healthy controls are enrolled. Adequate precision for both measures requires careful attention to the number of subjects in each disease group at the design stage.
The next chapter extends this framework to continuous test variables, where sensitivity and specificity can be evaluated at every possible threshold.
MedCalc computes sensitivity, specificity, predictive values, accuracy, and their 95% confidence intervals in its ROC curve procedure.