0.9474
0.989
0.9
0.9944
0.985
0.095
0.9231
0.9474
0.989
0.9
0.9944
0.985
0.095
0.9231
The Sensitivity and Specificity Calculator computes all major diagnostic test performance metrics from a 2×2 confusion matrix: sensitivity (recall), specificity, positive predictive value (PPV/precision), negative predictive value (NPV), accuracy, prevalence, and the F1 score.
These metrics are fundamental in clinical medicine, machine learning, quality control, and any binary classification task. Understanding the trade-offs between sensitivity and specificity is essential for choosing appropriate diagnostic thresholds and evaluating classifier performance.
From a confusion matrix with True Positives (TP), False Positives (FP), False Negatives (FN), and True Negatives (TN):
Sensitivity (True Positive Rate / Recall):
$$\text{Sensitivity} = \frac{TP}{TP + FN}$$
The proportion of actual positives correctly identified.
Specificity (True Negative Rate):
$$\text{Specificity} = \frac{TN}{TN + FP}$$
The proportion of actual negatives correctly identified.
Positive Predictive Value (Precision):
$$PPV = \frac{TP}{TP + FP}$$
Negative Predictive Value:
$$NPV = \frac{TN}{TN + FN}$$
Accuracy:
$$\text{Accuracy} = \frac{TP + TN}{TP + FP + FN + TN}$$
Prevalence:
$$\text{Prevalence} = \frac{TP + FN}{\text{Total}}$$
F1 Score (harmonic mean of precision and recall):
$$F_1 = \frac{2 \times PPV \times \text{Sensitivity}}{PPV + \text{Sensitivity}}$$
High sensitivity means few false negatives — the test catches most positive cases. Critical for ruling out serious diseases (a negative result is reassuring).
High specificity means few false positives — the test rarely triggers false alarms. Critical for confirmation testing (a positive result is reliable).
PPV and NPV depend on prevalence. In low-prevalence settings, even high sensitivity and specificity can yield low PPV (the false positive paradox).
The F1 score balances precision and recall into a single metric, useful when classes are imbalanced. It ranges from 0 (worst) to 1 (perfect).
Inputs
Results
Excellent test: 94.7% sensitivity, 98.9% specificity, F1 = 0.92. PPV of 90% due to ~10% prevalence.
Inputs
Results
Spam filter catches 85.7% of spam (sensitivity) with 2.5% false positive rate. F1 = 0.88.
Increasing sensitivity (lowering the threshold) typically decreases specificity, and vice versa. This trade-off is visualized by the ROC curve. The optimal balance depends on the relative costs of false positives vs. false negatives.
Prioritize sensitivity when missing a positive case is costly (e.g., cancer screening, infectious disease detection). Prioritize specificity when false positives are harmful (e.g., invasive confirmatory procedures, criminal identification).
With imbalanced classes, accuracy can be high simply by predicting the majority class. If only 1% of samples are positive, always predicting negative gives 99% accuracy but 0% sensitivity. F1 score, AUC, or balanced accuracy are better metrics for imbalanced data.
F1 is the harmonic mean of precision and recall, giving equal weight to both. It is widely used in machine learning for evaluating classifiers on imbalanced datasets. F1 = 1.0 is perfect; F1 = 0 means the classifier is useless.
Sensitivity and specificity are properties of the test (fixed regardless of prevalence). PPV and NPV depend on prevalence — the same test has different predictive values in different populations. This is why screening in low-prevalence settings produces many false positives.
Absolutely. The confusion matrix (TP, FP, FN, TN) is the standard evaluation framework for binary classifiers. This calculator gives you all the standard metrics used in ML: precision, recall, F1, and accuracy.
Roboculator Team
The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.
How helpful was this calculator?
Be the first to rate!
Lottery Odds Calculator
Probability Calculators
Probability Calculator
Probability Calculators
Conditional Probability Calculator
Probability Calculators
Monty Hall Problem Calculator
Probability Calculators
Combinations Calculator (nCr)
Probability Calculators
Permutations Calculator (nPr)
Probability Calculators