Generate n
bootstrap replicates.
bootstrap(data, n, id = ".id")
data | A data frame |
---|---|
n | Number of bootstrap replicates to generate |
id | Name of variable that gives each model a unique integer id. |
A data frame with n
rows and one column: strap
Other resampling techniques:
resample_bootstrap()
,
resample_partition()
,
resample()
library(purrr) boot <- bootstrap(mtcars, 100) models <- map(boot$strap, ~ lm(mpg ~ wt, data = .)) tidied <- map_df(models, broom::tidy, .id = "id") hist(subset(tidied, term == "wt")$estimate)