[R] boot.ci error with large data sets

Peter Ehlers ehlers at ucalgary.ca
Wed Feb 16 17:37:08 CET 2011


On 2011-02-16 04:44, Lars Dalby wrote:
> Dear List
>
> I have run into some problems with boot.ci from package boot. When I
> try to obtain a confidence interval of type bca, boot.ci() returns the
> following error when the data set i large:
> Error in bca.ci(boot.out, conf, index[1L], L = L, t = t.o, t0 =
> t0.o,  :
>    estimated adjustment 'a' is NA
>
> Below is an example that produces the above mentioned error on my
> machine.
>
> library(boot)
> #The wrapper function:
> w.mean<- function(x, d) {
> 	E<- x[d,]
> 	return(weighted.mean(E$A, E$B))}
> #Some fake data:
> test<- data.frame(rnorm(1000, 5), rnorm(1000, 3))
> test1<- data.frame(rnorm(10000, 5), rnorm(10000, 3))
> names(test)<- c("A", "B")
> names(test1)<- c("A", "B")
> # Getting the boot object and the CI, seem to works fine
> bootout<- boot(test, w.mean, R=1000, stype="i")
> (bootci<- boot.ci(bootout, conf = 0.95, type = "bca"))
> # Now with a bigger data set, boot.ci returns an error.
> bootout1<- boot(test1, w.mean, R=1000, stype="i")
> (bootci1<- boot.ci(bootout1, conf = 0.95, type = "bca"))
>
> Does anyone have an idea as to why this happens? (Session info below)

Well, someone wiser than I with regard to boot()
will be able to give a more definitive answer.

In the meantime, note that you get the same 'problem'
with your smaller dataset if you set the number of
bootstrap replicates to less than the row dimension
of your data.frame:

  bootout <- boot(test, w.mean, R=999, stype="i")
  (bootci <- boot.ci(bootout, type = "bca"))

So one way to handle your larger dataset is to
use R = 10000. Of course, you'll have to be
patient - the result may take a while.

Peter Ehlers

>
> Best,
> Lars
>
>> sessionInfo()
> R version 2.12.1 (2010-12-16)
> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>
> locale:
> [1] da_DK.UTF-8/da_DK.UTF-8/C/C/da_DK.UTF-8/da_DK.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods
> base
>
> other attached packages:
> [1] boot_1.2-43
>
> loaded via a namespace (and not attached):
> [1] tools_2.12.1
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list