# Why calculating AUC generates 'inf' value

I use the function auc in the R package pROC to calculate the auc value in a simulation study. test.y is the observed response, y_pred_mle is the predicted response.

> test.y
test.y
1      -1
2      -1
3      -1
4      -1
5      -1
6      -1
7       1
8       1
9       1
10      1
11      1
12      1

> y_pred_mle
[,1]
76 -166.7094
53 -203.4014
52 -220.0880
51 -189.4703
95 -222.5294
72 -207.0304
24  722.8809
44  727.5353
12  770.5053
42  783.7437
27  733.3144
3   773.2688

> out_auc_mle<- auc( test.y, y_pred_mle  )
> out_auc_mle
[1] Inf


I wonder how can this generate Inf value? In my understanding on auc, the range of auc should be 0 to 1. I am not asking an coding question. I just wonder how the auc value can be Inf. Can anybody explain me about is it possible that the auc is Inf? Then how to interpret it?

The AUC should be 1 for this data because all 1 examples are ranked higher than all -1 examples. This is because AUC corresponds exactly to the probability that a randomly-selected positive is ranked more highly than a randomly-selected negative. Matthew Drury has a nice write-up here. There must be either an error in usage or a bug, probably the former.