[R] sample size in bootstrap(boot)

Tim Hesterberg TimHesterberg at gmail.com
Mon Jun 9 00:42:42 CEST 2008


bootstrap() and samp.bootstrap() are part of the S+Resample package,
see http://www.insightful.com/downloads/libraries

You could modify boot() to allow sampling with size other than n.

Use caution when bootstrapping with a sample size other than n.
The usual reason for bootstrapping is inference (standard errors,
confidence intervals) using the actual data, including the actual
sample size, not some other data that you don't have.

However, there are reasons to sample with other sample sizes, e.g.:
* Planning for future work, e.g. planning for a clinical trial with
  large n based on current sample data with small n.  You may want to
  try different n, to see how that would affect standard errors or
  normality of sampling distributions.
* Better accuracy.  Bootstrap standard errors are biased downward,
  corresponding to computing the usual sample standard deviation using
  a divisor of n instead of (n-1).  Bootstrap distributions tend to
  be too narrow.  One remedy is to sample with size (n-1).  For others
  see:
Hesterberg, Tim C. (2004), Unbiasing the Bootstrap-Bootknife Sampling
vs. Smoothing, Proceedings of the Section on Statistics and the
Environment, American Statistical Association, 2924-2930.
http://home.comcast.net/~timhesterberg/articles/JSM04-bootknife.pdf

Tim Hesterberg
(formerly of Insightful, now Google, and only now catching up on R-help)

>   Hi Dan,
>
>   Thanks  for response yes i do know that bootstrap samples generated by
>   function boot are of the same size as original dataset but somewhere in the
>   R-help threads i saw a suggestion that one can control sample size (n) by
>   using the following command(plz see below) but my problem is it doesnt work
>   it gives error ( error in : n * nboot : non-numeric argument to binary
>   operator)
>
>   bootstrap(data,statistic,sampler=samp.bootstrap(size=20))
>
>    this is what somebody on R help suggested... can we fix that error somehow
>   ?
>
>   On Wed, 26 Mar 2008 08:26:22 -0700 "Nordlund, Dan (DSHS/RDA)" wrote:
>   > > -----Original Message-----
>   > > From: r-help-bounces at r-project.org
>   > > [mailto:r-help-bounces at r-project.org] On Behalf Of Zaihra T
>   > > Sent: Wednesday, March 26, 2008 7:57 AM
>   > > To: Jan T. Kim; R-help at r-project.org
>   > > Subject: ! [R] sample size in bootstrap(boot)
>   > >
>   > >
>   > > Hi,
>   > >
>   > > Can someone tell me how to control sample size (n) in
>   > > bootstrap function
>   > > boot in R. Can we give some option like we give for #
>   > > of repeated
>   > > samples(R=say 100).
>   > >
>   > > Will appreciate any help.
>   > >
>   > > thanks
>   >
>   > I don't believe so. Isn't one of the differences between the bootstrap and
>   other kinds of
>   > resampling that the bootstrap samples with replacement a sample of the
>   same size as the
>   > original data? You could use the function sample() to select your subsets
>   and compute your
>   > statistics of interest.
>   >
>   > Hope this is helpful,
>   >
>   > Dan
>   >
>   > Daniel J. Nordlund
>   > Research and Data Analysis
>   > Washington State Department of Social and! Health Services
>   > Olympia, WA 98504-5204



More information about the R-help mailing list