[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).


cp133 wrote:
> 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
> (i.e.  
> names(data)
> [1] "shortrate" "y1"        "y5"        "y10"       "y15"      
> "y20"      
> [7] "y25"      
> xdata_cbind(data$y10,data$shortrate)
> is.matrix(x.data)
> Thanks in advance,
> Chiara
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help

More information about the R-help mailing list