ToolsCalculators
Basic statistics calculator (2×2 contingency table)
Sensitivity, specificity, predictive values, likelihood ratios, odds ratio, relative risk, absolute risk reduction, and NNT from a 2×2 table.
Basic statistics calculator (2×2 contingency table)
a — test/exposure positive AND disease/outcome positive
True positives (cell a of the 2×2 table).
patients
b — test/exposure positive AND disease/outcome negative
False positives (cell b).
patients
c — test/exposure negative AND disease/outcome positive
False negatives (cell c).
patients
d — test/exposure negative AND disease/outcome negative
True negatives (cell d).
patients
Complete the fields above to see the result.
When to use
- Converting a 2×2 diagnostic-test or exposure/outcome table into standard test-performance and effect-size statistics.
- Teaching or quickly cross-checking sensitivity, specificity, predictive values, likelihood ratios, odds ratio, relative risk, absolute risk reduction, and NNT from raw counts.
Formula
From a 2×2 table with a=test+/disease+, b=test+/disease-, c=test-/disease+, d=test-/disease-: Sensitivity = a/(a+c). Specificity = d/(b+d). PPV = a/(a+b). NPV = d/(c+d). Accuracy = (a+d)/(a+b+c+d). LR+ = Sensitivity/(1-Specificity). LR- = (1-Sensitivity)/Specificity. Odds ratio = (a×d)/(b×c). Risk (row 1) = a/(a+b); Risk (row 2) = c/(c+d). Relative risk = Risk(row 1)/Risk(row 2). Absolute risk difference = |Risk(row 1) - Risk(row 2)|. NNT = 1/Absolute risk difference.
Pearls and pitfalls
- LR+ greater than 10 and LR- less than 0.1 produce large, often decisive shifts in post-test probability; ratios near 1 are clinically uninformative.
- If any cell equals zero the corresponding likelihood ratio or odds ratio becomes 0 or infinite — interpret with caution, especially in small samples.
- Odds ratio approximates relative risk only when the outcome is uncommon (roughly under 10%); at higher event rates the two diverge.
- Whether the reciprocal of the absolute risk difference represents a number needed to treat or a number needed to harm depends on whether row-1 (test/exposure-positive) status raises or lowers the outcome risk relative to row 2.