title: Calculating AUC ratio in R
body: <p>I am generating ecological niche models for a set of species and I would like to use AUC as a metric for ecological niche quality. Steven Phillips, who developed Maxent, provides code in his Maxent manual for calculating the AUC in R. However, I am reading papers that report partial AUC ratios as a more robust and conceptually sound metric. I think I understand how to calculate partial AUC using the ROCR R package, but how does one calculate AUC ratio?</p>
  
  <p>Here is the tutorial script from Phillips:</p>
  
  <pre><code>presence&lt;-read.csv("bradypus_variegatus_samplePredictions.csv")
  background&lt;-read.csv("bradypus_variegatus_backgroundPredictions.csv")
  pp&lt;-presence$Logistic.prediction
  testpp&lt;-pp[presence$Test.or.train=="test"]
  trainpp&lt;-pp[presence$Test.or.train=="train"]
  bb&lt;-background$logistic
  
  combined&lt;-c(testpp,bb)
  label&lt;-c(rep(1,length(testpp)),rep(0,length(bb)))
  pred&lt;-prediction(combined,label)
  perf&lt;-performance(pred,"tpr","fpr")
  plot(perf,colorize=TRUE)
  performance(pred,"auc")@y.values[[1]] #RETURNS AUC
  
  AUC&lt;-function(p,ind){
      pres&lt;-p[ind]
      combined&lt;-c(pres,bb)
      label&lt;-c(rep(1,length(pres)),rep(0,length(bb)))
      predic&lt;-prediction(combined,label)
      return(performance(predic,'auc')@y.values[[1]])
  }
  
  b1&lt;-boot(testpp,AUC,100) #RETURNS AUC WITH STANDARD ERROR
  b1
  </code></pre>
  
  <p>Any advice or suggestions would be greatly appreciated! Thank you.</p>