Search code examples
rdata-sciencerocaucproc-r-package

R - ROC Curves/AUC Specificity vs 1-Specificity


enter image description hereI have created a few predictive models and I am in the process of evaluating them by looking at the ROC Curve and AUC.

Currently, I have Specificity on X axis, however, when I researched ROC Curves, I saw 1 - Specificity on the X axis.

What is the difference and which should I use to validate my predictive models? If Specificity is on the X-Axis, do I still want to maximize the AUC (from experience the answer is yes but I want to confirm)?

Here is how I am plotting it:

> library(pROC)
> g <- roc(Setup ~ Probs, data = Data)
> plot(g) 
> auc(g)
> ci.auc(g)

Solution

  • This is purely a labeling problem: note that the x axis goes decreasing from 1 to 0, which is exactly the same as plotting 1-specificity on an x axis increasing from 0 to 1.

    I strongly suspect you are using the pROC package. This behavior is documented in the FAQ and you can set the legacy.axes argument to TRUE to change the behavior if the default one bothers you.

    plot(g, legacy.axes = TRUE)