| Type: | Package | 
| Title: | Tidyverse-Compatible Bootstrapping | 
| Version: | 0.1.1 | 
| Description: | Compute arbitrary non-parametric bootstrap statistics on data in tidy data frames. | 
| Depends: | R (≥ 3.4.0) | 
| License: | GPL-3 | 
| URL: | https://github.com/langcog/tidyboot | 
| BugReports: | http://github.com/langcog/tidyboot/issues | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| RoxygenNote: | 6.0.1 | 
| Imports: | dplyr (≥ 0.7.4), modelr (≥ 0.1.1), purrr (≥ 0.2.4), rlang (≥ 0.1.6), tidyr (≥ 0.7.2) | 
| NeedsCompilation: | no | 
| Packaged: | 2018-03-14 00:52:14 UTC; mikabr | 
| Author: | Mika Braginsky [aut, cre], Daniel Yurovsky [aut] | 
| Maintainer: | Mika Braginsky <mika.br@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2018-03-14 04:13:49 UTC | 
Confidence interval (lower 2.5%)
Description
Confidence interval (lower 2.5%)
Usage
ci_lower(x, na.rm = FALSE)
Arguments
| x | A numeric vector | 
| na.rm | A logical value indicating whether NA values should be stripped before the computation proceeds. | 
Value
2.5
Examples
x <- rnorm(1000, mean = 0, sd = 1)
ci_lower(x)
Confidence interval (upper 97.5%)
Description
Confidence interval (upper 97.5%)
Usage
ci_upper(x, na.rm = FALSE)
Arguments
| x | A numeric vector | 
| na.rm | A logical value indicating whether NA values should be stripped before the computation proceeds. | 
Value
97.5
Examples
x <- rnorm(1000, mean = 0, sd = 1)
ci_upper(x)
Non-parametric bootstrap with multiple sample statistics
Description
tidyboot is a generic function for bootstrapping on various data
structures. The function invokes particular methods which depend on the class
of the first argument.
Usage
tidyboot(data, ...)
Arguments
| data | A data structure containing the data to bootstrap. | 
| ... | Additional arguments passed to particular methods. | 
Examples
## List of available methods
methods(tidyboot)
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)))
Non-parametric bootstrap for logical vector data
Description
Computes arbitrary bootstrap statistics on univariate data.
Usage
## S3 method for class 'logical'
tidyboot(data, summary_function = mean,
  statistics_functions, nboot = 1000, size = 1, replace = TRUE, ...)
Arguments
| data | A logical vector of data to bootstrap over. | 
| summary_function | A function to be computed over each set of samples.
This function needs to take a vector and return a single number (defaults
to  | 
| statistics_functions | A named list of functions to be computed over the set of summary values from all samples. | 
| nboot | The number of bootstrap samples to take (defaults to
 | 
| size | The fraction of items to sample (defaults to 1). | 
| replace | Logical indicating whether to sample with replacement
(defaults to  | 
| ... | Other arguments passed from generic. | 
Examples
## Mean and 95% confidence interval for 500 samples from a binomial distribution
x <- as.logical(rbinom(500, 1, 0.5))
tidyboot(x, statistics_functions = c(ci_lower, mean, ci_upper))
Non-parametric bootstrap for numeric vector data
Description
Computes arbitrary bootstrap statistics on univariate data.
Usage
## S3 method for class 'numeric'
tidyboot(data, summary_function = mean,
  statistics_functions, nboot = 1000, size = 1, replace = TRUE, ...)
Arguments
| data | A numeric vector of data to bootstrap over. | 
| summary_function | A function to be computed over each set of samples.
This function needs to take a vector and return a single number (defaults
to  | 
| statistics_functions | A named list of functions to be computed over the set of summary values from all samples. | 
| nboot | The number of bootstrap samples to take (defaults to
 | 
| size | The fraction of items to sample (defaults to 1). | 
| replace | Logical indicating whether to sample with replacement
(defaults to  | 
| ... | Other arguments passed from generic. | 
Examples
## Mean and 95% confidence interval for 500 samples from a normal distribution
x <- rnorm(500, mean = 0, sd = 1)
tidyboot(x, statistics_functions = list("ci_lower" = ci_lower,
                                        "mean" = mean,
                                        "ci_upper" = ci_upper))
Non-parametric bootstrap and empirical central tendency for data frames
Designed to make standard use of tidyboot.data.frame easier
Description
Computes arbitrary bootstrap statistics on univariate data. NOTE: Both empirical functions and bootstrapping functions will be computed over the grouping variables currently specified for the data frame.
Usage
tidyboot_mean(data, column, nboot = 1000, na.rm = FALSE)
Arguments
| data | A data frame. | 
| column | A column of  | 
| nboot | The number of bootstrap samples to take (defaults to
 | 
| na.rm | A logical value indicating whether NA values should be stripped before the computation proceeds. | 
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_mean(column = value)