How good is a diagnostic test? Comparing its results with a reference standard (biopsy, culture, expert diagnosis) gives a 2 × 2 table of four counts: true positives, false positives, false negatives and true negatives. Every measure of test accuracy is built from these four numbers.
Sensitivity is the share of people with the condition whom the test detects; specificity is the share of people without it whom the test correctly clears. They describe the test itself. Predictive values answer the question patients actually ask — "I tested positive: how likely is it that I have the condition?" — but they also depend on how common the condition is, which is why this calculator lets you recompute PPV and NPV for the prevalence of your own setting.
You also get the likelihood ratios LR+ and LR−, which convert pre-test odds into post-test odds and do not depend on prevalence, overall accuracy, and Youden’s index , a single summary of how far the test is from useless. Each proportion comes with a Wilson score confidence interval, which stays reliable for small samples and for proportions close to 0 % or 100 %, unlike the simple ±1.96 SE interval.
How to use this calculator
- Build the 2 × 2 table by crossing the test result with the reference standard.
- Enter TP (test +, condition present), FP (test +, absent), FN (test −, present) and TN (test −, absent).
- Optionally enter the prevalence in the population where the test will be used, to get adjusted predictive values.
- Choose the confidence level (95 % by default).
- Read sensitivity, specificity, predictive values, likelihood ratios and Youden’s index; the table under the result gives every confidence interval.
The formula
With the four cells:
Predictive values at prevalence (Bayes’ theorem):
Wilson score interval for a proportion , with the normal quantile (1.96 for 95 %):
Likelihood ratios use the log method: .
Worked example
Liver scan data (Altman & Bland, BMJ 1994; the default values). 344 patients had a liver scan and a definitive diagnosis: TP = 231, FP = 32, FN = 27, TN = 54.
- Sensitivity = 231 / 258 = 89.5% (95 % CI 85.2% to 92.7%)
- Specificity = 54 / 86 = 62.8% (95 % CI 52.2% to 72.3%)
- PPV = 231 / 263 = 87.8%, NPV = 54 / 81 = 66.7%
- , , Youden’s , accuracy 82.8%
The scan picks up most abnormal livers but clears barely two thirds of normal ones. The predictive values reflect the very high prevalence in this hospital series (75%). Enter a prevalence of 10 % and the PPV falls to 21.1% while the NPV rises to 98.2%: the same scan means something quite different in a population where abnormal livers are uncommon.
PPV calculator and NPV calculator: why prevalence matters
Sensitivity and specificity belong to the test; predictive values belong to the test in a population. The positive predictive value is the probability of disease after a positive result, and it collapses when the condition is rare, because even a small false-positive rate applied to many healthy people outnumbers the true positives. The negative predictive value behaves the opposite way.
| Prevalence | PPV (Se 90 %, Sp 90 %) | NPV |
|---|---|---|
| 50 % | 90.0 % | 90.0 % |
| 10 % | 50.0 % | 98.8 % |
| 1 % | 8.3 % | 99.9 % |
So never transfer PPV or NPV from a study to a clinic with a different case mix — recompute them with the prevalence field, or see the step-by-step logic in the Bayes’ theorem calculator.
Youden index and likelihood ratios
Youden’s index ranges from 0 (a test no better than a coin toss, for which the positive rate is the same with or without disease) to 1 (a perfect test). It weighs sensitivity and specificity equally and is often used to choose the best cut-off on a continuous marker: the threshold that maximises is the point of the ROC curve furthest above the diagonal.
Likelihood ratios say how much a result shifts the odds of disease: post-test odds = pre-test odds × LR. As a rough guide, or produce large, often conclusive changes; 2–5 and 0.2–0.5 are modest; values close to 1 barely help. Because they do not depend on prevalence, they transport better between settings than predictive values.
Frequently asked questions
What is the difference between sensitivity and PPV?
Sensitivity is the share of sick people who test positive, P(test + | disease). PPV is the share of positive tests that come from sick people, P(disease | test +). The second depends on prevalence; the first does not.
Why use Wilson intervals instead of the usual ±1.96 SE?
The simple Wald interval can extend below 0 % or above 100 % and is too narrow for small counts or extreme proportions. The Wilson score interval keeps close to its nominal coverage in those cases and is recommended by Newcombe and by Agresti and Coull.
What is a good Youden index?
There is no universal threshold: J = 0 means the test is useless, J = 1 perfect. Values above about 0.5 are usually considered useful, but the right balance between missed cases and false alarms depends on the clinical consequences.
Is accuracy a good summary of a test?
Not on its own. Accuracy mixes sensitivity and specificity in proportion to prevalence, so a test that calls everyone healthy can reach 99 % accuracy when the disease affects 1 % of people.
What if a cell is zero?
Sensitivity, specificity and predictive values remain defined and their Wilson intervals still work. A likelihood ratio may become infinite (specificity 100 %), and its log-method interval is then not reported.
Sources
- Altman DG, Bland JM (1994), Diagnostic tests 1: sensitivity and specificity, BMJ 308:1552
- Altman DG, Bland JM (1994), Diagnostic tests 2: predictive values, BMJ 309:102
- Wilson EB (1927), Probable inference, the law of succession, and statistical inference, JASA 22:209–212
- Newcombe RG (1998), Two-sided confidence intervals for the single proportion: comparison of seven methods, Statistics in Medicine 17:857–872
- Simel DL, Samsa GP, Matchar DB (1991), Likelihood ratios with confidence: sample size estimation for diagnostic test studies, J Clin Epidemiol 44:763–770
- Youden WJ (1950), Index for rating diagnostic tests, Cancer 3:32–35
Last updated: