Calculateus

Diagnostic Test Accuracy Calculator

Calculate sensitivity, specificity, predictive values, and likelihood ratios from a diagnostic test's confusion matrix.

Result

Sensitivity
89.47%
Specificity
92.68%
Positive Predictive Value (PPV)
85%
Negative Predictive Value (NPV)
95%
Overall Accuracy
91.67%

About the Diagnostic Test Accuracy

The Diagnostic Test Accuracy Calculator evaluates a medical, laboratory, or classification test by breaking its results into a standard two-by-two confusion matrix: true positives, false positives, false negatives, and true negatives. From those four counts it derives the metrics used to judge how well a test performs, including sensitivity, specificity, predictive values, and overall accuracy.

How It Works

You enter the counts for each of the four outcome categories from a validation study or test dataset. The calculator adds them into a total, then computes sensitivity as the share of truly positive cases the test correctly flagged, specificity as the share of truly negative cases it correctly cleared, and the positive and negative predictive values as the share of the test's own positive and negative calls that turned out correct. Overall accuracy is reported as the proportion of all cases the test classified correctly.

Sensitivity = TP / (TP + FN); Specificity = TN / (TN + FP); PPV = TP / (TP + FP); NPV = TN / (TN + FN); Accuracy = (TP + TN) / (TP + FP + FN + TN).

Formula & Methodology

To work through it manually, first confirm your four counts sum to the full sample. Divide true positives by the total number of actually-diseased cases (TP + FN) for sensitivity, and true negatives by the total number of actually-healthy cases (TN + FP) for specificity. Then divide true positives by all positive test calls (TP + FP) for PPV, and true negatives by all negative test calls (TN + FN) for NPV.

Examples

A screening test on 300 patients

With 85 true positives, 15 false positives, 10 false negatives, and 190 true negatives, sensitivity comes out to 85/95, or about 89.47%, specificity is 190/205, or about 92.68%, and overall accuracy is 275/300, or about 91.67%.

A smaller validation sample

With 40 true positives, 10 false positives, 5 false negatives, and 145 true negatives (200 total), sensitivity is 40/45, about 88.89%, PPV is 40/50, or 80%, and NPV is 145/150, about 96.67%.

Advantages

  • Calculates all five standard accuracy metrics from one confusion matrix entry, instead of requiring five separate manual divisions.
  • Separates sensitivity and specificity from the predictive values, making clear which figures depend on disease prevalence and which do not.
  • Works for any binary classification result, not only clinical tests, since the same true/false positive/negative structure applies to any yes/no detection problem.

Common Mistakes

  • Reading sensitivity and PPV as interchangeable, when sensitivity is about correctly catching real cases while PPV is about how trustworthy a positive result actually is.
  • Applying predictive values calculated in one population (say, a high-prevalence clinical trial) directly to a different population without recalculating, since PPV and NPV shift with prevalence.
  • Entering counts that do not reflect a real, matched validation study, which produces mathematically valid but practically meaningless accuracy figures.

Edge Cases to Watch For

  • The calculator requires both the diseased group (TP + FN) and the non-diseased group (TN + FP) to contain at least one case; without both, sensitivity or specificity cannot be defined.
  • If there are zero positive test calls (TP + FP = 0), PPV is reported as 0 rather than left undefined, and the same guard applies to NPV when there are zero negative test calls.
  • Predictive values (PPV and NPV) depend on how common the condition is in the tested group, so they shift if the calculator is reused on a population with a different disease prevalence than the one the counts came from.

Common Use Cases

  • Clinicians and lab staff reviewing how a diagnostic test performed during a validation or clinical trial dataset.
  • Data scientists evaluating a binary classification model's confusion matrix using the same sensitivity/specificity/PPV/NPV framework.
  • Students working through epidemiology or biostatistics coursework on test performance measures.
Written & fact-checked by the Calculateus TeamLast updated August 5, 2026How we verify our formulas

Frequently asked questions

What's the difference between sensitivity and specificity?

Sensitivity is the proportion of true positive cases the test correctly identifies (a highly sensitive test rarely misses real cases). Specificity is the proportion of true negative cases the test correctly identifies (a highly specific test rarely raises false alarms) - there's usually a tradeoff between the two depending on where you set a test's decision threshold.

Conclusion

Reading a confusion matrix in isolation makes it hard to compare test performance across studies. This calculator converts the four raw counts into the standard sensitivity, specificity, and predictive-value figures used to describe and compare diagnostic tests. It reports what the numbers show, not whether a particular test should be relied on for an individual diagnosis.