Re: [R] boot.ci error with large data sets

2011-02-16 Thread Matthew Dowle

Hello Lars, (cc'd)

Did you ask maintainer(boot) first, as requested by the posting guide?

If you did, but didn't hear back, then please say so, so that we know
you did follow the guide. That maintainer is particularly active, and
particularly efficient though, so I doubt you didn't hear back.

We can tell it's your first post to r-help, and we can tell you have at
least read the posting guide and done very well in following almost all
of it. I can't see anything else wrong with your post (and the subject
line is good) ... other than where you sent it :-)

Matthew


Lars Dalby lars.da...@gmail.com wrote in message 
news:fef4d63e-90f6-43aa-90a6-872792faa...@s11g2000yqc.googlegroups.com...
 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(1, 5), rnorm(1, 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)

 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@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.


Re: [R] boot.ci error with large data sets

2011-02-16 Thread Peter Ehlers

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(1, 5), rnorm(1, 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 = 1. 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@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.


__
R-help@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.