ROC Curve Calculator
Calculate sensitivity, specificity, PPV, NPV, accuracy, F1 score, and approximate AUC from a confusion matrix (TP, FP, TN, FN).
About this calculator
This calculator derives ten diagnostic-test and classifier metrics — sensitivity, specificity, precision (PPV), NPV, accuracy, F1 score, an AUC approximation, Youden's J statistic, and both likelihood ratios — from a four-cell confusion matrix of True Positives, False Positives, True Negatives, and False Negatives. False Positives and True Negatives are genuinely, provably inert on Sensitivity: the formula, tp / (tp + fn), never references either one in code, so no amount of nudging them changes the Sensitivity output at all — this isn't a rounding coincidence, it's a direct consequence of which two variables appear in that line.
True Positives and False Negatives are the two inputs that do move Sensitivity, in opposite directions, with almost identically sized effects under a small nudge at the default confusion matrix — close enough that this calculator does not claim one single input dominates Sensitivity, since which of the two edges out the other can flip on tiny changes to the starting numbers. What the calculator does NOT surface by default: when False Positives is exactly 0 (perfect specificity), the Positive Likelihood Ratio formula produces a true mathematical Infinity internally, which the engine then silently displays as the flat number 9999 rather than any indication that the real value is unbounded.
Inputs
Results
Sensitivity (Recall / TPR)
0.85
Specificity (TNR)
0.95
F1 Score
0.87
How to Use This Calculator
- Enter True Positives (TP), False Positives (FP), and True Negatives (TN).
- Set False Negatives (FN).
- Review Sensitivity (Recall / TPR), Specificity (TNR), and F1 Score.
- Use Positive Predictive Value (Precision) and Negative Predictive Value to inform your decision.
- Use the chart to visualize the results and explore different scenarios by adjusting inputs.
How the result changes with True Positives (TP)
| True Positives (TP) | Sensitivity (Recall / TPR) | Specificity (TNR) | F1 Score |
|---|---|---|---|
| 43 | 0.74 | 0.95 | 0.77 |
| 64 | 0.81 | 0.95 | 0.84 |
| 128 | 0.9 | 0.95 | 0.91 |
| 213 | 0.93 | 0.95 | 0.94 |
What each input means
- True Positives (TP)
- Number of correctly identified positive cases.
- False Positives (FP)
- Number of negative cases incorrectly classified as positive (Type I error).
- True Negatives (TN)
- Number of correctly identified negative cases.
- False Negatives (FN)
- Number of positive cases incorrectly classified as negative (Type II error).
How this is calculated
Worked example, using the default values
- Identify Input Parameters4 parametersTrue Positives (TP) = 85, False Positives (FP) = 10, True Negatives (TN) = 190, False Negatives (FN) = 15 = 4 input(s) provided
- Calculate SensitivitySensitivity0.85 = 0.85
- Calculate SpecificitySpecificity0.95 = 0.95
- Calculate F1 ScoreF1 Score = f10.8718 = 0.8718
- Calculate Positive Predictive ValuePositive Predictive Value0.8947 = 0.8947
- Calculate Negative Predictive ValueNegative Predictive Value0.9268 = 0.9268
Engine last updated . Checked against 2 independently-derived tests — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.
Frequently Asked Questions
Why do False Positives and True Negatives never move the Sensitivity value?
Sensitivity is computed directly as tp / (tp + fn) in the engine — a formula that simply never reads falsePositives or trueNegatives at all. Changing either one, by any amount, leaves Sensitivity completely unchanged, because the two variables that actually determine it are True Positives and False Negatives alone.
Which input matters more for Sensitivity: True Positives or False Negatives?
At the default confusion matrix, nudging either one by a small percentage moves Sensitivity by almost exactly the same amount, just in opposite directions — more True Positives raises it, more False Negatives lowers it. Because the two effects are so closely matched here, this calculator doesn't single out one as clearly dominant; which one edges out the other can flip with small changes to the starting counts.
What happens to the Positive Likelihood Ratio if there are zero False Positives?
Mathematically, a False Positive Rate of exactly 0 makes the likelihood ratio formula divide by zero, which the engine computes as true Infinity. Rather than showing that directly, it substitutes the flat number 9999 for display — a real diagnostic test with perfect specificity would show a genuinely unbounded ratio, not a specific finite number.
What does Youden's J Statistic actually measure here?
It's computed as Sensitivity plus Specificity minus 1, a single number that summarizes how far a test's combined true-positive and true-negative performance sits above what random guessing would achieve. A value of 0 means no better than chance, while the maximum of 1 means the test makes no classification errors in either direction.
Related Calculators
The questions that sit next to this one — chosen by subject, including calculators filed under a different category.
Bayesian Prior Calculator
Apply Bayes' theorem to update a prior probability given test sensitivity and false positive rate. Calculate the posterior probability after a positive or negative result.
StatisticsLogistic Regression Calculator
Calculate the predicted probability, odds, and odds ratio from logistic regression coefficients. Visualize the S-shaped probability curve.
Data ScienceConfusion Matrix Analyzer
Analyze classification model performance from confusion matrix values. Calculate precision, recall, F1 score, MCC, accuracy, specificity, and more.
Machine Learning & AIModel Performance Calculator
Complete ML model evaluation. Classification metrics, regression analysis, cross-validation, ROC/AUC curves, and model comparison.
StatisticsZ-Score Calculator
Calculate the z-score (standard score) for any value in a normal distribution. Find the percentile ranking and probability associated with your data point.
More in Math & Statistics.