如何测试两条ROC曲线的AUC是否不同?

问题描述

我必须使用置换检验来测试(两个分类器的)两个ROC曲线的AUC是否不同(我不能使用roc.test函数,这是大学的练习)

经过一些研究,我尝试使用曼·惠特尼(Mann Whitney)测试,但是我确定这不是一个好的解决方案,而且我也不知道如何找到这个好的解决方案。在大学里,我们看到了相同的算法,将两个均值与t.test进行比较,但没有看到2 AUC进行比较的情况。我应该使用什么测试?我应该以不同的方式来做算法吗?

这是我的代码

pred1 = prediction(prob1,y) #  pred1 is my first classifier
perf1.auc = performance(pred1,measure = "auc")
auc1<-perf1.auc@y.values[[1]] # first AUC (= 0.919357)

pred2 = prediction(prob2,y) # pred2 is my second classifier
perf2.auc = performance(pred2,measure = "auc")
auc2<-perf2.auc@y.values[[1]] # second AUC (= 0.9412217)

t0 = wilcox.test(auc1,auc2,paired=FALSE)$statistic # Tried a Mann Whitney test,not the good solution

z = c(prob1,prob2)
set.seed(27)
B = 1000 # Number of iterations
t.perm = numeric(B)

for(b in 1:B){
  z1 = sample(z,replace = F) # resampling
  prob11 = z1[1:length(prob1)]
  prob22 = z1[(length(prob1)+1):length(z1)]
  
  pred11 = prediction(prob11,y)
  perf11.auc = performance(pred11,measure = "auc")
  auc11<-perf11.auc@y.values[[1]]
  
  pred22 = prediction(prob22,y)
  perf22.auc = performance(pred22,measure = "auc")
  auc22<-perf22.auc@y.values[[1]]

  t.perm[b] =wilcox.test(auc11,auc22,not the good solution
}

t.perm = c(t.perm,t0)
pval = mean(abs(t.perm) >= abs(t0))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)