confidence_bootstrap: Nonparametric Bootstrap Confidence Interval

confidence_bootstrapR Documentation

Nonparametric Bootstrap Confidence Interval

Description

Computes equi-tailed two-sided nonparametric confidence interval.

Usage

confidence_bootstrap(object, ...)

## S4 method for signature 'numeric'
confidence_bootstrap(
  object,
  level = 0.95,
  type = c("basic", "normal", "student", "percentiles"),
  t0 = NULL,
  var_t0 = NULL,
  var_t = NULL,
  ...
)

Arguments

object

A numeric vector giving the bootstrap replicates of the statistic of interest.

...

Currently not used.

level

A length-one numeric vector giving the confidence level. Must be a single number between 0 and 1.

type

A character string giving the type of confidence interval to be returned. It must be one "basic" (the default), "student", "normal" or "percentiles". Any unambiguous substring can be given.

t0

A length-one numeric vector giving the observed value of the statistic of interest. Must be defined if type is "basic", "student" or "normal".

var_t0

A length-one numeric vector giving an estimate of the variance of the statistic of interest. Must be defined if type is "student". If var_t0 is undefined and type is "normal, it defaults to var(object).

var_t

A numeric vector giving the variances of the bootstrap replicates of the variable of interest. Must be defined if type is "student".

Value

A length-two numeric vector giving the lower and upper confidence limits.

Author(s)

N. Frerebeau

References

Davison, A. C. & Hinkley, D. V. (1997). Bootstrap Methods and Their Application. Cambridge Series on Statistical and Probabilistic Mathematics. Cambridge: Cambridge University Press.

See Also

bootstrap()

Other summary statistics: confidence_binomial(), confidence_mean(), confidence_multinomial(), interval_credible(), interval_hdr()

Examples

x <- rnorm(20)

## Bootstrap
bootstrap(x, do = mean, n = 100)

## Estimate the 25th and 95th percentiles
quant <- function(x) { quantile(x, probs = c(0.25, 0.75)) }
bootstrap(x, n = 100, do = mean, f = quant)

## Get the n bootstrap estimates
(z <- bootstrap(x, n = 100, do = mean, f = function(x) { x }))

## Basic bootstrap confidence interval
confidence_bootstrap(z, level = 0.95, type = "basic", t0 = mean(x))

tesselle/arkhe documentation built on June 15, 2025, 12:05 a.m.