Skip to content
Prev 33276 / 398506 Next

bootstrap question

You are using the boot function incorrectly.  This is taken from the 
help page:


statistic: A function which when applied to data returns a vector
           containing the statistic(s) of interest.  When
           `sim="parametric"', the first argument to `statistic' must be
           the data.  For each replicate a simulated dataset returned by
           `ran.gen' will be passed.  In all other cases `statistic'
           must take at least two arguments.  The first argument passed
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           will always be the original data. The second will be a vector
           of indices, frequencies or weights which define the bootstrap
           sample.

The default is nonparametric bootstrap (sim = "ordinary"), so you need 
to specify a function with TWO arguments.  Try

x <- rnorm(100)
boot(x, function(x, i) mean(x[i]), R = 1000)$t

-roger
Erin Hodgess wrote: