I want to save and use later the bootstrapped regression coefficients of a regression model using the library 'boot' in R. In the example below, I want to be able to see and use the 1,000 bootstrapped coefficients for 'wt'. Is there a way to do so?
library(boot)
set.seed(6967) # Make the results reproducible
bs <- function(formula, data, indices) {
d <- data[indices, ]
fit <- lm(formula, data=d)
return(coef(fit))
}
results <- boot(data=mtcars, statistic=bs, R=1000, formula=mpg~wt+disp)
results
ORDINARY NONPARAMETRIC BOOTSTRAP
Call:
boot(data = mtcars, statistic = bs, R = 1000, formula = mpg ~
wt + disp)
Bootstrap Statistics :
original bias std. error
t1* 34.96055404 -0.0095950965 2.596330855
t2* -3.35082533 -0.0139963846 1.141259963
t3* -0.01772474 -0.0002011716 0.008307083