bootstrap_curve: Generic bootstrap for curve-valued estimators

View source: R/bootstrap.R

bootstrap_curveR Documentation

Generic bootstrap for curve-valued estimators

Description

Generic bootstrap for curve-valued estimators

Usage

bootstrap_curve(est_fun, R = 300, conf = 0.95, seed = NULL, keep_reps = FALSE)

Arguments

est_fun

Function of one argument r; called with NULL for the point estimate and with integers 1:R for bootstrap replicates.

R

Number of replicates.

conf

Confidence level in ⁠(0, 1)⁠.

seed

Optional RNG seed.

keep_reps

If TRUE, include replicate matrix in output.

Value

A list with estimate, lo, hi, and conf.

Examples

vals <- c(1, 2, 4, 8)
boot <- bootstrap_curve(
  function(r) {
    if (is.null(r)) {
      mean(vals)
    } else {
      mean(sample(vals, replace = TRUE))
    }
  },
  R = 20,
  seed = 1
)
boot$estimate

tvrmst documentation built on March 17, 2026, 1:07 a.m.