Description Usage Arguments Value Examples
Takes a data frame, a function that returns a single number, and a number of replicates and returns a data frame with the function calculated on the observed sample and on B bootstrap samples.
1 |
df |
A data frame |
expr |
A bare function that operates on one or more variables from the data frame. |
B |
the number of bootstrap samples to draw |
out A data frame with the values, whether they come from the observed data or the bootstrapped data.
1 2 3 4 5 6 7 8 9 10 11 | # Boostrap the mean of the mpg variable in the mtcars data set
slipper(mtcars,mean(mpg),B=100)
# Bootstrap the mean of the mpg variable with piping
mtcars %>% slipper(mean(mpg),B=100)
# Calculate a confidence interval using the quantiles method
mtcars %>% slipper(mean(mpg),B=100) %>%
dplyr::filter(type == "bootstrap") %>%
summarize(ci_low = quantile(value,0.025),
ci_high = quantile(value,0.975))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.