I quoted the relevant part of the documentation for you. Have you actually try to read what it says? Sure, you don't get any error, but have you checked whether any bootstrapping was actually done? Most of those functions are generics, thus having the "..." argument that can take anything. Doesn't mean they will be used. See if the following helps: > x <- 1:10 > myMean <- function(x, idx) mean(x[idx]) > library(boot) > x.boot <- boot(x, mean, R=10) > str(x.boot) List of 11 $ t0 : num 5.5 $ t : num [1:10, 1] 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 $ R : num 10 $ data : int [1:10] 1 2 3 4 5 6 7 8 9 10 $ seed : int [1:626] 403 101 106329237 1120199471 -647917002 -657447328 355480739 291889089 -398656592 -2023350578 ... $ statistic:function (x, ...) $ sim : chr "ordinary" $ call : language boot(data = x, statistic = mean, R = 10) $ stype : chr "i" $ strata : num [1:10] 1 1 1 1 1 1 1 1 1 1 $ weights : num [1:10] 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 - attr(*, "class")= chr "boot" > x.boot2 <- boot(x, myMean, R=10) > str(x.boot2) List of 11 $ t0 : num 5.5 $ t : num [1:10, 1] 5.7 6.4 5.4 4.9 7.2 4.6 4.4 5.4 5.7 5.9 $ R : num 10 $ data : int [1:10] 1 2 3 4 5 6 7 8 9 10 $ seed : int [1:626] 403 201 106329237 1120199471 -647917002 -657447328 355480739 291889089 -398656592 -2023350578 ... $ statistic:function (x, idx) ..- attr(*, "source")= chr "function(x, idx) mean(x[idx])" $ sim : chr "ordinary" $ call : language boot(data = x, statistic = myMean, R = 10) $ stype : chr "i" $ strata : num [1:10] 1 1 1 1 1 1 1 1 1 1 $ weights : num [1:10] 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 - attr(*, "class")= chr "boot" Andy
-----Original Message----- From: Michael [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 12:19 PM To: Liaw, Andy Cc: R-help@stat.math.ethz.ch Subject: Re: [R] Bootstrap error message: Error in statistic(data, origina l, ...) : unused argument(s) ( ...) [Broadcast] btw, if you change "myFun" to any R internal function, such as "cov", or "corr", it can run successfully... On 4/20/06, Michael <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Andy, I've noticed there should be a "weight" or "frequency" somewhere... but my function does not need it. I have tried to cheat it by declareing a weight, but not using it: > myFun=function(X, w) > { > return(mean(X[, 1])/var(X[, 2])); > } > > bootResults=boot(X, myFun, R=10000, stype='w'); The result is zero: Bootstrap Statistics : original bias std. error t1* 2.305412 0 0 On 4/20/06, Liaw, Andy < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: > -----Original Message----- > From: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > [mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] On Behalf Of Michael > Sent: Thursday, April 20, 2006 3:50 AM > To: R-help@stat.math.ethz.ch <mailto:R-help@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@stat.math.ethz.ch <mailto:R-help@stat.math.ethz.ch> mailing list > https://stat.ethz.ch/mailman/listinfo/r-help <https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html <http://www.R-project.org/posting-guide.html> > > ---------------------------------------------------------------------------- -- Notice: This e-mail message, together with any attachments,...{{dropped}} ______________________________________________ R-help@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