Learning objectives
- Calculate true-positive and false-positive rates at specified score thresholds.
- Interpret ROC area as a ranking statistic rather than a calibrated probability.
Prerequisites: Use a confusion matrix and distinguish actual labels from model scores.
Mechanism and interpretation
A receiver operating characteristic curve records true-positive rate against false-positive rate as a score threshold changes. True-positive rate divides correctly flagged positives by all actual positives; false-positive rate divides incorrectly flagged negatives by all actual negatives. In this lesson, scores at least as large as the threshold are classified positive. Lowering the threshold admits more observations, potentially increasing both rates.
For binary labels, empirical ROC area can also be computed by comparing every positive score with every negative score. Count one for a positive score that is larger, one-half for a tie, and zero otherwise; divide by the number of positive-negative pairs. This measures ranking, not calibration. A monotonic transformation can leave all rankings unchanged while radically changing whether the scores are meaningful probabilities. The curve alone also does not specify costs, payoff sizes or the best operational threshold.
Worked case · synthetic data
Hypothetical positive observations have scores 0.9 and 0.4; negatives have scores 0.8 and 0.1. At threshold 0.5, one of two positives and one of two negatives are flagged, so both rates are 0.5. At 0.3, true-positive rate becomes 1 while false-positive rate stays 0.5. Among four positive-negative comparisons, three rank correctly, so ROC area is 0.75. At threshold 0.85, the rates are 0.5 and zero, showing a different operating point on the same ranking.
Failure modes and context
A tiny sample gives a coarse and uncertain ROC curve. In an imbalanced deployment population, an apparently modest false-positive rate can still produce many unwanted actions. Changes in class-conditional score distributions alter the curve, and selecting a threshold on the final evaluation set overstates prospective performance. Report a threshold chosen using appropriate development data together with its counts, not merely a favorable overall area.
Practice assignment
For another sample, positive scores are 0.7 and 0.6; negative scores are 0.8 and 0.2. Compute ROC area by pair comparisons. Then calculate both rates at thresholds 0.65 and 0.55. Explain why a higher true-positive rate at the second threshold does not improve the area of the unchanged score ranking.
Worked answer
Each positive beats only the negative score 0.2, so two of four comparisons succeed and area is 0.5. At 0.65, one positive and one negative are flagged, giving rates 0.5 and 0.5. At 0.55, both positives and one negative are flagged, giving 1 and 0.5. Changing a threshold chooses an operating point; it does not reorder observations or alter the curve’s overall area.
Check your understanding
Question 1
What denominator defines false-positive rate?
- All actual negatives
- All flagged observations
- All actual positives
Reveal answer and reasoning
A. All actual negatives
The rate measures the fraction of negative cases incorrectly flagged.
Question 2
What is the first sample’s ROC area?
- 0.5
- 1
- 0.75
Reveal answer and reasoning
C. 0.75
Three of the four positive-negative pairs are ranked correctly.
Question 3
Does ROC area prove that a score of 0.8 is a calibrated 80% probability?
- Only if area exceeds 0.5
- No
- Yes
Reveal answer and reasoning
B. No
Ranking and calibration are distinct properties of a prediction system.
