Skip to contents

Plot a fitted candidate distribution from fit_rate_distribution(). The current method supports the Gumbel candidate used by Berv et al. (2026). It can overlay a pointwise bootstrap band and bootstrap density curves when bootstrap_rate_distribution() has already stored bootstrap draws on x.

Usage

# S3 method for class 'rate_distribution_fit'
plot(
  x,
  model = c("gumbel"),
  bootstrap = NULL,
  bootstrap_curves = 120L,
  col = "#b01f2e",
  hist_col = "grey90",
  band_alpha = 0.14,
  curve_alpha = 0.08,
  data_density = TRUE,
  rug = TRUE,
  breaks = "FD",
  main = NULL,
  xlab = NULL,
  ylab = "Density",
  ...
)

Arguments

x

A rate_distribution_fit object.

model

Distribution model to plot. Currently only "gumbel" is supported.

bootstrap

NULL or logical. If NULL, draw the bootstrap overlay when precomputed draws for model are available. If TRUE, require precomputed draws from bootstrap_rate_distribution(). If FALSE, draw no bootstrap overlay.

bootstrap_curves

Number of precomputed bootstrap density curves to draw over the band. Set to 0 to draw only the band.

col

Color for the fitted density, bootstrap band, and bootstrap curves.

hist_col

Histogram fill color. A vector of colors is passed through to graphics::hist() and can color bins individually.

band_alpha, curve_alpha

Alpha values for the bootstrap band and individual bootstrap curves.

data_density

Logical; overlay the empirical kernel density.

rug

Logical; add a rug for the fitted data values.

breaks

Histogram breaks passed to graphics::hist().

main, xlab, ylab

Plot labels.

...

Additional arguments passed to graphics::hist().

Value

Invisibly returns a list with the x grid, fitted density, bootstrap densities, bootstrap band, and plotted parameter table.

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)
  plot(fit, bootstrap_curves = 5)
}