Sensitivity and Specificity Calculator

Enter how many people tested positive and negative among those with and without the condition to get the sensitivity, specificity, predictive values and likelihood ratios of a diagnostic test, each with a confidence interval. Set the prevalence to see how the predictive values change in the population where the test will be used.

Test result against the reference standard

Test result by disease status
Disease presentDisease absentTotal
Test positive120
Test negative180
Total100200300

True positives top left, false positives top right, false negatives bottom left, true negatives bottom right.

Leave blank to use the prevalence in your table. Enter the prevalence in the population where the test will be used if your sample was chosen by disease status.

Confidence level

Load a worked example

Sensitivity / specificity

90.0% / 85.0%

The test detects 90.0% of people with the disease and correctly clears 85.0% of people without it. A positive result multiplies the odds of disease by 6.00; a negative result multiplies them by 0.12.

Sensitivity
90.0%
95% CI 82.4% to 95.1%
Specificity
85.0%
95% CI 79.3% to 89.6%
Positive likelihood ratio
6.00
95% CI 4.29 to 8.40
Negative likelihood ratio
0.12
95% CI 0.065 to 0.21
Positive predictive value
75.0%
95% CI 66.3% to 82.5%
Negative predictive value
94.4%
95% CI 90.0% to 97.3%
Prevalence (table)
33.3%
95% CI 28.0% to 39.0%
Accuracy
86.7%
95% CI 82.3% to 90.3%
Diagnostic odds ratio
51.00
95% CI 23.85 to 109.04
Youden’s J
0.750
sensitivity + specificity − 1
  • Predictive values use the prevalence in your table. If you chose a fixed number of patients with and without the disease (a case-control design), enter the real-world prevalence instead.

Report it like this

Against the reference standard, the test had a sensitivity of 90.0% (90/100; 95% CI 82.4% to 95.1%) and a specificity of 85.0% (170/200; 95% CI 79.3% to 89.6%). The positive likelihood ratio was 6.00 (95% CI 4.29 to 8.40) and the negative likelihood ratio 0.12 (95% CI 0.065 to 0.21). At the prevalence in this sample (33.3%), the positive predictive value was 75.0% (95% CI 66.3% to 82.5%) and the negative predictive value 94.4% (95% CI 90.0% to 97.3%).

How to use the calculator

Compare the test with a reference standard (the best available way of knowing who really has the condition) and count four groups:

Layout of a diagnostic accuracy table
Disease presentDisease absent
Test positiveTrue positives (TP)False positives (FP)
Test negativeFalse negatives (FN)True negatives (TN)

Leave the prevalence blank if your sample is a consecutive or random series of the patients the test is meant for. If you recruited fixed numbers of people with and without the condition, enter the real-world prevalence so that the predictive values make sense.

Formulas

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

PPV = TP / (TP + FP),   NPV = TN / (TN + FN)

LR+ = Se / (1 − Sp),   LR− = (1 − Se) / Sp

Sensitivity, specificity, accuracy and the table’s predictive values are proportions, so their intervals are exact Clopper–Pearson binomial intervals. The likelihood ratio intervals use the log method of Simel, Samsa and Matchar (1991). At an entered prevalence p, PPV = Se·p / [Se·p + (1 − Sp)(1 − p)], with the logit interval of Mercaldo, Lau and Zhou (2007).

Worked example

A new test was compared with biopsy in 100 patients with the disease and 200 without it (the default table): 90 true positives, 30 false positives, 10 false negatives and 170 true negatives.

  • Sensitivity = 90/100 = 90.0% (95% CI 82.4% to 95.1%); specificity = 170/200 = 85.0% (79.3% to 89.6%).
  • LR+ = 0.90 / 0.15 = 6.00 (4.29 to 8.40); LR− = 0.10 / 0.85 = 0.12 (0.07 to 0.21).
  • In this sample (prevalence 33.3%): PPV = 90/120 = 75.0%, NPV = 170/180 = 94.4%.
  • Used for screening where only 5% have the disease, the same test has a PPV of just 24.0% (18.4% to 30.7%): three in four positive results are false alarms. The NPV rises to 99.4%.

Predictive values depend on prevalence

Sensitivity and specificity describe the test and stay roughly the same from one setting to another. Predictive values describe what a result means for a patient, and they change with how common the condition is. A highly specific test still produces mostly false positives when the condition is rare.

Likelihood ratios link the two. Multiply the pre-test odds by the LR to get the post-test odds: with a pre-test probability of 20% (odds 0.25), a positive result with LR+ = 6 gives odds of 1.5, a post-test probability of 60%. As a rule of thumb, LR+ above 10 or LR− below 0.1 change the probability a lot; values between 0.5 and 2 barely change it.

A sensitive test is good for ruling a condition out when negative (SnNOut); a specific test is good for ruling it in when positive (SpPIn). For screening, a negative predictive value close to 100% matters more than the positive predictive value.

How to report diagnostic accuracy

The STARD 2015 guideline asks for the 2 × 2 table (or the counts behind it), estimates of diagnostic accuracy with their confidence intervals, and a description of how the reference standard was applied:

Against biopsy, the test had a sensitivity of 90.0% (90/100; 95% CI 82.4% to 95.1%) and a specificity of 85.0% (170/200; 95% CI 79.3% to 89.6%); the positive and negative likelihood ratios were 6.00 (95% CI 4.29 to 8.40) and 0.12 (95% CI 0.07 to 0.21).

Give the counts as well as the percentages, and say whether the predictive values come from your sample or from an assumed prevalence. To plan how many patients a diagnostic study needs, see the sample size calculator; for a single proportion with other interval methods, use the confidence interval calculator.

Questions

How do I calculate sensitivity and specificity?
Sensitivity is the number of true positives divided by everyone who has the condition (true positives plus false negatives). Specificity is the number of true negatives divided by everyone without the condition (true negatives plus false positives). With 90 of 100 diseased patients testing positive and 170 of 200 healthy people testing negative, sensitivity is 90% and specificity 85%.
What is the difference between sensitivity and positive predictive value?
Sensitivity is the probability that a person with the condition tests positive. Positive predictive value is the probability that a person who tests positive has the condition. Sensitivity does not depend on prevalence; the positive predictive value falls as the condition becomes rarer.
How do I calculate PPV and NPV at a different prevalence?
Enter the prevalence in the calculator. It uses PPV = sensitivity × prevalence ÷ [sensitivity × prevalence + (1 − specificity) × (1 − prevalence)] and the matching formula for NPV. A test with 90% sensitivity and 85% specificity has a PPV of 24% when the prevalence is 5%.
What is a good likelihood ratio?
A positive likelihood ratio above 10 or a negative likelihood ratio below 0.1 usually changes the probability of disease enough to decide; values from 5 to 10 and 0.1 to 0.2 are moderately useful; values between 0.5 and 2 add little.
Which confidence interval is used for sensitivity and specificity?
The calculator uses the exact Clopper–Pearson binomial interval, which never covers less than the stated level and is the method most diagnostic accuracy studies report. For other methods, such as the Wilson interval, use the confidence interval calculator with the same counts.
What is the diagnostic odds ratio?
The diagnostic odds ratio is (TP × TN) ÷ (FP × FN), the odds of a positive test in people with the condition divided by the odds in people without it. It combines sensitivity and specificity in one number and is used in meta-analyses of diagnostic accuracy, but it hides the trade-off between the two.

Sources