liveBook · Manning

Receiver operating characteristic

As explained in Statistics Slam Dunk

A ROC curve plots a binary classifier's true positive rate against its false positive rate across decision thresholds.

A receiver operating characteristic (ROC) curve evaluates a binary classifier across decision thresholds. It plots sensitivity—the true positive rate—against specificity, shown here on the x-axis, to reveal how well the model distinguishes positive from negative cases. section 14.6.2

Use ROC analysis to separate threshold-dependent prediction results from overall discriminatory power:

  • Sensitivity measures correctly identified positive cases, while specificity measures correctly identified negative cases. section 14.6.2
  • The area under the curve (AUC) summarizes discriminatory power: 1 represents perfect separation, 0.5 represents random performance, and higher values are better. section 14.6.2
  • Unlike error rate and accuracy, which summarize individual thresholded predictions, AUC evaluates how well the model distinguishes positive from negative instances overall. section 14.6.2

Predicting NBA playoff qualification

A logistic regression predicts whether an NBA team reaches the playoffs. After comparing actual outcomes with predicted values, pROC computes an AUC of 0.73, indicating fairly strong predictive power. Base R then plots the curve with sensitivity on the y-axis and specificity on the x-axis: roc_curve <- roc(actuals$actual_values, predictions$predicted_values2) plot(roc_curve, col = "red", main = "ROC Curve: AUC = 0.73", xlab = "Specificity", ylab = "Sensitivity") section 14.6.2

packages <- c("tidyverse", "patchwork", "ggpubr", "pscl", "SciViews", 
             "questionr", "caret", "pROC")

lapply(packages, library, character.only = TRUE)

Load pROC alongside the modeling and visualization packages used to compute and display ROC curves. section 14.1

How Statistics Slam Dunk covers it

How deep it goes
Defines sensitivity, specificity, AUC, and thresholded accuracy, then demonstrates computation and plotting while stopping short of threshold optimization.
Examples
Uses NBA playoff predictions, an 80-record confusion matrix, an AUC of 0.73, and plots comparing two logistic regressions.
What it assumes
Assumes binary outcomes and logistic-regression predictions, while defining sensitivity, specificity, accuracy, error rate, and AUC during application.
What you can do after
Diagnose classification performance with pROC and base R, then interpret AUC alongside sensitivity, specificity, accuracy, and error rate.
How it connects
Connects binary classification with logistic regression, confusion matrices, sensitivity, specificity, accuracy, error rate, and AUC.

Also explained in

Compare how 7 books explain receiver operating characteristic →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Slam Dunk. The section links point to the parts of the book it draws on.