On Dec 9, 2009, at 9:05 AM, Trafim Vanishek wrote:

I missed number of bootstrap replicates R

boot(Reg, bootcoeff, R=10)
but still it doesn't work
Error in statistic(data, original, ...) : unused argument(s) (original)


On Wed, Dec 9, 2009 at 2:46 PM, Trafim Vanishek <rdapam...@gmail.com> wrote:

Dear all,

I have some error trying to bootstrap from a matrix. The error message is
"Error in sample(n, n * R, replace = TRUE) : element 2 is empty;
  the part of the args list of '*' being evaluated was: (n, R)"

vv <- c(0.5,3.2,5.4,1.1,1.4,1.2,2.3,2.0)
Reg <- matrix(data=vv, nrow = 4, ncol = 2)

bootcoeff <- function(x){
coefficients(lm(x[,1]~x[,2]))[2]+1
}

boot(Reg, bootcoeff)

?boot

And in particular you need to read the Arguments material more closely. The boot function is more complicated that you expected. Then work through the examples. You may also get help by doing some searching in www.rseek.org or with the RSiteSearch function, e.g.:

RsiteSearch("lm coef boot")


It is just an example, in reality I have a matrix in rows of which I have x
and y for which I need to make a regression to find the slope coeff
bootstrapping from rows.

Thanks a lot for the help.



David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to