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.
Arguments
- x
A
rate_distribution_fitobject fromfit_rate_distribution().- model
Distribution model to bootstrap. If
NULL, the selected model stored inx$selected_modelis 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
NULLor logical. WhenNULL, compute the bootstrap Kullback-Leibler divergence summary for Gumbel fits and skip it for other models. Set toFALSEto 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
