Diagnostic Test Calculator (Sensitivity, Specificity, PPV, NPV)

Free diagnostic accuracy calculator: enter a 2x2 table to get sensitivity, specificity, PPV, NPV and likelihood ratios with 95% confidence intervals, plus how predictive values change with prevalence.

Enter the four counts from a 2×2 table (test result vs true disease status) to get sensitivity, specificity, PPV, NPV and likelihood ratios with 95% confidence intervals — and see how the predictive values shift with disease prevalence.

TP/FN = diseased; FP/TN = healthy. Test positive = TP + FP.

How to use it

Reading the numbers

  • Sensitivity and specificity are properties of the test — they don’t change with prevalence.
  • PPV and NPV — what a patient actually cares about (“I tested positive, do I have it?”) — do depend on prevalence. The same test looks very different in a screening population versus a specialist clinic, which is exactly what the curve above shows.
  • Likelihood ratios combine sensitivity and specificity into one number per result and feed directly into updating pre-test odds. LR+ well above 10 (or LR− below 0.1) meaningfully shifts diagnosis.

Confidence intervals here use the Wilson method, which behaves well even for small counts or proportions near 0 or 1.

Do it in R

sens <- 90 / (90 + 20); spec <- 180 / (180 + 10)
ppv  <- 90 / (90 + 10); npv  <- 180 / (180 + 20)
c(sens, spec, ppv, npv)

Full walkthrough: Sensitivity, specificity, PPV and NPV in R.

FAQ

Frequently asked questions

Why do PPV and NPV change but sensitivity and specificity don’t?

Sensitivity and specificity are conditional on true disease status, so they’re fixed properties of the test. Predictive values also depend on how common the disease is — so they shift with prevalence.

The PPV from my study seems too low — is the test bad?

Not necessarily. At low prevalence, even an excellent test produces many false positives relative to true positives, dragging PPV down. Report predictive values with the prevalence they assume.


Evaluating a test on real data, with proper intervals and a write-up? That’s our clinical work.