Editverse Free Calculator
ROC Curve & AUC Calculator
Measure how well a test or score separates two groups, with the ROC curve, the area under it (AUC), and the reproducible R command. Read a full interpretation guide below. Validated against R 4.3.3.
In Simple Words
A ROC curve shows how a continuous test or risk score performs as you slide the decision threshold from strict to lenient. At each threshold it plots the true-positive rate (sensitivity) against the false-positive rate (1 − specificity). The area under the curve (AUC) condenses the whole picture into one number between 0.5 and 1.
The AUC has a clean interpretation: it is the probability that the test gives a higher score to a randomly chosen positive case than to a randomly chosen negative one. An AUC of 0.5 means the test is no better than a coin flip; 1.0 means perfect separation. As a rough guide, 0.7–0.8 is acceptable, 0.8–0.9 good, and above 0.9 excellent.
When to Use a ROC Curve
Use ROC analysis to evaluate the discriminatory ability of a continuous predictor against a binary truth: a biomarker, a clinical score, or the predicted probability from a logistic regression model. It is the standard way to compare diagnostic tests and to choose an operating threshold that balances sensitivity and specificity for a given clinical context.
Report the AUC with its 95% confidence interval, and state the threshold you selected along with the sensitivity and specificity there. When two models are compared on the same patients, use a paired test (DeLong’s) rather than treating the AUCs as independent. If you only have a single fixed cutoff rather than a continuous score, report sensitivity and specificity directly. Not sure ROC is the right tool? Our interactive Test Selector can help.
Expected format: Score, Label: one per line (1=positive, 0=negative)
Drop a CSV here or click to choose. Parsed in your browser: nothing is uploaded.
Expected format: Score, Label: one per line (1=positive, 0=negative)
library(pROC)
scores <- c({roc_scores})
labels <- c({roc_labels})
roc(labels, scores, direction = "{roc_dir}") # {roc_dir_note}User guide
When to use. Evaluate the discriminatory ability of a continuous test or score.
Assumptions. Binary true outcome (0/1); continuous predictor or score.
Common mistakes. AUC near 0.5 means no discrimination; do not over-interpret a single threshold.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Hanley JA, McNeil BJ. The meaning and use of the area under an ROC curve. Radiology. 1982;143:29-36.
Worked Examples
Example 1: A biomarker score
Ten subjects with scores and true labels (1 = disease, 0 = healthy) produce a curve that bows toward the top-left corner. The AUC summarises how reliably higher scores correspond to disease. Report the AUC with its confidence interval and the sensitivity and specificity at your chosen cutoff.
Example 2: Choosing a threshold
The Youden index (sensitivity + specificity − 1) identifies the point that maximises the sum of the two. But the best operating threshold depends on the cost of false positives versus false negatives in your setting — a screening test may favour sensitivity, a confirmatory test specificity.
Assumptions to Check
Binary, correctly labelled truth. Each case must be classified as positive or negative by a trustworthy reference standard; misclassified labels distort the curve.
Continuous or ordinal predictor. ROC analysis needs a score with a range of values. A single yes/no test has just one point, not a curve.
Independent observations. Each subject contributes one score-label pair. Repeated measurements on the same subjects need methods that account for the clustering.
Common Mistakes
Treating AUC as accuracy
AUC measures ranking ability across all thresholds, not the accuracy at any single cutoff. A high AUC does not guarantee good performance at the threshold you actually use.
Comparing AUCs from different samples
To compare two models, test them on the same patients with a paired method (DeLong’s test). Comparing AUCs computed on different datasets is not valid.
Ignoring class imbalance
With very rare positives, a high AUC can still mean poor precision. A precision-recall curve is often more informative for imbalanced data.
Picking the threshold after seeing outcomes
Selecting the cutoff that looks best on the same data inflates performance. Validate the chosen threshold on independent data.
Frequently Asked Questions
What does the AUC actually mean?
It is the probability that the test assigns a higher score to a randomly selected positive case than to a randomly selected negative case. 0.5 is chance, 1.0 is perfect.
What counts as a good AUC?
As a rough guide, 0.7–0.8 is acceptable, 0.8–0.9 good, and above 0.9 excellent — but the clinically useful value depends on the application.
How do I choose the best cutoff?
The Youden index gives a common default, but weigh the relative cost of false positives and false negatives for your specific use.
Does the result match SPSS, R, and Stata?
Yes. The calculator uses the same trapezoidal AUC computation as the pROC package and shows the exact R command so you can reproduce it.
Related Calculators
References
- Hanley JA, McNeil BJ. The meaning and use of the area under a receiver operating characteristic (ROC) curve. Radiology. 1982;143(1):29–36. PMID 7063747.
- Mandrekar JN. Receiver operating characteristic curve in diagnostic test assessment. J Thorac Oncol. 2010;5(9):1315–1316. PMID 20736804.
- DeLong ER, DeLong DM, Clarke-Pearson DL. Comparing the areas under two or more correlated ROC curves: a nonparametric approach. Biometrics. 1988;44(3):837–845.
Need This Analysis Done for Your Manuscript?
Our PhD biostatisticians build your ROC curves, compute AUCs with confidence intervals, and deliver publication-ready figures with reproducible R output.
