auROC(truth, stat=NULL)
NULL
, then truth
is assumed to be already sorted in decreasing test statistic order.NULL
if truth
has zero length.
Here we consider a test statistic stat
, with larger values being more significant, and a vector truth
indicating whether the null hypothesis is in fact true.
Correct ranking here means that truth[i]
is greater than or equal to truth[j]
when stat[i]
is greater than stat[j]
.
The function computes the exact area under the empirical ROC curve defined by truth
when ordered by stat
.
auROC(c(1,1,0,0,0))
truth <- rbinom(30,size=1,prob=0.2)
stat <- rchisq(30,df=2)
auROC(truth,stat)
Run the code above in your browser using DataLab