试图从两个变量的bootstrap获得相关的置信区间 . 当前代码来自文档 .

pearson <- function(d, i){
        d2 <- d[i,]
        return(cor(d2$LSAT,d2$GPA))
     }
bootcorr <- boot(data=d2,statistic=pearson,R=10000)
bootcorr  
boot.ci(bootcorr,conf=.95)

获得相关性没有问题,但是当获得置信区间时,我得到一个错误 . 我怀疑是因为我的bootBias和bootSE是0,但我不太清楚为什么 .

数据集是cd4数据集 .

Column1 Column 2 
212 247
435 461
339 526
251 302
404 636
510 593
377 393
335 409
410 488
335 381
415 474
356 329
339 555
188 282
256 423
296 323
249 256
303 431
266 437
300 240