bootstrap: Generic Bootstrapping Subroutine

View source: R/bootstrap.R

bootstrapR Documentation

Generic Bootstrapping Subroutine

Description

Provide a numeric or character vector and create bootstrap samples (with estimates) of the original vector. Also calculates CI95 using quantile().

Usage

bootstrap(x, boot = 1000, FUN, up = 0.975, lo = 0.025)

Arguments

x

Character or Numeric. The original data to be bootstrapped.

boot

Number of bootstraps to perform.

FUN

Function desired for the point estimate of the original data vector (if numeric data). Must return a scalar.

up

Upper confidence limit.

lo

Lower confidence limit.

Value

A list containing:

BootSamples

List of the bootstrap populations created during the simulation.

BootEstimates

List of the various point estimates of each of the bootstrap samples.

CI95

Vector of the point estimate and upper & lower CI95 produced via the bootstrap samples.

SE

The standard error based on the original data. Could be used to calculate CI95 via 1.96*SE if so desired.

Author(s)

Stu Field

See Also

CI95se(), quantile()

Examples

bootstrap(x = round(runif(25,1,100)), boot = 50, FUN = mean) # numeric
bootstrap(x = LETTERS[1:26], boot = 50)                      # character
z <- factor(sample(c("stu", "is", "cool"), 10, replace = TRUE))
# bootstrap(x = z, boot = 50)      # factor (ask to convert to character)

stufield/stuRpkg documentation built on April 2, 2022, 2:05 p.m.