ROC curves and AUC

Analytika TeamLast reviewed 6 min read

A blood test, a risk score or a model’s predicted probability all produce numbers, but decisions are yes/no: treat or not, flag or not. ROC (receiver operating characteristic) analysis evaluates how well a continuous score discriminates between two outcomes, across every possible threshold.

Sensitivity and specificity

  • Sensitivity (true positive rate): the share of actual positives the test catches.
  • Specificity (true negative rate): the share of actual negatives the test correctly clears.

Lowering the cut-off catches more positives but raises false alarms. The ROC curve traces this trade-off across all cut-offs.

Reading the AUC

AUCDiscrimination (rough guide)
0.5None (chance)
0.7–0.8Acceptable
0.8–0.9Excellent
> 0.9Outstanding

Worked example: a biomarker for poor outcome after brain haemorrhage

R’s pROC::aSAH data include 113 patients with aneurysmal subarachnoid haemorrhage, 41 of whom had a poor outcome. How well does the S100B protein level predict it?

  • AUC = 0.73, 95% CI [0.63, 0.83] (DeLong method), z = 4.48, p < .001. Acceptable discrimination: a randomly chosen poor-outcome patient has a higher S100B level than a randomly chosen good-outcome patient 73% of the time.
  • Youden-optimal cut-off: 0.205, with sensitivity 63% and specificity 81%.

These values match R’s pROC package in Analytika’s test suite. With 63% sensitivity, more than a third of poor-outcome patients would be missed, which is why a clinically chosen threshold might favour sensitivity over the Youden point.

APA write-up

S100B discriminated between poor and good outcomes, AUC = .73, 95% CI [.63, .83], p < .001. At the Youden-optimal cut-off (0.205), sensitivity was 63% and specificity 81%.

Cautions

  • An AUC measured on the same data used to choose the cut-off or build the model is optimistic. Validate in new data.
  • AUC ignores calibration: a model can rank well but predict poorly calibrated probabilities.
  • Choose thresholds from the consequences of false positives and false negatives, not by default.

ROC curves are also used to judge logistic regression models.

References

  • Robin, X., Turck, N., Hainard, A., et al. (2011). pROC: An open-source package for R and S+ to analyze and compare ROC curves. BMC Bioinformatics, 12, 77.

More in Advanced methods

Run this on your own data

Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.

Try it free