问题是关于 pROC 包的 roc 函数。 包链接:https://www.rdocumentation.org/packages/pROC/versions/1.18.5/topics/roc。论文链接https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3068975/.
我正在 ROC 图上绘制置信区间:
pROC::roc(as.factor(df$classes),
df$score ,
plot=TRUE,
ci = TRUE,
ci.method= 'bootstrap',
auc.polygon=TRUE,
max.auc.polygon=TRUE,
print.auc=TRUE)
我从文档中了解到,当使用 ci.method 作为“引导”时,会发生分层引导。如何找到引导时使用的子采样百分比? 是总数据的80%、70%还是其他?可以指定吗?
论文引用,“Bootstrap 默认情况下是分层的;在这种情况下,在每个 Bootstrap 重复中将选择与原始样本相同数量的病例和对照观察值。”。我认为它们意味着每个重复中病例和对照观察的比例相同。然而,任何地方都没有提到进行二次采样的百分比。
如果我的理解有误请指正。
引导根据定义是通过替换对整个数据进行重新采样。
roc
函数最终会调用stratified.ci.auc
,如下所示:
pROC:::stratified.ci.auc
function (n, roc)
{
controls <- sample(roc$controls, replace = TRUE)
cases <- sample(roc$cases, replace = TRUE)
thresholds <- roc_utils_thresholds(c(cases, controls), roc$direction)
perfs <- roc$fun.sesp(thresholds = thresholds, controls = controls,
cases = cases, direction = roc$direction)
roc$sensitivities <- perfs$se
roc$specificities <- perfs$sp
auc.roc(roc, partial.auc = attr(roc$auc, "partial.auc"),
partial.auc.focus = attr(roc$auc, "partial.auc.focus"),
partial.auc.correct = attr(roc$auc, "partial.auc.correct"),
allow.invalid.partial.auc.correct = TRUE)
}
前两行告诉您,分层样本使用 100% 的案例和对照,因为没有给出
size
参数。