[R] calculate AUC for ROC curve

Frank E Harrell Jr f.harrell at vanderbilt.edu
Tue Sep 19 17:46:00 CEST 2006


Guoyan Zhao wrote:
> Dear everyone,
> 
> I have only tpr (true positive rate) and fpr (false positive rate) which 
> were used to plot the ROC curve. Is there any way I can calculate the AUC 
> for this curve using just this information? Any help is highly 
> appreciated. 
> 
> Isabel

To get the AUC you need N pairs of (predicted probability or log odds, 
binary outcome).  AUC is quickly computed with the Hmisc somers2 
function and you can get a std. error for it from the Hmisc rcorr.cens 
function.  You can also compute AUC from the way you stated it but that 
is a roundabout way.

Frank

-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list