Skip to content
induwara.lk
Premium
induwara.lkHealth · Epidemiology

Diagnostic Test Statistics Calculator — Sensitivity, Specificity, PPV, NPV & Likelihood Ratios

Enter a 2×2 test table and get sensitivity, specificity, PPV, NPV, positive and negative likelihood ratios, the diagnostic odds ratio and Youden's J — each with its formula and a 95% confidence interval. Then re-project PPV, NPV and post-test probability onto any disease prevalence. Free, no signup, runs in your browser.

By Induwara AshinsanaUpdated Jul 10, 2026
Evaluate a diagnostic test2×2 or rates
Bayes cross-checked

Test positive · disease present

Test positive · disease absent

Test negative · disease present

Test negative · disease absent

N = 200Diseased = 55Healthy = 145Test+ = 50Test− = 150
%

Re-projects PPV, NPV and post-test probability onto a population with this disease prevalence. Leave blank to use the sample's own prevalence (27.5%).

Try a preset
Sensitivity
85.45%
95% CI 73.84%92.44%
Specificity
97.93%
95% CI 94.09%99.29%
Accuracy
94.5%
95% CI 90.42%96.9%
PPV (sample)
94%
95% CI 83.78%97.94%
NPV (sample)
94.67%
95% CI 89.83%97.27%
Youden's J
0.834

Likelihood ratios & odds

LR+
41.3
Sens / (1 − Spec)

Strong — a positive result markedly raises the probability of disease.

LR−
0.149
(1 − Sens) / Spec

Moderate — a negative result meaningfully lowers disease probability.

Diagnostic OR
278
(TP·TN) / (FP·FN)

LR+ ÷ LR− — one number for overall discrimination.

Youden's J
0.834
Sens + Spec − 1

Sens + Spec − 1, range 0–1.

PPV / NPV vs prevalence

PrevalencePPVNPV
1%29.44%99.85%
5%68.49%99.22%
10%82.11%98.38%
25%93.23%95.28%
50%97.64%87.07%

Formulas: Altman & Bland (BMJ 1994) for sensitivity/specificity/PPV/NPV; Deeks & Altman (BMJ 2004) for likelihood ratios and post-test probability; Wilson score for the 95% confidence intervals. Full citations and worked examples are below the tool.

How it works

A diagnostic test is scored against a reference (“gold”) standard. Cross-tabulating the two gives four counts: true positives (TP), false positives (FP), false negatives (FN) and true negatives (TN). Every statistic below is a ratio of those cells or of the rates derived from them. Definitions follow Altman & Bland (BMJ 1994) and Deeks & Altman (BMJ 2004).

  1. Sensitivity = TP / (TP + FN) and specificity = TN / (TN + FP). These describe the test itself and stay fixed no matter how common the disease is.
  2. PPV = TP / (TP + FP) and NPV = TN / (TN + FN) are the predictive values at the sample's own prevalence. Unlike sensitivity and specificity, they move with prevalence.
  3. Likelihood ratiossummarise a result's weight of evidence: LR+ = Sens / (1 − Spec) and LR− = (1 − Sens) / Spec. The diagnostic odds ratio = (TP·TN) / (FP·FN) = LR+ / LR−, and Youden's J = Sens + Spec − 1.
  4. Prevalence adjustmentuses Bayes' theorem to recompute predictive values for any target prevalence p: PPV(p) = Sens·p / (Sens·p + (1 − Spec)·(1 − p)) and NPV(p) = Spec·(1 − p) / (Spec·(1 − p) + (1 − Sens)·p). The post-test probability after a positive result is exactly PPV(p); equivalently, pre-test odds × LR+ converted back to a probability — the Fagan nomogram in algebra.
  5. Confidence intervals. Sensitivity, specificity, PPV and NPV each carry a 95% Wilson score interval on their own denominator (for example, sensitivity uses n = TP + FN). Wilson is used instead of the Wald approximation because it stays inside 0–100% and behaves at the extremes and small samples typical of validation studies (Altman, Statistics with Confidence).

A built-in cross-check proves the two engines agree: projecting PPV with Bayes at the sample's own prevalence reproduces the direct count formula TP / (TP + FP) to machine precision. All arithmetic uses exact double-precision values; only the display is rounded, so chained steps never accumulate rounding drift.

Worked examples

Rapid dengue NS1 antigen vs PCR (counts mode)

  1. Counts: TP = 47, FP = 3, FN = 8, TN = 142 (N = 200)
  2. Sensitivity = 47 / 55 = 0.8545 → 85.5%
  3. Specificity = 142 / 145 = 0.9793 → 97.9%
  4. PPV (sample) = 47 / 50 = 94.0%; NPV = 142 / 150 = 94.7%
  5. Sample prevalence = 55 / 200 = 27.5%; Accuracy = 189 / 200 = 94.5%
  6. LR+ = 0.8545 / (1 − 0.9793) = 41.3; LR− = 0.1455 / 0.9793 = 0.149
  7. Youden's J = 0.8545 + 0.9793 − 1 = 0.834
  8. Re-projected to community prevalence p = 2%:
  9. PPV(0.02) = (0.8545·0.02) / (0.8545·0.02 + 0.0207·0.98) = 45.7%

Takeaway: A positive rapid test that is 94% reliable in an outbreak sample is right less than half the time in a 2%-prevalence off-season — the reason predictive values must be read against real-world prevalence.

Screening test at very low prevalence (rates mode)

  1. Sensitivity = 99%, Specificity = 95%, target prevalence = 0.1% (1 in 1000)
  2. LR+ = 0.99 / 0.05 = 19.8; LR− = 0.01 / 0.95 = 0.0105
  3. PPV(0.001) = (0.99·0.001) / (0.99·0.001 + 0.05·0.999) = 1.94%
  4. NPV(0.001) = (0.95·0.999) / (0.95·0.999 + 0.01·0.001) ≈ 100.0%

Takeaway: Even a '99% accurate' test yields a positive that is correct only ~1.9% of the time when the disease affects 1 in 1000 — the classic base-rate result behind cautious interpretation of population screening.

Edge case: perfect specificity (counts mode)

  1. Counts: TP = 50, FP = 0, FN = 10, TN = 40 (N = 100)
  2. Sensitivity = 50 / 60 = 83.3%; Specificity = 40 / 40 = 100%
  3. PPV = 50 / 50 = 100%; NPV = 40 / 50 = 80.0%
  4. LR+ = 0.833 / (1 − 1) = division by zero → ∞ (a positive is conclusive)
  5. LR− = (1 − 0.833) / 1 = 0.167; Youden's J = 0.833

Takeaway: With zero false positives, LR+ is infinite, so the tool shows ∞ rather than a misleading number or NaN. Every division-by-zero cell is handled this way.

Frequently asked questions

Sources & references

The formulas on this page are textbook-standard and vendor-neutral. They were last reconciled against the cited references on 2026-07-10. If a result ever disagrees with a source you trust, email me the inputs and I will investigate.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.