[R] Bootstrap error message: Error in statistic(data, origina l, ...) : unused argument(s) ( ...)

Liaw, Andy andy_liaw at merck.com
Thu Apr 20 17:20:17 CEST 2006


> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Michael
> Sent: Thursday, April 20, 2006 3:50 AM
> To: R-help at stat.math.ethz.ch
> Subject: [R] Bootstrap error message: Error in 
> statistic(data, original, ...) : unused argument(s) ( ...) [Broadcast]
> 
> 
> Dear colleagues,
> 
> I've been swamped and fighting with error for a few hours but 
> still desperately having absolutely no clue:

You really don't have to do that, but just RTFM instead.  ?boot says:

statistic   A function which when applied to data returns a vector 
            containing the statistic(s) of interest. [...]
            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, frequencies or weights which define the 
            bootstrap sample. [...]

Your "myFun" clearly does not fit that description.  boot() tried to call
"myFun" with a second argument, but "myFun" doesn't know what to do with a
second argument, and that's where you get the error.

Andy

 
> What's wrong with my bootstraping code?
> 
> Thanks a lot!
> 
> ------------------------
> Error Message:
> 
> > bootResults=boot(X, myFun, R=10000);
> Error in statistic(data, original, ...) : unused argument(s) ( ...)
> 
> ------------------------
> My code is:
> 
> X=cbind(column_vector_1, column_vector_2);
> myFun=function(X)
> {
>      return(mean(X[, 1])/var(X[, 2]));
> }
> 
> bootResults=boot(X, myFun, R=10000);
> 
> ---------------------
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://stat.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