Diagnostic Test Calculator

Calculate PPV, NPV, likelihood ratios and other diagnostic statistics from sensitivity, specificity and prevalence, or from a study's 2×2 table with 95% confidence intervals.

Sensitivity = TP / (TP + FN). Specificity = TN / (TN + FP).

TP, FP, FN and TN are true positives, false positives, false negatives and true negatives. Sensitivity is the share of people with the disease who test positive; specificity is the share of people without it who test negative.

Input Parameters

Probability of testing positive when disease is present
Probability of testing negative when disease is absent
Proportion of population with the disease

Calculated Statistics

Positive Predictive Value (PPV) --
Negative Predictive Value (NPV) --
False Positive Rate (FPR) --
False Negative Rate (FNR) --
Accuracy --
Likelihood Ratio (+) --
Likelihood Ratio (-) --

Switch to 2×2 counts to get 95% confidence intervals.

2×2 Contingency Table (per 10,000 people)

Disease Present Disease Absent Total
Test Positive -- -- --
Test Negative -- -- --
Total -- -- 10,000

Report summary

The summary keeps the underlying counts and the interval method, not just the percentages. The methods paragraph is written for a manuscript. The CSV has every statistic with its 95% interval, numerator, denominator and method, plus PPV and NPV at a range of prevalences.

Enter sensitivity and specificity, or 2×2 counts, to build the summary.

Methods

The methods paragraph appears with the summary.

PPV and NPV across prevalence

With this test's sensitivity and specificity held fixed, predictive values depend on how common the disease is. At low prevalence, even a good test's positives are mostly false positives. The marker shows the current prevalence.

Enter sensitivity and specificity, or 2×2 counts, to draw the curves.

PPV and NPV at selected prevalences
PrevalencePPVNPV

Key Formulas

Sensitivity = TP / (TP + FN)
Specificity = TN / (TN + FP)
PPV =(Sensitivity × Prevalence) / (Sensitivity × Prevalence + (1 - Specificity) × (1 - Prevalence))
NPV = (Specificity × (1 - Prevalence)) / (Specificity × (1 - Prevalence) + (1 - Sensitivity) × Prevalence)
Accuracy = Sensitivity × Prevalence + Specificity × (1 - Prevalence)
LR+ = Sensitivity / (1 - Specificity)
LR- = (1 - Sensitivity) / Specificity
95% CI for a proportion p = x/n (Wilson): [p + z²/2n ± z·√(p(1-p)/n + z²/4n²)] / (1 + z²/n), z = 1.96
95% CI for LR+ (log method): exp(ln LR+ ± z·√(1/TP - 1/(TP+FN) + 1/FP - 1/(FP+TN)))
95% CI for LR- (log method): exp(ln LR- ± z·√(1/FN - 1/(TP+FN) + 1/TN - 1/(FP+TN)))

If a zero cell makes a likelihood ratio 0 or infinite, 0.5 is added to every cell for that ratio and its interval (marked *).

References

  • Wilson EB. Probable inference, the law of succession, and statistical inference. J Am Stat Assoc. 1927;22(158):209-212.
  • Simel DL, Samsa GP, Matchar DB. Likelihood ratios with confidence: sample size estimation for diagnostic test studies. J Clin Epidemiol. 1991;44(8):763-770. doi:10.1016/0895-4356(91)90128-v