auROC(truth, stat=NULL)NULL, then truth is assumed to be already sorted in decreasing test statistic order.Here we consider a test statistic stat, with larger values being more significant, and a vector truth indicating whether the alternative hypothesis is in fact true.
truth==TRUE or truth==1 indicates a true discovery and truth=FALSE or truth=0 indicates a false discovery.
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.
If stat contains ties, then auROC returns the average area under the ROC for all possible orderings of truth for tied stat values.
The area under the curve is undefined if truth is all TRUE or all FALSE or if truth or stat contain missing values.
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