我有这个ROC情节:
library(Epi)
library(pROC)
data(aSAH)
data <- aSAH
plot.roc(data$outcome, data$s100b)
我想为Area under the curve: 0.7314
着色。
我试过......
x <- seq(1, 0, by = - .001)
polygon(x, roc(data$outcome, data$s100b),
col = rgb(.35,0.31,0.61, alpha = 0.4),
border = rgb(.35,0.31,0.61, 0.4),
lwd=2)
...并收到错误消息:Error in xy.coords(x, y) : 'x' and 'y' lengths differ
。
如何才能完成任务?
答案 0 :(得分:2)
来自plot.roc
的{{1}}功能已构建参数以启用(pROC
)和调整(auc.polygon
,auc.polygon.col
等,请参阅{{1 })AUC的显示。在您的情况下,您可以使用:
auc.polygon.border
答案 1 :(得分:1)
尝试
library(Epi)
library(pROC)
data(aSAH)
data <- aSAH
res <- plot.roc(data$outcome, data$s100b)
polygon(with(res, cbind(specificities, sensitivities)),
col = rgb(.35,0.31,0.61, alpha = 0.4),
border = rgb(.35,0.31,0.61, 0.4),
lwd=2)