[R] problems performing bootstrap
Andrew Robinson
A.Robinson at ms.unimelb.edu.au
Sat Apr 22 07:41:14 CEST 2006
John,
boot requires that the function accept an index (or similar), which is
used to communicate the permutation of x to the function.
Try instead:
best <- function (x,i) {
xx <- pmax(x[i,1],x[i,2])
pvalue <- t.test(xx,mu=100)
pvalue$p.value
}
Cheers
Andrew
On Fri, Apr 21, 2006 at 10:03:12PM -0400, John Sorkin wrote:
> R2.1.1
> Windows XP
>
> I have defined a function:
>
> best<-function (x)
> {
> xx<-pmax(x[,1],x[,2])
> pvalue<-t.test(xx,mu=100)
> pvalue$p.value
> }
>
> and then I try to bootstrap best as follows:
>
> > boot( array(rnorm(30,100,1),c(15,2)),best,R=100 )
>
> and get the following message:
>
> Error in statistic(data, original, ...) : unused argument(s) ( ...)
>
> I would appreciate any help that you might offer.
> Thanks,
> John
>
> John Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> Baltimore VA Medical Center GRECC and
> University of Maryland School of Medicine Claude Pepper OAIC
>
> University of Maryland School of Medicine
> Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
>
> 410-605-7119
> jsorkin at grecc.umaryland.edu
>
> ______________________________________________
> 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
--
Andrew Robinson
Department of Mathematics and Statistics Tel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
Email: a.robinson at ms.unimelb.edu.au http://www.ms.unimelb.edu.au
More information about the R-help
mailing list