# R boot package bootstrap

I have a vector of numbers that I've uploaded here (alrig.com/code/MyData.Rdata) using dput.

I would like to get the bca ci so I've written this code:

my.mean <- function(dat, idx){
return (mean(dat[idx], na.rm = TRUE))
}

boot.out<-boot(data=my.data, statistic = my.mean, R=1000)


But when I run the following I get this:

> boot.ci(boot.out)
Error in bca.ci(boot.out, conf, index[1L], L = L, t = t.o, t0 = t0.o,  :
In boot.ci(boot.out) : bootstrap variances needed for studentized intervals


Can someone help me figure out what is causing this error? Thank you for your help!

-
I have tried with R=10000 instead of R=1000 (and specifying type='bca' instead of type='all' since this is what you really want) and it works. So my conclusion would be that what is causing this error is not enough bootstrap replications... but I cannot say more... – ocram Sep 24 '12 at 18:56

As you can see from your error message, boot.ci calls bca.ci. Because the boot.out object doesn't supply L, the empirical influence values for the statistic you're calculating on the data, bca.ci tries to calculate them using the empinf function, and then (as Michael says) it uses them to calculate the acceleration constant:
L <- empinf(boot.out, index = index, t = t.o, ...)

But with a small number of replications, empinf sometimes fails and returns a vector of NA values. The result is that you have no values for L, a can't be calculated, and you get your error. As ocram says, increasing the number of boostrap replications will fix this. Even doubling R to 2000 should probably do it.