Sensitivity and specificity
A diagnostic two-by-two table estimates sensitivity, specificity and predictive values at one fixed threshold, each with its own uncertainty.
Fit
When to use it, and when not to
Use it when
- You have a binary test result and a reference diagnosis for the same patients.
- You need accuracy estimates at a threshold fixed before examining outcomes.
Not when
- Your score has many thresholds and you need its overall ranking. Use an ROC curve. Read: ROC curves and diagnostic thresholds
- Neither measurement is a reference diagnosis. Use an agreement study. Read: Agreement and reliability studies
- You compare paired sensitivities rather than estimate one sensitivity. Use McNemar’s test within reference-positive patients. Read: McNemar’s test
Before you start
What you need
- Four labeled countsRecord true positives, false negatives, false positives and true negatives against the same reference standard.
- How patients entered the samplePredictive values require the intended population prevalence. A case-control sample fixes the disease fraction by design.
- A fixed threshold and target conditiontargetSpecify what counts as a positive test and a positive reference diagnosis.
- Missing and indeterminate resultsKeep their counts and reasons. Choose a missing-data method under a stated assumption; do not silently discard difficult cases.
- The reference standard is credible and read independently.How to check: Name its errors, blinding and timing. An imperfect reference distorts accuracy.
- Verification does not depend on an unobserved diagnosis.How to check: Check whether everyone received the reference standard. Partial verification needs a justified correction.
- Each patient contributes one independent pair of results.How to check: For repeated lesions, visits or clustered sampling, use cluster-aware intervals rather than independent binomial intervals.
- The complete table is representative under the stated missingness assumption.How to check: Complete-case analysis needs justification. Under missing at random, consider imputation or weighting; assess missing not at random with sensitivity analyses.
Plain language
How it works
Arrange test-positive and test-negative rows against reference-positive and reference-negative columns. Sensitivity is true positives divided by all reference positives. Specificity is true negatives divided by all reference negatives. Positive predictive value uses all test positives; negative predictive value uses all test negatives.
For an independent, complete cohort table, each is a single binomial proportion. Wilson or Clopper-Pearson intervals fit those estimators. Predictive values standardized to external prevalence need intervals that also reflect the estimated inputs. Mercaldo and colleagues address that different sampling problem.
Worked example
A worked example
- Setting
- 1,000 consecutive patients each receive a binary index test and a blinded reference standard. There are no missing or indeterminate results.
- Question
- What are the four accuracy estimates and their uncertainty at this fixed threshold?
- Approach
- The table contains 85 true positives, 15 false negatives, 180 false positives and 720 true negatives. Use separate Wilson intervals for each proportion.
- Result
- Sensitivity is 85.0% (95% Wilson interval 76.7% to 90.7%). Specificity is 80.0% (95% Wilson interval 77.3% to 82.5%). Positive predictive value is 32.1% (95% Wilson interval 26.7% to 37.9%). Negative predictive value is 98.0% (95% Wilson interval 96.7% to 98.8%).
- What it means
- The sample prevalence is 10.0%. Of 265 positive tests, 85 identify disease; of 735 negative tests, 720 correctly exclude it.
In practice
Recent studies PubMed search · not vetted
Watch out
Common mistakes
The one to remember
Sensitivity and specificity condition on reference diagnosis; predictive values condition on test result and depend on prevalence. Independent-binomial intervals need independent patients and a credible reference standard. A case-control table cannot directly estimate population predictive values.
- Using the same denominator for every estimate.Instead: Sensitivity uses reference-positive people; specificity uses reference-negative people. Predictive values condition on the observed test result.
- Transporting predictive values from a case-control sample.Instead: Use target prevalence and a suitable variance method. A Wilson interval for a simple proportion does not cover an externally standardized estimate.
- Treating high specificity as a high chance that a positive test is correct.Instead: That chance is positive predictive value, which also depends on prevalence.
Inside Mallard
How Mallard uses this
Mallard’s diagnostic calculator reports these four proportions with Wilson intervals. The method registry links diagnostic accuracy to this article and code.
diagnostic-accuracy-wilson).analysis.sensitivity_specificity, the id a plan cue records.How to report it
Report all four cells, sampling, reference standard, threshold, missing results, prevalence and each estimate with its named interval method. A reporting guideline is not a design manual: use it to make the study transparent, not as a substitute for careful design. Check the target journal's own requirements as well, which this page cannot know.
Work it out
Related Learn pages
Related designs and methods
Evidence
Sources & further reading
- Two-sided confidence intervals for the single proportion: comparison of seven methods. (opens in a new tab) · Stat Med · doi 10.1002/(sici)1097-0258(19980430)17:8<857::aid-sim777>3.0.co;2-e
- Confidence intervals for predictive values with an emphasis to case-control studies. (opens in a new tab) · Stat Med · doi 10.1002/sim.2677