[R] boot question
Achim Zeileis
Achim.Zeileis at wu-wien.ac.at
Fri Apr 2 00:34:24 CEST 2004
On Thu, 1 Apr 2004 17:19:55 -0500 Morris, Jeffrey [OCDUS] wrote:
> What in the world am I missing??
The help page?
As help(boot) tells you:
statistic: <snip>
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,
<snip>
So I would think you want to do:
R> mymean <- function(x, index) mean(x[index])
R> boot(x, mymean, R = 20)
ORDINARY NONPARAMETRIC BOOTSTRAP
Call:
boot(data = x, statistic = mymean, R = 20)
Bootstrap Statistics :
original bias std. error
t1* 0.1775 0.03224225 0.1302358
hth,
Z
> > x<-rnorm(20)
>
> > mean(x)
> [1] -0.2272851
>
> > results<-boot(x,mean,R=5)
>
> > results[2]
> $t
> [,1]
> [1,] -0.2294562
> [2,] -0.2294562
> [3,] -0.2294562
> [4,] -0.2294562
> [5,] -0.2294562
>
> Jeff Morris
> Ortho-Clinical Diagnostics
> A Johnson & Johnson Co.
> Rochester, NY
> Tel: (585) 453-5794
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list