0
$\begingroup$

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?

$\endgroup$
2
$\begingroup$

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.

A useful CV thread on AUC, what it is, and how to interpret it is here.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you for your answer. Your answer inspires me to solve this problem. But I still wonder about what you said The AUC should be 1 for this data because all 1 examples are ranked higher than all -1 examples (note the signs) , why if all 1 examples are ranked higher than all -1 examples, we can directly said "AUC" =1? Could you give me some explanation? Many thanks. $\endgroup$ – user93892 Aug 17 '17 at 7:50
  • 1
    $\begingroup$ I've added more detail. $\endgroup$ – Sycorax says Reinstate Monica Aug 18 '17 at 4:46
  • 2
    $\begingroup$ I worte a less technical proof of the AUC equivelence here: madrury.github.io/jekyll/update/statistics/2017/06/21/… $\endgroup$ – Matthew Drury Aug 18 '17 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.