tidyboot.data.frame {tidyboot} | R Documentation |
Non-parametric bootstrap for data frames
Description
Computes arbitrary bootstrap statistics on univariate data.
Usage
## S3 method for class 'data.frame'
tidyboot(data, column = NULL, summary_function = mean,
statistics_functions, nboot = 1000, ...)
Arguments
data |
A data frame. |
column |
A column of |
summary_function |
A function to be computed over each set of samples as
a data frame, or a function to be computed over each set of samples as a
single column of a data frame indicated by |
statistics_functions |
A function to be computed over each set of
samples as a data frame, or a named list of functions to be computed over
each set of samples as a single column of a data frame indicated by
|
nboot |
The number of bootstrap samples to take (defaults to
|
... |
Other arguments passed from generic. |
Examples
## Mean and 95% confidence interval for 500 samples from two different normal distributions
require(dplyr)
gauss1 <- data_frame(value = rnorm(500, mean = 0, sd = 1), condition = 1)
gauss2 <- data_frame(value = rnorm(500, mean = 2, sd = 3), condition = 2)
df <- bind_rows(gauss1, gauss2)
df %>% group_by(condition) %>%
tidyboot(summary_function = function(x) x %>% summarise(mean = mean(value)),
statistics_functions = function(x) x %>%
summarise_at(vars(mean), funs(ci_upper, mean, ci_lower)))
[Package tidyboot version 0.1.1 Index]