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) > > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.