Created
April 27, 2021 14:39
-
-
Save brshallo/1349cc19e616e5d1df03cc7efe77e67a to your computer and use it in GitHub Desktop.
Initial approach to bootstrapping a mean value, but is much slower than just using base::sample() so used that...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidymodels) | |
### MUCH faster computationally to use base R `sample()` for this step... so did not use this approach | |
resamples <- rsample::bootstraps(preds, 5000) | |
avg_diff_sample <- function(split){ | |
analysis(split) %>% | |
summarise(diff = mean(diff_abs_resids)) %>% | |
pull(diff) | |
} | |
resamples <- resamples %>% | |
transmute(diff = map_dbl(splits, avg_diff_sample)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment