Skip to content

bootstrapping data.frame and matrix

4 messages · cp133, Roger D. Peng, chiara peroni +1 more

#
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)
TRUE)

Thanks in advance,

Chiara
#
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 
themselves.

Also, it appears you are using an old version of R because the the "_" 
operator is deprecated in the current version (1.7.0).

-roger
cp133 wrote:
#
Hi,

I use an old version of R (5.02). The reason I do not use the package
boot on the last version of R, is the clash of the package itself with
expressions contained in other packages, i.e. the"sm " library. I don't
know if you have the same problem.

Thank you!

Chiara
"Roger D. Peng" wrote:
#
On Fri, 30 May 2003, chiara peroni wrote:

            
Hi Chiara,

I am the maintainer of both, and they have never clashed to my knowledge.
Please let me know (off the list) what problems you are finding.

Brian