bootstrap_compute_ci: Compute confidence intervals from a bootstrap sample.

View source: R/bootstrap_compute_ci.R

bootstrap_compute_ciR Documentation

Compute confidence intervals from a bootstrap sample.

Description

Workhorse function for computing a confidence interval from a set of bootstrap samples.

Usage

bootstrap_compute_ci(
  bootobj,
  level,
  type = c("percentile", "BC", "bootstrap-t")
)

Arguments

bootobj

matrix containing the bootstrap estimates of the parameters returned by a bootstrap workhorse function:

  • bootstrap_residual

  • bootstrap_parametric_linear

  • bootstrap_parametric

  • bootstrap_case

There should be one row for each parameter and each column contains a bootstrap estimate.

level

scalar between 0 and 1 indicating the confidence level.

type

string defining the type of confidence interval to construct. If "percentile" (default) an equal-tailed percentile interval is constructed. If "BC" the bias-corrected percentile interval is constructed. If "bootstrap-t" the bootstrap-t interval is constructed.

Details

The percentile interval is constructed by taking the empirical 100\alpha and 100(1-\alpha) percentiles from the bootstrap values. If \hat{F} is the empirical distribution function of the bootstrap values, then the 100(1 - 2\alpha) given by

(\hat{F}^{-1}(\alpha), \hat{F}^{-1}(1-\alpha))

The bias-corrected (BC) interval corrects for median-bias. It is given by

(\hat{F}^{-1}(\alpha_1), \hat{F}^{-1}(1-\alpha_2))

where

\alpha_1 = \Phi{2\hat{z}_0 + \Phi^{-1}(\alpha)}

\alpha_2 = 1 - \Phi{2\hat{z}_0 + \Phi^{-1}(1-\alpha)}

\hat{z}_0 = \Phi^{-1}(\hat{F}(\hat{\beta}))

where \hat{\beta} is the estimate from the original sample. The bootstrap-t interval is based on the bootstrap distribution of

t^{b} = \frac{\hat{\beta}^{b} - \hat{\beta}}{\hat{\sigma}^{b}}

where \hat{\sigma} is the estimate of the standard error of \hat{\beta} and the superscript b denotes a bootstrap sample. Let \hat{G} be the empirical distribution function of the bootstrap standardized statistics given above. Then, the bootstrap-t interval is given by

(\hat{\beta} - \hat{\sigma}\hat{G}^{-1}(1-\alpha), \hat{\beta} - \hat{\sigma}\hat{G}^{-1}\alpha)

Value

matrix with the same number of rows as rows in bootobj and 2 columns. The first column gives the lower limit of the confidence interval the second column gives the upper limit of the confidence interval.


reyesem/IntroAnalysis documentation built on March 29, 2025, 3:29 p.m.