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]> 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]> wrote:
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] ] On Behalf Of Michael
> > > Sent: Thursday, April 20, 2006 3:50 AM
> > > To: 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 mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide!
> > > http://www.R-project.org/posting-guide.html
> > >
> > >
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Notice:  This e-mail message, together with any attachments, contains
> > information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
> > Jersey, USA 08889), and/or its affiliates (which may be known outside the
> > United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as
> > Banyu) that may be confidential, proprietary copyrighted and/or legally
> > privileged. It is intended solely for the use of the individual or entity
> > named on this message.  If you are not the intended recipient, and have
> > received this message in error, please notify us immediately by reply e-mail
> > and then delete it from your system.
> >
> > ------------------------------------------------------------------------------
> >
>
>

        [[alternative HTML version deleted]]

______________________________________________
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

Reply via email to