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.
# install.packages("remotes")
remotes::install_github("thiagodoregosousa/bgev")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) maximumbgev_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.
| 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.
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 handtests/testthat/ — unit tests, run via
devtools::test()benchmarks/ — Monte Carlo study
(mc_study.R) and example datasets (data/), not
part of the installed packageinst/shiny-app/ — interactive density explorer, run
with
shiny::runApp(system.file("shiny-app", package = "bgev"))to_be_implemented/ — planned features not yet
implemented