Sensitivity and Specificity Calculator

Sensitivity and Specificity Calculator

Evaluate a diagnostic test against a reference standard: sensitivity, specificity, predictive values and likelihood ratios, each with a 95% confidence interval.

Sensitivity = TP ÷ (TP + FN) · Specificity = TN ÷ (TN + FP)

Enter the four counts from your validation study

What Are Sensitivity and Specificity?

Sensitivity is the share of people with a condition whom a test correctly picks up; specificity is the share of people without it whom the test correctly clears. Together they describe how good the test itself is.

A highly sensitive test rarely misses a case, so a negative result rules the condition out ("SnNout"). A highly specific test rarely raises a false alarm, so a positive result rules it in ("SpPin").

Predictive values answer the patient's question ("I tested positive; do I have it?"), but they depend on how common the condition is. Likelihood ratios carry the test's strength to any setting.

Sensitivity and Specificity Formulas

As given in Altman & Bland, "Diagnostic tests 1–3" (BMJ, 1994), with Wilson intervals and log-method intervals for likelihood ratios. See Sources.

1. Test properties

sensitivity = TP ÷ (TP + FN) · specificity = TN ÷ (TN + FP)

2. Predictive values

PPV = TP ÷ (TP + FP) · NPV = TN ÷ (TN + FN)

3. Likelihood ratios

LR+ = sensitivity ÷ (1 − specificity) · LR− = (1 − sensitivity) ÷ specificity

Worked Example: A Rapid Test Checked Against PCR

Given:
500 people take a rapid test and a PCR (the reference). PCR finds 100 infections; the rapid test catches 85 of them and gives 4 false positives among the other 400.
Step 1:
Sensitivity and specificity:
85 ÷ 100 = 85% (76.7–90.7) · 396 ÷ 400 = 99% (97.5–99.6)
Step 2:
Likelihood ratios:
LR+ = 0.85 ÷ 0.01 = 85 · LR− = 0.15 ÷ 0.99 = 0.152
Step 3:
Predictive values in this group (20% infected):
PPV 85 ÷ 89 = 95.5% · NPV 396 ÷ 411 = 96.4%
Result:
LR+ = 85: a positive is near-conclusive

But it misses 15% of infections, so a negative doesn't clear someone with symptoms. With only 4 false positives, the specificity interval is narrow, but LR+ is uncertain: anywhere from about 32 to 226.

How to Read Likelihood Ratios

Rough guide to the strength of likelihood ratios
LR+LR−Effect on probability
> 10< 0.1Large, often conclusive
5 to 100.1 to 0.2Moderate
2 to 50.2 to 0.5Small but sometimes useful
1 to 20.5 to 1Little or none

Common Sensitivity and Specificity Mistakes

  • Carrying predictive values to another setting. A PPV from a hospital study will be far lower in general screening, where the condition is rarer.
  • Quoting point estimates from small studies. 9 out of 10 is 90% sensitivity, but the interval runs from about 60% to 98%.
  • Choosing an imperfect reference. If the "gold standard" itself misses cases, the new test's figures are biased.
  • Testing only clear-cut cases. Studies of very sick patients against healthy volunteers overstate how well a test works on real, borderline patients.

Sensitivity and Specificity FAQs

What is the difference between sensitivity and PPV?

Sensitivity asks “of the ill, how many test positive?”; PPV asks “of the positives, how many are ill?”. Only PPV depends on prevalence.

Which matters more?

For ruling out a dangerous condition, sensitivity. For confirming before a risky treatment, specificity.

How are the intervals calculated?

Wilson score intervals for the four proportions and the standard log method for the likelihood ratios, all at 95%.

Why is LR+ shown as ∞?

With no false positives, specificity is 100% and LR+ divides by zero. Report it as very large and look at the specificity interval.

Can I improve both at once?

Not with the same test; moving the cut-off trades one for the other. A better test, or a second test, can improve both.

What is the Youden index?

Sensitivity + specificity − 1, a one-number summary used to choose cut-offs. See the Youden index calculator.

Is sensitivity the same as recall?

Yes. Machine learning calls it recall.

What does SnNout mean?

A highly Sensitive test, when Negative, rules the condition out. SpPin: a highly Specific test, when Positive, rules it in.

Sources

Related Tools