Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

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,  : 
estimated adjustment 'a' is NA
In addition: Warning message:
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!

share|improve this question
2  
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

1 Answer

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, ...)
a <- sum(L^3)/(6 * sum(L^2)^1.5)

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.

share|improve this answer
+1 @Kieran Thanks! I am glad that my guess had some validity. You have the right answer from your knowledge of the R programs involved. so my answer is no longer needed. Someone either did not like me guessing or thought my answer should be a comment. For all those reasons it makes sense for me to delete it now. – Michael Chernick Sep 24 '12 at 21:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.