Displaying 1 result from an estimated 1 matches for "bootcoeff".
Did you mean:
bootcoef
2009 Dec 09
1
Bootstrapping in R
...ror 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 ve...