Skip to contents

Precompute parametric bootstrap parameter draws for a fitted rate distribution. This keeps stochastic uncertainty estimation out of the plotting method while preserving the bootstrap draws on the returned rate_distribution_fit object.

Usage

bootstrap_rate_distribution(
  x,
  model = NULL,
  reps = 1000L,
  seed = NULL,
  kl = NULL
)

Arguments

x

A rate_distribution_fit object from fit_rate_distribution().

model

Distribution model to bootstrap. If NULL, the selected model stored in x$selected_model is used.

reps

Number of bootstrap parameter draws.

seed

Optional random seed for the bootstrap draw. The previous global RNG state is restored after the bootstrap when a seed is supplied.

kl

NULL or logical. When NULL, compute the bootstrap Kullback-Leibler divergence summary for Gumbel fits and skip it for other models. Set to FALSE to store only the bootstrap parameter draws.

Value

A rate_distribution_fit object with a rate_distribution_bootstrap entry stored in x$bootstrap[[model]]. The entry contains the model name, number of draws, seed, and parameter matrix returned by univariateML::bootstrapml(). For Gumbel fits, the entry also stores a bootstrapped Kullback-Leibler divergence summary unless kl = FALSE.

Details

For Gumbel fits, the default kl = NULL also computes the Kullback-Leibler divergence between the empirical kernel density of the fitted data and the fitted Gumbel density, then repeats that calculation for each bootstrap parameter draw. Extract the compact diagnostic table with as.data.frame(x, component = "goodness").

Examples

if (requireNamespace("univariateML", quietly = TRUE) &&
    requireNamespace("evd", quietly = TRUE)) {
  fit <- fit_rate_distribution(c(1, 1.4, 1.9, 2.8, 4.1, 6.5), models = "gumbel")
  fit <- bootstrap_rate_distribution(fit, model = "gumbel", reps = 25, seed = 1)
}
#> Loading required namespace: intervals