Skip to content
Prev 142542 / 398498 Next

bootstrap for confidence intervals of the mean

On Tue, 2008-04-22 at 12:59 -0400, stephen sefick wrote:
You aren't reading the documentation closely enough. ?boot informs us
that for all sim other than "parametric", 'statistic' must be a function
that takes two arguments. The second argument to mean.default is trim,
and boot is passing to mean a vector of indices as argument 'trim' which
it is not expecting and quite rightly throws a wobbly.

Write a wrapper to mean, that accepts two arguments, one the data vector
and one the permuted indices, then use these to form a call to mean ---
here mean.fun does this (note we turn on removing NA's by default
otherwise it wouldn't work)
ORDINARY NONPARAMETRIC BOOTSTRAP


Call:
boot(data = d, statistic = mean.fun, R = 1000, sim = "ordinary")


Bootstrap Statistics :
    original    bias    std. error
t1* 9474.167 -3.373422    3110.968

There doesn't seem to be much point in permuting the data here, the mean
will be the same, regardless of what permutation you take. The above
does an ordinary bootstrap instead.

HTH

G