percboot: Perform Percentile Bootstrap for a Given Statistic

Description Usage Arguments Value References Examples

View source: R/boot.R

Description

Approximate the bootstrap distribution for the percentile bootstrap, given a statistic as would be supplied to boot from the boot package.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
percboot(
  data,
  statistic,
  B = 2000,
  sim = "ordinary",
  stratified = FALSE,
  ran.gen = function(d, p) d,
  mle = NULL,
  formula = NULL
)

Arguments

data

the dataframe or data matrix

statistic

a function that computes the statistic from data

B

the number of bootstrap replicates

sim

either "ordinary" (for case resampling bootstrap) or "parametric" (for parametric bootstrap)

stratified

whether or not (default) to use the use stratified sampling for the bootstrapping.

ran.gen

a function returning a random sample, for the parametric bootstrap

mle

the maximum likelihood estimate from the original sample, for the parametric bootstrap

formula

for use with interfacing to lm, glm, etc.

Value

A list containing the sample estimate, bootstrap estimates, and bootstrap CDF for the percentile bootstrap.

References

Thomas J. DiCiccio and Bradley Efron. "Bootstrap confidence intervals." Statistical Science (1996): 189-212.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Bootstrap confidence functions for a single mean.

t.one.sample <- function(data, id = 1:length(data)){
  dat <- data[id]

  d <- mean(dat)

  return(d)
}

data(dietstudy)

bc <- percboot(data = dietstudy$weightchange[dietstudy$diet == 'Low Carb'],
        statistic = t.one.sample,
        B = 2000)

ddarmon/clp documentation built on Jan. 25, 2021, 6:22 p.m.