Calculation and plotting of the empiric AUCs
EmpiricalROC<-function (group,Y){
YE=Y[ group==1]; YS=Y[ group==0]
t=seq(0,1,0.01); F=quantile(YS,probs=(1-t),type=1)
ROC=1-sapply(F, function(x) mean( YE <= x ))
ROC=as.vector(ROC)
t=c(0,t,1); ROC=c(0,ROC,1)
m<-length(YS);n<-length(YE)
xmat<-matrix(rep(YS,n),nrow=n,byrow=T)
ymat<-matrix(rep(YE,m),nrow=n,byrow=F)
diffmat<-ymat-xmat
auc<-(length(diffmat[diffmat>0])+
```

```
0.5*length(diffmat[diffmat==0]))/(m*n)
auc=round(auc,digits=3)
plot(t,ROC,type='s',col='red',xlab="1-esp",ylab="sen")
abline(a=0,b=1,col='grey')
lines(t,ROC,col='blue',type='s')
text(0.9,0.1,paste("auc=",auc))
```

```
result=list(t=t,ROC=ROC,auc=auc)}
```