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





