Both
pROC::auc(0:1, 1:0)
pROC::auc(0:1, 0:1)
give an AUC of 1..
With more experiments, it seems that it always returns max(AUC, 1 - AUC). Is there an option to change this? I can't find a GitHub repo to report this issue.
Both
pROC::auc(0:1, 1:0)
pROC::auc(0:1, 0:1)
give an AUC of 1..
With more experiments, it seems that it always returns max(AUC, 1 - AUC). Is there an option to change this? I can't find a GitHub repo to report this issue.
In pROC::roc
there is an argument direction
which is by default set to auto
.
From the documentation of roc
:
direction - in which direction to make the comparison? “auto” (default): automatically define in which group the median is higher and take the direction accordingly. “>”: if the predictor values for the control group are higher than the values of the case group (controls > t >= cases). “<”: if the predictor values for the control group are lower or equal than the values of the case group (controls < t <= cases).
pROC::auc(0:1, 1:0, direction = "<")
pROC::auc(0:1, 0:1, direction = "<")
An explanation of such rationale is given in the comments by Calimo: There is no reason to assume that higher predictor values are more positive in all cases. As in the case of a model indicating the probability of the negative class
More on the matter can be seen here
Try the auc function in ModelMetrics:
ModelMetrics::auc(0:1, 1:0)
ModelMetrics::auc(0:1, 0:1)
Output:
[1] 0
[1] 1