Home ↓
CalculatorsVerified

Health & Fitness

Diagnostic Test Calculator (Sensitivity, Specificity, PPV and NPV)

No medical test is perfect. A test can miss some people who have a condition, giving false negatives, and flag some people who do not, giving false positives. Several standard measures describe how well a test performs. Sensitivity is the proportion of people with the condition whom the test correctly identifies as positive. Specificity is the proportion of people without the condition whom it correctly identifies as negative. These describe the test itself. What patients and clinicians usually want to know, however, is the probability that a particular result is correct: the positive predictive value, the chance that someone with a positive result really has the condition, and the negative predictive value, the chance that someone with a negative result really does not. Predictive values depend strongly on prevalence, how common the condition is in the group being tested. This calculator works in two ways. From the four counts of a 2×2 table, true positives, false negatives, false positives and true negatives, it calculates sensitivity, specificity, both predictive values, prevalence, accuracy and the positive and negative likelihood ratios. Alternatively, from a test's sensitivity and specificity and the prevalence in your population, it calculates the predictive values you would expect. With 90 true positives, 10 false negatives, 45 false positives and 855 true negatives, sensitivity is 90 percent, specificity 95 percent and the positive predictive value about 67 percent. But if the same test is used in a population where only 1 percent have the condition, the positive predictive value falls to about 15 percent: most positive results would be false alarms. This is why screening programmes for rare conditions use confirmatory testing. The calculator is educational and does not replace clinical judgement.

How to use this calculator

  1. Choose whether to enter a 2×2 table or sensitivity, specificity and prevalence.
  2. Enter the counts, or the three percentages.
  3. Read the positive and negative predictive values.
  4. Check sensitivity, specificity and likelihood ratios.
  5. Remember that predictive values change with prevalence.

Likelihood ratios

Likelihood ratios combine sensitivity and specificity into numbers that update the probability of disease. A positive likelihood ratio above about 10 strongly raises the probability when the test is positive, and a negative likelihood ratio below about 0.1 strongly lowers it when the test is negative. Values near 1 mean the test changes little.

Using pre-test odds multiplied by the likelihood ratio gives post-test odds, a method clinicians use, often with nomograms, to interpret results for individual patients.

Screening and confirmation

Screening programmes test large numbers of people with low prevalence, so even highly specific tests generate many false positives. Programmes therefore follow positive screening results with more specific confirmatory tests and weigh benefits against harms such as anxiety and unnecessary procedures.

Sensitivity and specificity can also vary between populations and settings, depending on disease severity and the spectrum of patients tested, so published values may not transfer exactly to your situation.

Formula & method

Sensitivity = TP ÷ (TP + FN); specificity = TN ÷ (TN + FP)PPV = TP ÷ (TP + FP); NPV = TN ÷ (TN + FN)From rates: PPV = se × prev ÷ [se × prev + (1 − sp)(1 − prev)]LR+ = sensitivity ÷ (1 − specificity); LR− = (1 − sensitivity) ÷ specificity

Sens = TP/(TP+FN). Spec = TN/(TN+FP). PPV = TP/(TP+FP). NPV = TN/(TN+FN). From rates: PPV = se·p/(se·p + (1−sp)(1−p)); NPV = sp(1−p)/(sp(1−p) + (1−se)p). LR+ = se/(1−sp); LR− = (1−se)/sp.

Worked example

A test in a 10% prevalence group

  1. Sensitivity = 90 ÷ 100 = 90%; specificity = 855 ÷ 900 = 95%.
  2. PPV = 90 ÷ 135 = 66.67%; NPV = 855 ÷ 865 = 98.84%.
  3. LR+ = 0.9 ÷ 0.05 = 18; LR− = 0.1 ÷ 0.95 = 0.105.

Answer: Two thirds of positive results are true positives.

Frequently asked questions

What is sensitivity?

The proportion of people with the condition who test positive.

What is specificity?

The proportion of people without the condition who test negative.

Why does PPV depend on prevalence?

Because false positives come from the much larger group without the condition when it is rare.

What is a likelihood ratio?

How much a test result changes the odds of having the condition.

What is accuracy?

The proportion of all results that are correct, which can be misleading when prevalence is low.

Can this tell me if I have a disease?

No. Discuss test results with a health professional.