Re: [R] Fast AUC computation

From: Tuszynski, Jaroslaw W. <JAROSLAW.W.TUSZYNSKI_at_saic.com>
Date: Fri 30 Sep 2005 - 01:03:24 EST


See colAUC in caTools (there is a problem with 1.3 version, 1.4 is on the way). See "examples" for other functions calculating AUC. An alternative approach is:

	  x1 = x[y==1]; n1 = length(x1); 
	  x2 = x[y==0]; n2 = length(x2);
	  r = rank(c(x1,x2))  
        auc = (sum(r[1:n1]) - n1*(n1+1)/2) / (n1*n2) 

Which is very fast.

Jarek

====================================================\==== 
 Jarek Tuszynski, PhD.                           o / \ 
 Science Applications International Corporation  <\__,|  
 (703) 676-4192                                   ">  \ 
 Jaroslaw.W.Tuszynski@saic.com                     `   \ 



-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Nina Paynter Sent: Wednesday, September 28, 2005 4:43 PM To: r-help@stat.math.ethz.ch
Subject: [R] Fast AUC computation

I am doing a simulation with a relatively large data set (20,000 observations) for which I want to calculate the area under the Receiver Operator Curve (AUC) for many parameter combinations. I am using the ROC library and the following commands to generate each AUC:  

rocobj=rocdemo.sca(truth = ymis, data = model$fitted.values, rule = dxrule.sca) #generation of observed ROC object

aucobj=AUC(rocobj) #pulling out just the observed AUC - trapezoidal not integrated  

but they are pretty slow.  

Does anyone know of a faster way to get the AUC?  

Thanks,

Nina

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Sep 30 01:08:55 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:59:51 EST