Skip to contents

R parity of morie.fn.btsrp.morie_bootstrap_ci. Three methods are supported: percentile, BCa (Efron 1987 JASA), and studentized (Hall 1988 nested resampling).

Usage

btsrp(
  x,
  statistic = NULL,
  B = 2000L,
  alpha = 0.05,
  method = c("percentile", "bca", "studentized"),
  seed = 42L
)

morie_bootstrap_ci(
  x,
  statistic = NULL,
  B = 2000L,
  alpha = 0.05,
  method = c("percentile", "bca", "studentized"),
  seed = 42L
)

Arguments

x

numeric vector.

statistic

function: function(x) -> scalar. Default mean.

B

integer. Bootstrap replicates (default 2000).

alpha

numeric. Two-sided level (default 0.05).

method

"percentile", "bca", or "studentized".

seed

integer.

Value

Named list with estimate, se, ci_lower, ci_upper, alpha, B, n, method.

References

Efron, B. & Tibshirani, R. (1993). An Introduction to the Bootstrap. Efron, B. (1987). Better bootstrap confidence intervals. JASA, 82(397), 171-185.

Examples

set.seed(0)
x <- rnorm(100)
res <- btsrp(x, B = 200, seed = 0, method = "percentile")
c(res$estimate, res$ci_lower, res$ci_upper)
#> [1]  0.02266845 -0.14982923  0.18198141