Closed floswald closed 4 years ago
library(dplyr)
new_cars = sample_n(cars, size = nrow(cars), replace = TRUE)
b1 = coef(lm(speed ~ dist, new_cars))[2]
library(bootstrap)
fc = function(d,i){
d2 = d[i, ]
return(coef(lm(speed ~ dist,data = d2))[2])
}
bootcars <- boot(cars, fc, R=500)
plot(bootcars)