Skip to contents

An R package for the bimodal GEV (Generalized Extreme Value) distribution: density, distribution, quantile, and random generation functions, plus maximum likelihood estimation. Useful for modeling heterogeneous bimodal data. The parametrization follows the revised BGEV with a location parameter of Otiniano, Lisboa & Ribeiro (2025) doi:10.3390/e27070749, which generalizes Otiniano et al. (2023) doi:10.1007/s10651-023-00566-7.

Installation

# install.packages("remotes")
remotes::install_github("thiagodoregosousa/bgev")

Usage

library(bgev)

set.seed(1)
x <- rbgev(n = 1000, mu = 0, sigma = 1, xi = 0.5, delta = 1)

hist(x, probability = TRUE, breaks = 30)
lines(sort(x), dbgev(sort(x), mu = 0, sigma = 1, xi = 0.5, delta = 1), col = "red")

fit <- bgev_mle(x)
fit$par          # estimated c(mu, sigma, xi, delta)
fit$admissible   # TRUE if the optimum is a regular (trustworthy) maximum

bgev_mle() returns the estimate together with diagnostics (convergence, agree, admissible, boundary, optimum). For discrete or rounded data use the grouped (interval) likelihood:

fit <- bgev_mle(round(x), likelihood = "grouped_likelihood", h = 1)

Estimation is restricted to delta > 0 (bimodality requires it, and delta < 0 makes the likelihood unbounded at x = mu); the distribution functions accept the full delta > -1. See the estimation vignette for the methodology and a Monte Carlo validation.

Functions

Function Description
dbgev() Density of the bimodal GEV distribution
pbgev() Distribution function
qbgev() Quantile function
rbgev() Random generation
bgev_mle() Maximum likelihood estimation with diagnostics
bgev_log_likelihood() Log-likelihood used by bgev_mle()
bgev_profile_likelihood() Profile log-likelihood for a parameter (diagnostic)
bgev_valid_params() Check whether a set of parameters is valid
bgev_support() Compute the support of the distribution for given parameters

See the Reference page for full documentation.

Package layout

  • R/ — package source: distribution functions (bgev_distribution.R), support/validity (bgev_domain.R), estimation, starting values and diagnostics (bgev_estimation.R), and consistency checks (dist_check.R)
  • vignettes/ — estimation methodology write-up (bgev-estimation.Rmd)
  • man/, NAMESPACE — generated by devtools::document(); do not edit by hand
  • tests/testthat/ — unit tests, run via devtools::test()
  • benchmarks/ — Monte Carlo study (mc_study.R) and example datasets (data/), not part of the installed package
  • inst/shiny-app/ — interactive density explorer, run with shiny::runApp(system.file("shiny-app", package = "bgev"))
  • to_be_implemented/ — planned features not yet implemented

References

  • Otiniano, C. E. G., Lisboa, M. N. S., & Ribeiro, T. K. A. (2025). A Revised Bimodal Generalized Extreme Value Distribution: Theory and Climate Data Application. Entropy, 27(7), 749. doi:10.3390/e27070749
  • Otiniano, C. E. G., et al. (2023). A bimodal model for extremes data. Environmental and Ecological Statistics. doi:10.1007/s10651-023-00566-7