Mathwords logoMathwords

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 ss and predicts positive when s≥ts \ge t, the ROC curve is the set of points (FPR(t),TPR(t))(\text{FPR}(t), \text{TPR}(t)) traced as the threshold tt varies from +∞+\infty to −∞-\infty. It runs from (0,0)(0,0) to (1,1)(1,1). 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

TPR=TPTP+FN,FPR=FPFP+TN,AUC=∫01TPR d(FPR)\text{TPR} = \frac{TP}{TP+FN}, \qquad \text{FPR} = \frac{FP}{FP+TN}, \qquad \text{AUC} = \int_0^1 \text{TPR}\, d(\text{FPR})
Where:
  • TPTP = True positives: positive cases correctly flagged
  • FNFN = False negatives: positive cases the classifier missed
  • FPFP = False positives: negative cases wrongly flagged
  • TNTN = True negatives: negative cases correctly cleared
  • TPR\text{TPR} = True positive rate (sensitivity), plotted on the vertical axis
  • FPR\text{FPR} = 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 (0,0)(0,0) and (1,1)(1,1).
Step 1: Strict cutoff: divide flagged sick patients by all 40 sick, and flagged healthy patients by all 60 healthy.
TPR=2440=0.6,FPR=660=0.1\text{TPR} = \frac{24}{40} = 0.6, \qquad \text{FPR} = \frac{6}{60} = 0.1
Step 2: Loose cutoff: the test catches more sick patients, but it also raises more false alarms.
TPR=3640=0.9,FPR=2460=0.4\text{TPR} = \frac{36}{40} = 0.9, \qquad \text{FPR} = \frac{24}{60} = 0.4
Step 3: Connect (0,0)(0,0), (0.1,0.6)(0.1, 0.6), (0.4,0.9)(0.4, 0.9), and (1,1)(1,1). Add the three trapezoid areas, each equal to width times average height.
AUC=0.1(0+0.6)2+0.3(0.6+0.9)2+0.6(0.9+1)2=0.03+0.225+0.57=0.825\text{AUC} = \frac{0.1(0+0.6)}{2} + \frac{0.3(0.6+0.9)}{2} + \frac{0.6(0.9+1)}{2} = 0.03 + 0.225 + 0.57 = 0.825
Answer: The ROC points are (0.1,0.6)(0.1, 0.6) and (0.4,0.9)(0.4, 0.9), and the estimated AUC is 0.8250.825. 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 (0,0)(0,0) to (1,1)(1,1), 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.

Related Terms