Learn R Programming

exactamente (version 0.1.1)

reg_bootstrap: 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
)

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

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.

See Also

plot.regboot, summary.regboot

Examples

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

Run the code above in your browser using DataLab