R:来自 pROC 包的 AUC

R: AUC from pROC package

我最近遇到 pROC 包来获取 AUC。在帮助部分,他们给出了以下示例:

library("pROC")
data(aSAH)
auc(aSAH$outcome, aSAH$s100b)

在上面,outcomefactors100bnumerical

我的问题是 AUC 在这种情况下如何工作?它适用于什么阈值 s100b?还是无所谓?

编辑 1 上面的代码导致 AUC = 0.73。我怎么知道选择了哪个阈值来获得这个值?

auc function of pROC is the Area Under the ROC curve. Behind the scenes the function calls the roc函数中的AUC在前,所以你所做的相当于:

myroc <- roc(aSAH$outcome, aSAH$s100b)
auc(myroc)

ROC曲线是通过计算所有可能的阈值的灵敏度和特异性得到的。可以用plot函数可视化曲线,AUC显示为灰色:

plot(myroc, auc.polygon=TRUE)