R中AUC的块引导程序

时间:2019-06-03 11:43:39

标签: r

我要根据AUC统计量的块自举抽样分布的百分位数来计算AUC以及90%,95%和99%置信区间的边界。作为块引导程序,我想使用Politis和Romano(1994)开发的“固定引导程序”。

我有一个时间序列,其概率在0到1之间,另一个时间序列的值是0或1。

我尝试在R中执行此操作,这是我到目前为止所做的:

library(pROC)
library(boot)
# set the number of replications for the block bootstrap:
reps <- 1000
# set the block length:
block_length <- 96
# write the AUC function for the block boostrap command:
block.boot.function <- function(x){
  auc(roc(data_ROC$Date,x))
}

# block bootstrap for AUC:
auc_block_boot <- tsboot(tseries = data_ROC$y , statistic = block.boot.function, R = reps, l = block_length, sim = "geom")

> auc_block_boot

STATIONARY BOOTSTRAP FOR TIME SERIES

Average Block Length of 96 

Call:
tsboot(tseries = data_ROC$y, statistic = block.boot.function, 
    R = reps, l = block_length, sim = "geom")


Bootstrap Statistics :
     original     bias    std. error
t1* 0.9694139 -0.3090732   0.1147533

# Confidence intervals based on the percentiles: 
auc_block_boot_CI <- boot.ci(auc_block_boot, conf = c(0.9, 0.95, 0.99), type = c("perc"))
> auc_block_boot_CI
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL : 
boot.ci(boot.out = auc_block_boot, conf = c(0.9, 0.95, 0.99), 
    type = c("perc"))

Intervals : 
Level     Percentile     
90%   ( 0.4945,  0.8667 )   
95%   ( 0.4723,  0.9018 )   
99%   ( 0.4421,  0.9506 ) 
Calculations and Intervals on Original Scale
Some percentile intervals may be unstable

我不确定代码是否复制了我一开始所描述的内容。 -0.3090732的相对较大的偏见让我怀疑结果还可以。原始AUC值0.9694139也在置信区间之外。这是表明COde错误的错误,还是百分位数可能出现?

任何帮助我都会很高兴!

0 个答案:

没有答案