Worked on the two-by-two table

Diagnostic Test Calculator

Enter true and false positives and negatives to get sensitivity, specificity, positive and negative predictive values, likelihood ratios, accuracy and Wilson 95% confidence intervals.

Diagnostic Test Calculator

Columns describe the test, rows describe the result

A diagnostic accuracy study compares a new test with a reference standard in the same people. The default table describes 1,000 people, 100 of whom have the disease. The test is positive in 90 of the 100 (true positives) and negative in 10 (false negatives); among the 900 without the disease it is negative in 855 (true negatives) and wrongly positive in 45 (false positives). Reading down the disease columns gives the properties of the test: sensitivity 90 ÷ 100 = 90.0% and specificity 855 ÷ 900 = 95.0%. Reading across the result rows gives what a result means in this group: the positive predictive value is 90 ÷ 135 = 66.7% and the negative predictive value 855 ÷ 865 = 98.8%. The Wilson 95% intervals show how much the study size limits precision: sensitivity is estimated from only 100 people, so its interval, 82.6% to 94.5%, is far wider than that of specificity, 93.4% to 96.2%. The mnemonics SnNout and SpPin capture the use of each: a negative result on a highly sensitive test helps rule a disease out, a positive result on a highly specific test helps rule it in.

Predictive values move with prevalence

Sensitivity and specificity are, to a first approximation, properties of the test. Predictive values are not: they depend on how common the disease is among the people tested. Apply the same 90% sensitive, 95% specific test to 1,000 people of whom only 10 are ill. It finds 9 of them, but it also flags 5% of the 990 healthy people, 49.5 on average, so the positive predictive value falls to 9 ÷ 58.5 = 15.4%, while the negative predictive value rises to 99.9%. Nothing about the test changed. This is why a predictive value copied from a hospital study, where prevalence is high, overstates what a positive result means in screening.

Likelihood ratios travel better

The positive likelihood ratio is sensitivity ÷ (1 − specificity), here 0.90 ÷ 0.05 = 18.0, and the negative likelihood ratio (1 − sensitivity) ÷ specificity = 0.10 ÷ 0.95 = 0.105. They say how much a result changes the odds of disease, and because they are built from sensitivity and specificity they can be carried to a setting with a different prevalence. Ratios above 10 or below 0.1 usually change decisions; ratios between 0.5 and 2 rarely do. The post-test probability calculator on this site applies them to any starting probability.

Why accuracy misleads

Overall accuracy, (TP + TN) ÷ total, is 94.5% here, but it is dominated by the larger group. At 1% prevalence a “test” that calls everyone negative is 99% accurate and useless. Accuracy studies also suffer from spectrum bias, when the patients are clearer cases than those seen in practice, and verification bias, when only positive results are checked against the reference standard; both inflate sensitivity and specificity. The STARD reporting guideline lists what a study should describe so these problems can be judged.

How to use it

  1. Enter the true positives and false negatives: the people with the disease, split by test result.
  2. Enter the false positives and true negatives: the people without the disease, split by test result.
  3. Read sensitivity and specificity with their Wilson intervals.
  4. Read the predictive values, remembering they apply only at the prevalence in this table.
  5. Use the likelihood ratios with the post-test probability calculator for a different setting.

Questions from journal club

What is the difference between sensitivity and positive predictive value?

Sensitivity is the share of people with the disease who test positive, TP ÷ (TP + FN). Positive predictive value is the share of positive results that are true, TP ÷ (TP + FP). With 90 true and 45 false positives among 100 ill people, sensitivity is 90% but only 66.7% of positive results are correct.

Why does the positive predictive value fall when a disease is rare?

Because false positives come from the much larger healthy group. A 95% specific test applied to 990 healthy people produces about 49.5 false positives, swamping the 9 true positives found among 10 ill people. The positive predictive value drops to 15.4% even though sensitivity and specificity are unchanged.

What is a good likelihood ratio?

A positive likelihood ratio above 10 or a negative likelihood ratio below 0.1 usually produces a large, often decisive, change in the probability of disease. Values of 5 to 10 and 0.1 to 0.2 give moderate changes, while ratios between 0.5 and 2 rarely change a decision. A 90% sensitive, 95% specific test has LR+ 18 and LR− 0.105.

Why use Wilson intervals for sensitivity and specificity?

Sensitivity and specificity are proportions, often from small groups and often close to 100%. The simple Wald interval can then extend beyond 100% or be far too narrow. The Wilson score interval stays between 0% and 100% and has close to its nominal 95% coverage even with small samples, which is why it is widely recommended.

Disclaimer: These calculators are for education and for reading published research only. They work with summary counts from studies and populations and do not diagnose disease, interpret an individual’s test result or advise on treatment, testing or vaccination. Study measures such as relative risk, NNT and predictive values describe groups, not individuals, and confidence intervals use standard approximations that can differ from exact methods in small tables. Do not use the results for personal health decisions: consult a qualified health professional, and follow national and local public health agencies on outbreaks, screening and vaccination.