SENSITIVITY & SPECIFICITY CALCULATOR

Sensitivity and specificity calculator

Enter a test’s results as a 2×2 table: sensitivity, specificity, predictive values and likelihood ratios, with confidence intervals.

Condition present (by the reference standard)

Condition absent

What are sensitivity and specificity?

Sensitivity is the share of people who have the condition whom the test correctly flags: TP ÷ (TP + FN). Specificity is the share of people without it whom the test correctly clears: TN ÷ (FP + TN). In the liver scan example from Altman and Bland (BMJ, 1994), 231 of the 258 people with abnormal pathology had a positive scan, a sensitivity of 89.5% (about 90%), and 54 of the 86 people with normal pathology had a negative scan, a specificity of 62.8% (about 63%).

What are positive and negative predictive values?

The positive predictive value (PPV) is the share of positive results that are true: TP ÷ (TP + FP). The negative predictive value (NPV) is the share of negative results that are true: TN ÷ (TN + FN). In the liver scan table, PPV = 231 ÷ 263 = 87.8% and NPV = 54 ÷ 81 = 66.7%. Both depend on how common the condition is in the people tested (75% in that study), so they do not carry over to a group with a different prevalence. For that, enter your own prevalence in the Bayes’ theorem calculator: a test with 90% sensitivity and 90% specificity has a PPV of only 8.3% when 1% of people have the condition.

What are likelihood ratios?

LR+ = sensitivity ÷ (1 − specificity) says how much more often a positive result occurs in people with the condition than in people without it; LR− = (1 − sensitivity) ÷ specificity does the same for a negative result. For the liver scan, LR+ = 2.41 and LR− = 0.167. Multiply the pre-test odds by the ratio to get the post-test odds. In the example of Deeks and Altman (BMJ, 2004), a pre-test probability of 0.1 (odds 0.11) and a ratio of 20.4 give post-test odds of 2.27, a probability of 0.69.

How are the confidence intervals calculated?

Sensitivity, specificity, PPV, NPV, accuracy and prevalence use the Wilson score interval, (p̂ + z²/2n ± z√(p̂(1 − p̂)/n + z²/4n²)) ÷ (1 + z²/n), which stays inside 0% and 100% and works with small counts; 81 out of 263 (30.8%), for example, gives 25.5% to 36.6%. Likelihood ratios and the diagnostic odds ratio use the log method: exp(ln estimate ± z × SE), with SE(ln LR+) = √(1/TP − 1/(TP + FN) + 1/FP − 1/(FP + TN)). In the Deeks and Altman table, 42 of 148 people with obstructive airway disease and 2 of 144 people without it had smoked 40 or more pack-years, a ratio of 20.4 with 95% CI 5.04 to 82.8. If a cell is zero, the log method has no interval and the calculator says so.

What is the diagnostic odds ratio?

DOR = (TP × TN) ÷ (FP × FN), which equals LR+ ÷ LR−. It summarizes a test in one number: 1 means the test tells the two groups apart no better than chance, and larger is better. For the liver scan it is 14.4 (95% CI 8.0 to 26.1). Because one number hides the balance between sensitivity and specificity, look at both as well.

How is this different from the Bayes’ theorem calculator?

The Bayes’ theorem calculator starts from a prevalence, sensitivity and specificity you assume and gives the predictive values for that population. This calculator starts from the counts of an actual study, adds confidence intervals, likelihood ratios and the odds ratio, and its second mode takes rates when you have no counts.

For general information only — not medical advice. Talk with your doctor or another health professional about your own health. Sources: D. G. Altman and J. M. Bland, “Diagnostic tests 1: sensitivity and specificity,” BMJ 308 (1994) 1552, and “Diagnostic tests 2: predictive values,” BMJ 309 (1994) 102; J. J. Deeks and D. G. Altman, “Diagnostic tests 4: likelihood ratios,” BMJ 329 (2004) 168–169; E. B. Wilson (1927) and R. G. Newcombe, Statistics in Medicine 17 (1998) 857–872 (Wilson score interval); A. S. Glas et al., Journal of Clinical Epidemiology 56 (2003) 1129–1135 (diagnostic odds ratio); CDC, Principles of Epidemiology in Public Health Practice, Lesson 5, Appendix A. Related: Bayes’ theorem calculator, relative risk calculator, Fisher’s exact test calculator, confidence interval calculator and odds calculator. How we check our calculators.