reg_bootstrap: Regular Bootstrap with Summary Statistics

View source: R/reg_bootstrap.R

reg_bootstrapR Documentation

Regular Bootstrap with Summary Statistics

Description

Performs a regular bootstrap to generate a distribution of sample statistics and computes a set of summary statistics: mode, median, mean, standard deviation, and lower and upper confidence intervals.

Usage

reg_bootstrap(
  data,
  n_bootstraps = 10000,
  anon = function(x) (mean(x)),
  lb = 0.025,
  ub = 0.975,
  density_args
)

Arguments

data

A numeric vector of data points.

n_bootstraps

An integer indicating the number of bootstrap samples to generate. Default is 10000.

anon

A function to compute the sample statistic for each bootstrap sample. Default is the mean function.

lb

Lower bound for the confidence interval. Default is 0.025.

ub

Upper bound for the confidence interval. Default is 0.975.

density_args

Additional arguments to be passed to density function.

Value

A list with two elements:

  • dens: a density estimate of the bootstrap sample statistics,

  • stats: a list of summary statistics including number of resamples, mode, median, mean, standard deviation, lower confidence interval (lCI), and upper confidence interval (uCI).

See Also

plot.regboot, summary.regboot

Examples

set.seed(123)
data <- rnorm(5)
result <- reg_bootstrap(data)
result$stats

exactamente documentation built on Aug. 29, 2023, 5:10 p.m.