Confusion Matrix Diagnostic Metrics Calculator

Clinical calculation support · Verify results before clinical use

Enter confusion matrix counts

Enter the number of true-positive, false-positive, false-negative, and true-negative classifications. Use counts from the same binary classification task and reference standard.

Values must be finite and non-negative. Fractional values are accepted for weighted confusion matrices; for ordinary patient counts, use whole numbers.

Reset

Understanding the metrics

A confusion matrix compares a binary test or classifier with a chosen reference standard. TP and TN are correct positive and negative classifications; FP and FN are incorrect positive and negative classifications, respectively.

Metric definitions

  • Sensitivity (recall): proportion of reference-standard positive cases classified as positive.
  • Specificity: proportion of reference-standard negative cases classified as negative.
  • Positive predictive value (precision): proportion of positive classifications that are true positives.
  • Negative predictive value: proportion of negative classifications that are true negatives.
  • Accuracy: proportion of all classifications that are correct.
  • F1 score: harmonic mean of precision and recall; it does not incorporate true negatives directly.

Interpretation cautions

Predictive values depend on disease prevalence and on the population in which the test is used. Accuracy can be misleading with imbalanced classes. Report the reference standard, study population, threshold, and relevant uncertainty measures when evaluating a diagnostic test. These metrics alone do not establish clinical utility.

References

Parikh R, Mathai A, Parikh S, Sekhar GC, Thomas R. Understanding and using sensitivity, specificity and predictive values. Indian Journal of Ophthalmology. 2008;56(1):45–50. DOI: 10.4103/0301-4738.37595; PMID: 18158403. PubMed record
Altman DG, Bland JM. Diagnostic tests 1: Sensitivity and specificity. BMJ. 1994;308:1552. DOI: 10.1136/bmj.308.6943.1552; PMID: 8019315. PubMed record
Altman DG, Bland JM. Diagnostic tests 2: Predictive values. BMJ. 1994;309:102. DOI: 10.1136/bmj.309.6947.102; PMID: 8038641. PubMed record
Google for Developers. Classification: Accuracy, recall, precision, and related metrics. Reference for the harmonic-mean definition of the F1 score. Documentation