1

我有两个使用 pROC 包绘制 ROC 曲线的问题。

A.显着性水平或 P 值是当 ROC 曲线下的真实(总体)面积为 0.5(零假设:面积 = 0.5)时,发现观察到的样本 ROC 曲线下面积的概率。如果 P 很小(P<0.05),则可以得出结论,ROC 曲线下面积与 0.5 显着不同,因此有证据表明实验室测试确实具有区分两组的能力。

因此,我想计算ROC曲线下的某个面积是否与0.50显着不同。我发现使用 pROC 包比较两条 ROC 曲线的代码如下,但不知道如何测试它是否为 0.5 显着。

library(pROC)  
data(aSAH)    

rocobj1 <- plot.roc(aSAH$outcome, aSAH$s100,  
                    main="Statistical comparison", 
                    percent=TRUE, col="#1c61b6")  

rocobj2 <- lines.roc(aSAH$outcome, aSAH$ndka, 
                     percent=TRUE, col="#008600")  

testobj <- roc.test(rocobj1, rocobj2)  
text(50, 50, 
     labels=paste("p-value =", format.pval(testobj$p.value)), 
     adj=c(0, .5))  

legend("bottomright", legend=c("S100B", "NDKA"), 
       col=c("#1c61b6", "#008600"), lwd=2)

B.我对我的分类问题进行了 k 折交叉验证。例如,5 折交叉验证将产生 5 条 ROC 曲线。那么如何使用 pROC 包绘制这 5 条 ROC 曲线的平均值(我想要做的是在这个网页上解释但在 Python 中完成:在此处输入链接描述)?另一件事是我们能否获得这条平均 ROC 曲线的置信区间和最佳阈值(类似于下面实现的代码)?

    rocobj <- plot.roc(aSAH$outcome, aSAH$s100b,  
                       main="Confidence intervals", 
                       percent=TRUE,  ci=TRUE, # compute AUC (of AUC by default)  
                       print.auc=TRUE) # print the AUC (will contain the CI)  

    ciobj <- ci.se(rocobj, # CI of sensitivity  
                   specificities=seq(0, 100, 5)) # over a select set of specificities  
    plot(ciobj, type="shape", col="#1c61b6AA") # plot as a blue shape  
    plot(ci(rocobj, of="thresholds", thresholds="best")) # add one threshold

参考:

http://web.expasy.org/pROC/screenshots.html

http://scikit-learn.org/0.13/auto_examples/plot_roc_crossval.html

http://www.talkstats.com/showthread.php/14487-ROC-significance

http://www.medcalc.org/manual/roc-curves.php

4

1 回答 1

2

A. 使用 awilcox.test正是这样做的。

B. 请参阅我对这个问题的回答:特征选择 + 交叉验证,但是如何在 R 中制作 ROC 曲线,并简单地将交叉验证的每一折中的数据连接起来(但不要使用 bootstrap、LOO、当您多次重复整个交叉验证,或者无法在运行之间比较预测时)。

于 2014-01-13T10:58:46.443 回答