[R] Bootstrap Confidence Intervals

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Dec 30 21:09:38 CET 2007


You need to call boot() to create an object to pass to boot.ci().

There are lots of examples in the help pages and in the book that package 
'boot' supports. From the help:

Usage:

      boot.ci(boot.out, conf = 0.95, type = "all",
              index = 1:min(2,length(boot.out$t0)), var.t0 = NULL,
              var.t = NULL, t0 = NULL, t = NULL, L = NULL, h = function(t) t,
              hdot = function(t) rep(1,length(t)), hinv = function(t) t, ...)

Arguments:

boot.out: An object of class '"boot"' containing the output of a
           bootstrap calculation.

and try class(z) .


On Sun, 30 Dec 2007, _Fede_ wrote:

>
>
> Hi all.
>
> This is my first post in this forum. Finally I find a forum in the web about
> R, although is not in my language.
>
> Now I'm working with Bootstrap CI. I'd like to know how I can calculate a
> Bootstrap CI for any statistic, in particular, for Kurtosis Coeficient. I
> have done the following code lines:
>
>> library(boot)
>> x=rnorm(20)
>> kurtosis=function(x) (mean((x-mean(x))^4))/(sd(x)^4)
>> z <- numeric(10000)
>> for(i in 1:10000)
>> z[i]=kurtosis(sample(x, replace=TRUE))
>> boot.ci(z, conf = 0.95,type = c("norm","basic","perc","bca"))
>
> But the output shows the next error:
>
> Error en if (ncol(boot.out$t) < max(index)) { :
>        argumento tiene longitud cero
>
> I don't know what is wrong.
>
> I hope that somebody can help me. Sorry for my english.
>
> All have a nice new year.
>
> _Fede_
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list