我正在为一组物种生成生态位模型,并希望使用AUC作为生态位质量的度量指标。Steven Phillips是Maxent的开发者,在他的Maxent手册中提供了在R中计算AUC的代码。然而,我正在阅读报告部分AUC比率作为更强大和概念上合理的度量指标的论文。我认为我知道如何使用ROCR R包计算部分AUC,但是如何计算AUC比率呢?
以下是Phillips的教程脚本:
任何建议或意见都将不胜感激!谢谢。
以下是Phillips的教程脚本:
presence<-read.csv("bradypus_variegatus_samplePredictions.csv")
background<-read.csv("bradypus_variegatus_backgroundPredictions.csv")
pp<-presence$Logistic.prediction
testpp<-pp[presence$Test.or.train=="test"]
trainpp<-pp[presence$Test.or.train=="train"]
bb<-background$logistic
combined<-c(testpp,bb)
label<-c(rep(1,length(testpp)),rep(0,length(bb)))
pred<-prediction(combined,label)
perf<-performance(pred,"tpr","fpr")
plot(perf,colorize=TRUE)
performance(pred,"auc")@y.values[[1]] #RETURNS AUC
AUC<-function(p,ind){
pres<-p[ind]
combined<-c(pres,bb)
label<-c(rep(1,length(pres)),rep(0,length(bb)))
predic<-prediction(combined,label)
return(performance(predic,'auc')@y.values[[1]])
}
b1<-boot(testpp,AUC,100) #RETURNS AUC WITH STANDARD ERROR
b1
任何建议或意见都将不胜感激!谢谢。