tidyboot.data.frame: Non-parametric bootstrap for data frames

Description Usage Arguments Examples

View source: R/tidyboot.R

Description

Computes arbitrary bootstrap statistics on univariate data.

Usage

1
2
3
## 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 data to bootstrap over (if not supplied, summary_function and statistic_function must operate over the appropriate data frame).

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 column (defaults to mean).

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 column.

nboot

The number of bootstrap samples to take (defaults to 1000).

...

Other arguments passed from generic.

Examples

1
2
3
4
5
6
7
8
9
## 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)))

tidyboot documentation built on May 2, 2019, 9:33 a.m.