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.

Reply via email to