liveBook · Manning

Specificity

As explained in Statistics Slam Dunk

Specificity is the proportion of actual negative cases that a classification procedure correctly identifies.

Specificity measures how well a classification model identifies actual negative cases. Also called the true negative rate, it focuses on avoiding false positives. section 14.6.2

Calculate specificity as TN / (TN + FP), where TN counts correctly identified negatives and FP counts negatives incorrectly classified as positive. section 14.6.2

Predicting NBA playoff qualification

For playoff predictions, the model correctly identified 19 teams that did not qualify and incorrectly predicted qualification for 11 teams. Specificity was 19 / (19 + 11) = 0.6333, or about 63%. section 14.6.2

Interpret specificity alongside the other confusion-matrix measures:

  • Higher specificity means fewer false positives among actual negative cases. section 14.6.2
  • Sensitivity measures correctly identified positives, whereas specificity measures correctly identified negatives. section 14.6.2
  • The preferred balance depends on consequences: avoiding false positives matters especially when wrongful convictions are at stake. section 14.6.2
confusion_matrix <- table(actuals$actual_values,     predictions$predicted_values2)
print(confusion_matrix)
##    0  1
## 0 19 11
## 1 10 40

Inspect the confusion matrix before calculating specificity from the negative-outcome row and its false positives. section 14.6.2

How Statistics Slam Dunk covers it

How deep it goes
Defines the metric, gives its formula, distinguishes false positives, and computes it from an R confusion matrix.
Examples
Uses NBA postseason predictions with 19 true negatives, 11 false positives, and an observed specificity of 0.6333.
What it assumes
Assumes binary outcomes and predicted classes, while defining true negatives, false positives, sensitivity, and specificity.
What you can do after
Apply via R's specificity function after constructing actual and predicted binary classifications.
How it connects
Connects specificity with sensitivity, confusion matrices, logistic regression, ROC curves, accuracy, and misclassification error.

Also explained in

Compare how 6 books explain specificity →

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.