[R] bootstrapping data.frame and matrix
Roger D. Peng
rpeng at stat.ucla.edu
Fri May 30 19:10:10 CEST 2003
The help page for `bootstrap' says that to bootstrap more complex
statistics (it gives an example for the correlation), you need to
bootstrap the (row) indices of the data frame and not the data frame
itself. By the way, you appear to have the order of the arguments to
bootstrap() incorrect but I guess this is a typo?
In general, I would suggest using the `boot' package from CRAN (along
with the Davison & Hinckley book) instead of the `bootstrap' package.
`boot' can work neatly on more general data structures and also uses the
trick of bootstrapping the indices of the data rather than the data
Also, it appears you are using an old version of R because the the "_"
operator is deprecated in the current version (1.7.0).
> Dear All,
> When bootstrapping a statistics based on more than one vector, from a
> data.frame or a matrix object, it looks like I am not able to pass the
> data to R. What am I doing wrong?
> I use the library "bootstrap".
> Here is an example with a data.frame called "data"
> "boot2_bootstrap(data, theta, nboot)
> I get the following error message:
> Error in inherits(x, "data.frame") : Argument "xdata" is missing, with
> no default"
> Please note that the same is happening when I create a matrix from the
> data.frame with the function cbind
>  "shortrate" "y1" "y5" "y10" "y15"
>  "y25"
> Thanks in advance,
> R-help at stat.math.ethz.ch mailing list
More information about the R-help