ROC/AUC methods.
fast.auc
calculates the AUC using a sort operation, instead of summing over pairwise differences in R.
computeRoc
computes an ROC curve.
plotRoc
plots an ROC curve.
addRoc
adds an ROC curve to a plot.
classification.error
computes classification error
1 2 3 4 5 
score 
a vector. Linear combination or score. 
outcome 
a vector of 0 and 1. Outcome. 
t0 
a number between 0 and 1 that is the lower boundary of pAUC 
t1 
a number between 0 and 1 that is the upper boundary of pAUC 
reverse.sign.if.nece 
a boolean. If TRUE, score is multiplied by 1 if AUC is less than 0.5. 
x 
a list of two elements: sensitivity and specificity. 
diag.line 
boolean. If TRUE, a diagonal line is plotted 
add 
boolean. If TRUE, add to existing plot. If FALSE, create a new plot. 
type 
line type for 
... 
arguments passed to 
These functions originally come from Thomas Lumley and Tianxi Cai et al.
computeRoc
returns a list of sensitivity and specificity.
plotRoc
and addRoc
plots ROC curves.
Shuxin Yin
Youyi Fong youyifong@gmail.com
Krisztian Sebestyen
1 2 3 4 5 6 7 8 9 10 11 12  n=1e2
score=c(rnorm(n/2,1), rnorm(n/2,0))
outcome=rep(1:0, each=n/2)
plotRoc(computeRoc(score, outcome))
# test, fast.auc2 is a version without all the checking
score=rnorm(1e5)
outcome=rbinom(1e5,1,.5)
system.time(for (i in 1:1e2) fast.auc(score,outcome)) # 4.9 sec
#system.time(for (i in 1:1e2) fast.auc2(score,outcome)) # 3.8 sec

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.