Skip to contents

Generates bootstrap samples from a fitted parametric distribution rather than from the empirical sample. Delegates to boot::boot(sim = "parametric") when boot is installed; otherwise uses an inline rnorm/rpois/rbinom/rexp/rgamma loop.

Usage

parametric_bootstrap(
  data,
  statistic,
  distribution = "normal",
  n_boot = 2000L,
  ci_level = 0.95,
  seed = 42L,
  ...
)

Arguments

data

Original numeric data (used to fit the distribution).

statistic

Function returning a scalar.

distribution

One of "normal", "poisson", "binomial", "exponential", "gamma".

n_boot

Number of replicates.

ci_level

Confidence level.

seed

Random seed.

...

Distribution-specific parameters (mu, sigma, lam, p, scale, shape).

Value

A morie_bootstrap_result.

See also

Examples

set.seed(1)
str(parametric_bootstrap(rnorm(40), statistic = mean,
                         n_boot = 200L), max.level = 1)
#> List of 11
#>  $ estimate         : num -0.0395
#>  $ se               : num 0.208
#>  $ ci_lower         : num -0.473
#>  $ ci_upper         : num 0.307
#>  $ bias             : num -0.0183
#>  $ n_boot           : int 200
#>  $ method           : chr "parametric_normal"
#>  $ ci_method        : chr "percentile"
#>  $ boot_distribution: num [1:200] 0.058066 0.019929 -0.355156 -0.000638 -0.154774 ...
#>  $ original_estimate: num -0.0395
#>  $ acceleration     : num 0
#>  - attr(*, "class")= chr [1:2] "morie_bootstrap_result" "list"