# [R] comparing two ROCs

Xiao Li lixiao82 at gmail.com
Mon May 18 17:32:49 CEST 2009

```> Dear R-helper,
>
> I am trying to compare two AUCs derived from same population, but one
> is derived by adding extra features on top of the other. I found the
> codes below from R-help. I would like to know, in my case, whether I
> could use cROC, and also how can I got the right correlation (r)?
> I have been back to the original paper(Hanley 1983). It suggested to
> calculate rN(correlation coefficient for the discriminant value for +1
> labeled value) and rA(correlation coefficient for the discriminant
> value for -1 labeled value) and then calculate the average correlation
> and look up the Table they provided (row: average correlation, column:
> average AUC). However, in that Table the Average AUC need to be bigger
> than 0.70, which limits the search (always need to have average AUC
> larger than 0.70). Would you please suggested some way to calculate
> the correlation ?
>
>
> Thank you very much!
>
> Cheers,
>
> Xiao
>
>
>
>
> From: Bernardo Rangel Tura
>> Date: Thu 16 Dec 2004 - 07:30:37 EST
>>
>> seROC<-function(AUC,na,nn){
>> a<-AUC
>> q1<-a/(2-a)
>> q2<-(2*a^2)/(1+a)
>> se<-sqrt((a*(1-a)+(na-1)*(q1-a^2)+(nn-1)*(q2-a^2))/(nn*na))
>> se
>> }
>>
>> cROC<-function(AUC1,na1,nn1,AUC2,na2,nn2,r){
>> se1<-seROC(AUC1,na1,nn1)
>> se2<-seROC(AUC2,na2,nn2)
>>
>> sed<-sqrt(se1^2+se2^2-2*r*se1*se2)