Skip to main content
2 of 3
edited tags
Ferdi
  • 5.3k
  • 10
  • 47
  • 64

Explanation of confidence interval from R function boot.ci

I used boot function in R to do bootstrap for 40 times and used boot.ci to get the "normal" confidence interval. The following is my R code:
1. Define the statistic used in boot function `` uni_boot <-function(data,indices,vari){ d = data[indices,] unifit = coxph(as.formula(paste('Surv(time, status)~', vari)) ,data = d)

return hazard ratio

summary(unifit)$coef[2] } **2.Bootstrap** r1 <- boot(data = data, statistic = uni_boot, R = 40, vari = variable) r2 <- boot.ci(boot.out = r1, type = "norm") **Then**, I examine the following things<br> **Result of r1 object:**<br> original bias std. error t1* 1.053145 0.03274176 0.1714448 **Result of r2 object**<br> Intervals : Level Normal 95% ( 0.684, 1.356 ) Calculations and Intervals on Original Scale The bootstrap sample mean would bemean(r1$t)would be 1.085887 which is original plus the bias. However, when I examine the the formula used to calculate the bootstrap interval. It is original-bias-V^1/2Z(1-alpha)ororiginal-bias-V^1/2Z(alpha).<br> I followed the formula and did the calculation:<br> 1.053145-0.03274176+1.960.1714448 got me the upper bound 1.356
1.053145-0.03274176-1.96
0.1714448 got me the lower bound 0.684
My understanding of the confidence interval would be the bootstrap mean in the middle of the boot CI. However, the boot CI midpoint here turns to be 1.024. Sometimes, the boot CI from boot.ci wouldn't cover the bootstrap meanmean(r1$t)``.
Anything I understand wrongly?

purod
  • 305
  • 5
  • 16