Receiver Operating Characteristic — Definition, Formula & Example
A receiver operating characteristic (ROC) curve is a graph that shows how well a yes-or-no classifier separates two groups. It plots the share of true cases the classifier catches against the share of false alarms it raises as you move its decision cutoff.
For a classifier that outputs a score and predicts positive when , the ROC curve is the set of points traced as the threshold varies from to . It runs from to . The area under the curve (AUC) equals the probability that a randomly chosen positive case receives a higher score than a randomly chosen negative case, with ties counted as one half.
Key Formula
Where:
- = True positives: positive cases correctly flagged
- = False negatives: positive cases the classifier missed
- = False positives: negative cases wrongly flagged
- = True negatives: negative cases correctly cleared
- = True positive rate (sensitivity), plotted on the vertical axis
- = False positive rate (1 minus specificity), plotted on the horizontal axis
Worked Example
Problem: A blood test gives each of 100 patients a score. Of these patients, 40 have a disease and 60 do not. At a strict cutoff, the test flags 24 sick and 6 healthy patients. At a loose cutoff, it flags 36 sick and 24 healthy patients. Find the two ROC points and estimate the AUC with trapezoids through and .
Step 1: Strict cutoff: divide flagged sick patients by all 40 sick, and flagged healthy patients by all 60 healthy.
Step 2: Loose cutoff: the test catches more sick patients, but it also raises more false alarms.
Step 3: Connect , , , and . Add the three trapezoid areas, each equal to width times average height.
Answer: The ROC points are and , and the estimated AUC is . A randomly chosen sick patient outscores a randomly chosen healthy patient about 82.5% of the time (counting ties as half).
Why It Matters
ROC curves are the standard way to evaluate logistic regression and machine-learning classifiers in statistics and data science courses. In medicine, they help researchers choose a diagnostic cutoff that balances missed diagnoses against unnecessary follow-up tests.
Common Mistakes
Mistake: Reading an AUC of 0.5 as "the model is right half the time," or treating AUC as accuracy.
Correction: An AUC of 0.5 matches the diagonal line from to , which is what random guessing produces. AUC measures how well the scores rank positives above negatives across all thresholds. Accuracy depends on one chosen cutoff and on how common each class is.
