Description Usage Arguments Value Methods (by class) References See Also Examples
A balanced bootstrap generates R
replicates in which each element
appears R
times.
1 2 3 4 5 6 7 | balanced_bootstrap(data, ...)
## S3 method for class 'data.frame'
balanced_bootstrap(data, R = 1L, ...)
## S3 method for class 'grouped_df'
balanced_bootstrap(data, R = 1L, stratify = FALSE, ...)
|
data |
A data frame |
... |
Arguments passed to methods |
R |
Number of replicates |
stratify |
If |
A data frame with R
rows and the following columns:
A list of resample
objects. Training sets.
A list of resample
objects. Test sets.
An integer vector of identifiers
data.frame
: Balanced bootstrap of rows in a data frame.
grouped_df
: Balanced bootstrap either by group, or
within groups (if stratify = TRUE
).
Gleason, John 1988. "Algorithms for Balanced Bootstrap Simulations." The American Statistician doi:10.2307/2685134.
Davison, A.C., Hinkley, D. V., and Schechtman, E. 1986. "Efficient Bootstrap Simulation." Biometrika.
Angelo Canty and Brian Ripley (2016). boot: Bootstrap R (S-Plus) Functions. R package version 1.3-18.
The boot function boot
which is the
canonical R bootstrap implementation.
1 2 3 4 5 6 7 8 9 10 | # example from modelr::bootstrap
library("purrr")
library("dplyr")
boot <- balanced_bootstrap(mtcars, 100)
models <- map(boot$sample, ~ lm(mpg ~ wt, data = .))
tidied <- map_df(models, broom::tidy, .id = "id")
hist(subset(tidied, term == "wt")$estimate)
hist(subset(tidied, term == "(Intercept)")$estimate)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.