- Introduced by
- Peterson, Birdsall & Fox (signal detection theory); Hanley & McNeil (medical statistics)
- Year
- 1954 (signal detection); 1982 (AUC formalization)
- Type
- Diagnostic accuracy evaluation
- Family
- Classical statistics
What does it do?
ROC analysis evaluates how well a continuous or ordinal score separates two binary outcome classes.
Sensitivity and false positive rate are computed at each candidate threshold and plotted against each other, and the area under the resulting curve (AUC) summarizes discrimination: 0.5 corresponds to no discrimination and 1.0 to perfect separation. Values below 0.5 mean the score orders cases in the opposite direction to the outcome.
The intuition behind the method
Suppose a test returns a numeric score and you must choose a cutoff above which a case is called positive. Raising the cutoff catches fewer real cases but flags fewer healthy ones; lowering it does the reverse. The ROC curve traces this trade-off as the cutoff varies, with one point per threshold, in the space of sensitivity against 1 minus specificity. Hanley and McNeil (1982) show that the AUC equals the probability that a randomly chosen diseased subject is ranked with greater suspicion than a randomly chosen non-diseased subject, so the area summarizes ranking quality rather than performance at one cutoff.
History
ROC curves have their roots in signal detection theory, and the method later entered clinical testing through signal detection and diagnostic work. Hanley and McNeil (1982) showed that the AUC equals the probability of correct ranking, which is the quantity estimated by the Wilcoxon statistic, and provided closed-form standard-error and sample-size approximations. Zweig and Campbell (1993) presented ROC plots as a central tool for evaluating diagnostic tests in clinical medicine.
When to use it
Choose ROC analysis when the outcome is binary and the question is how well a continuous or ordinal score ranks cases, or when the decision threshold has not been fixed in advance and performance across all thresholds is of interest. It suits diagnostic biomarker evaluation, validation of a classifier on a binary outcome, and comparison of tests applied to the same subjects. Zweig and Campbell (1993) describe ROC plots as a basis for selecting decision thresholds and for further analyses such as likelihood ratios. Do not use it when the outcome has more than two classes without a binary reformulation, when the predictor has no meaningful ordering, or when the main question is whether predicted probabilities are accurate; that requires calibration assessment. With rare positive cases, read the ROC analysis alongside a precision-recall curve.
Limitations and considerations
- The AUC depends only on rank order, so it says nothing about whether predicted probabilities are calibrated.
- A single number hides the trade-off at the operating point an application will actually use; the full curve, or sensitivity and specificity at the chosen threshold, is needed for that.
- Estimates from small samples are imprecise, and the 1982 analysis by Hanley and McNeil is explicitly concerned with how large samples must be for a reliable AUC.
- The AUC averages over all thresholds, including regions an application would never use, so a model can have a good AUC driven by performance where it does not matter in practice.
- Choosing an optimal cutoff requires cost assumptions that are seldom stated and can be arbitrary.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Threshold-free summary: the AUC aggregates performance over every cutoff, so it does not rest on one arbitrary choice, although an operating threshold must still be chosen separately.
- The AUC has a direct probabilistic reading as the chance that a randomly chosen diseased subject is ranked above a randomly chosen non-diseased one (Hanley and McNeil, 1982).
- Because it depends only on the ordering of scores, the AUC is unchanged by any strictly increasing transformation of the predictor.
- Sensitivity and false positive rate do not depend on disease prevalence, so the curve itself does not shift with prevalence, unlike positive predictive value.
- Supports comparison of tests applied to the same subjects, provided the correlation between the paired curves is handled.
Applications
- Evaluating diagnostic biomarkers, for example troponin for myocardial infarction or PSA for prostate cancer.
- Assessing classifiers in medical imaging, fraud detection, and credit scoring, where a binary outcome is predicted from a continuous score.
- Comparing two laboratory tests or imaging modalities applied to the same patients.
- Selecting operating thresholds in screening programmes by weighing sensitivity against specificity.
- Validating risk scores for outcomes such as mortality in epidemiology and critical care.
- Analysing detection performance in psychophysics and signal detection experiments.
How it works
How it works
The predictor variable is sorted and every unique value is treated as a candidate decision threshold. At each threshold, cases scoring above it are predicted positive and cases below are predicted negative. Sensitivity (TPR = TP / (TP + FN)) and false positive rate (FPR = FP / (FP + TN)) are computed at each threshold, producing one point per threshold on the ROC plot.
The AUC is the integral of TPR with respect to FPR, as in the mechanics formula, and in practice it is estimated from the points of the threshold sweep, commonly with the trapezoidal rule. Hanley and McNeil (1982) show that the same quantity is estimated by the nonparametric Wilcoxon statistic, which gives a rank-based route that does not require constructing the curve explicitly. How an AUC value should be interpreted depends on the application, and the cited sources do not provide universal cut-offs.
Formula
AUC = \int_0^1 \text{TPR}\, d(\text{FPR})The null hypothesis that AUC equals 0.5 (chance level) is tested against the alternative that AUC is greater than 0.5. The test statistic is z = (AUC − 0.5) / SE(AUC), where SE(AUC) is the estimated standard error of the AUC, and it is referred to the standard normal distribution. Hanley and McNeil (1982) give closed-form approximations for the sampling standard error of a single AUC and guidance on the sample size needed to estimate it reliably. A confidence interval for the AUC should be reported alongside the test. Comparing two AUCs estimated on the same subjects is a different problem because the estimates are correlated, and is addressed under curve comparison.
Formula
H_0: AUC = 0.5 \quad H_1: AUC > 0.5
Once the curve is available, a working threshold can be chosen with a criterion such as the Youden index (sensitivity plus specificity minus one, maximized), the point nearest the upper-left corner, or a cost-weighted criterion reflecting the relative harm of false positives and false negatives in the application. The chosen threshold is only as sound as the costs it encodes, and those costs are often assumed rather than measured.
When two or more tests or models are evaluated on the same subjects, their ROC curves can be overlaid and their AUCs compared. Because the two estimates are correlated, the standard error of their difference must be computed in a way that accounts for that correlation; treating the AUCs as independent misstates the uncertainty of the difference. For AUCs estimated on independent samples, the two estimates and their standard errors can be compared directly.
Common pitfalls
- Choosing the cutoff and reporting performance on the same data inflates apparent accuracy; the threshold should be selected on training or cross-validation data and evaluated on held-out data.
- Comparing AUCs across studies without considering differences in case mix, spectrum of disease severity, or outcome prevalence.
- Reporting the AUC without its confidence interval, or without the sensitivity and specificity at the threshold actually used.
- Reading a given AUC as universally good or poor; the acceptable value depends on the consequences of errors in the specific application.
- Applying ROC analysis to rare events without checking precision: false positives are measured against a large negative class, so the curve can look favourable while most flagged cases are false positives.
Frequently asked questions
What is a good AUC?
There is no universal threshold. An AUC of 0.5 indicates no discrimination and 1.0 perfect separation, but whether an intermediate value is adequate depends on the cost of errors in the setting. In life-critical screening a modest AUC may be insufficient, while in exploratory research it may be informative. Report the confidence interval and interpret the value against domain benchmarks.
How is AUC related to the Mann-Whitney U statistic?
The AUC equals the probability that a randomly selected positive case scores higher than a randomly selected negative case. Hanley and McNeil (1982) show that this is the quantity estimated by the nonparametric Wilcoxon statistic, which is the two-sample Mann-Whitney test. Rank-based computation and the AUC therefore give equivalent results in the two-class case.
Should I use ROC or precision-recall curves?
ROC curves suit situations where both classes matter comparably. When positive cases are rare, precision-recall curves show how many flagged cases are truly positive, which an ROC curve does not directly reveal because false positives are measured against the large negative class.
How do I compare two ROC curves statistically?
When both tests are applied to the same subjects, the comparison must account for the correlation between the two AUC estimates; treating them as independent is incorrect. For AUCs estimated on independent samples, the two estimates and their standard errors can be compared directly.
Does a high AUC mean the test is well-calibrated?
No. AUC measures discrimination, the ability to rank positive cases above negative ones. Calibration, whether predicted probabilities match observed event rates, is a separate property, and a model can have a high AUC while being systematically overconfident or underconfident. Assess calibration separately, for example with calibration plots or goodness-of-fit measures such as Hosmer-Lemeshow.
Related methods
Sources
Hanley, J. A., & McNeil, B. J. (1982). The meaning and use of the area under a receiver operating characteristic (ROC) curve. Radiology, 143(1), 29–36.
Open DOI referenceZweig, M. H., & Campbell, G. (1993). Receiver-operating characteristic (ROC) plots: a fundamental evaluation tool in clinical medicine. Clinical Chemistry, 39(4), 561–577.
Open DOI reference