[R] Bootstrap inference for the sample median?

Ajay Shah ajayshah at mayin.org
Sun Aug 30 15:13:09 CEST 2009


I have this code fragment:

  x <- c(0.79211363702017, 0.940536712079832, 0.859757602692931, 0.82529998629531, 
         0.973451006822, 0.92378802164835, 0.996679563355802,
         0.943347739494445, 0.992873542980045, 0.870624707845108, 0.935917364493788)
  # from 0.79 to 0.996

  e <- function(x,d) {

  b <- boot(x, e, R=1000)

The 95% confidence interval, as seen with `Normal' and `Basic'
calculations, has an upper bound of 1.0028 and 1.0121.

How is this possible? If I sample with replacement from values which
are all lower than 1, then any sample median of these bootstrap
samples should be lower than 1. The upper cutoff of the 95% confidence
interval should also be below 1.

Is this a bug in the boot package? Or should I be using `Percentile'
or `BCa' in this situation?

Ajay Shah                                      http://www.mayin.org/ajayshah  
ajayshah at mayin.org                             http://ajayshahblog.blogspot.com
<*(:-? - wizard who doesn't know the answer.

More information about the R-help mailing list