| Title: | Statistical Functions for the Maxwell-Boltzmann-Bose-Einstein-Fermi-Dirac (MBBEFD) Family of Distributions |
|---|---|
| Description: | Provides probability mass, distribution, quantile, random variate generation, and method-of-moments parameter fitting for the MBBEFD family of distributions used in insurance modeling as described in Bernegger (1997) <doi:10.2143/AST.27.1.563208> without any external dependencies. |
| Authors: | Avraham Adler [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-3039-0703>) |
| Maintainer: | Avraham Adler <[email protected]> |
| License: | MPL-2.0 |
| Version: | 1.0.0 |
| Built: | 2026-05-10 08:50:45 UTC |
| Source: | https://github.com/aadler/mbbefdlite |
Provides probability mass, distribution, quantile, random variate generation, and method-of-moments parameter fitting for the MBBEFD family of distributions used in insurance modeling as described in Bernegger (1997) <doi:10.2143/AST.27.1.563208> without any external dependencies.
The DESCRIPTION file:
| Package: | MBBEFDLite |
| Type: | Package |
| Title: | Statistical Functions for the Maxwell-Boltzmann-Bose-Einstein-Fermi-Dirac (MBBEFD) Family of Distributions |
| Version: | 1.0.0 |
| Authors@R: | person(given="Avraham", family="Adler",role=c("aut", "cre", "cph"), email="[email protected]", comment = c(ORCID = "0000-0002-3039-0703")) |
| Description: | Provides probability mass, distribution, quantile, random variate generation, and method-of-moments parameter fitting for the MBBEFD family of distributions used in insurance modeling as described in Bernegger (1997) <doi:10.2143/AST.27.1.563208> without any external dependencies. |
| License: | MPL-2.0 |
| Encoding: | UTF-8 |
| Imports: | stats |
| Suggests: | tinytest, covr |
| URL: | https://github.com/aadler/MBBEFDLite |
| BugReports: | https://github.com/aadler/MBBEFDLite/issues |
| ByteCompile: | yes |
| NeedsCompilation: | yes |
| UseLTO: | yes |
| Repository: | https://aadler.r-universe.dev |
| Date/Publication: | 2026-03-11 14:31:56 UTC |
| RemoteUrl: | https://github.com/aadler/mbbefdlite |
| RemoteRef: | HEAD |
| RemoteSha: | 567a86e6a0507d3e1133d4c911b7b682f2732825 |
| Author: | Avraham Adler [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-3039-0703>) |
| Maintainer: | Avraham Adler <[email protected]> |
Index of help topics:
dmb The MBBEFD Distribution
ecmb Exposure Curve for the MBBEFD Distribution
MBBEFDLite-package Statistical Functions for the
Maxwell-Boltzmann-Bose-Einstein-Fermi-Dirac
(MBBEFD) Family of Distributions
mommb Method of Moments Parameter Estimation for the
MBBEFD distribution
Avraham Adler [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-3039-0703>)
Maintainer: Avraham Adler <[email protected]>
Density, distribution function, quantile function, and random generation for the
MBBEFD distribution with parameters g and b.
dmb(x, g, b, c = NULL, log = FALSE) pmb(q, g, b, c = NULL, lower.tail = TRUE, log.p = FALSE) qmb(p, g, b, c = NULL, lower.tail = TRUE, log.p = FALSE) rmb(n, g, b, c = NULL)dmb(x, g, b, c = NULL, log = FALSE) pmb(q, g, b, c = NULL, lower.tail = TRUE, log.p = FALSE) qmb(p, g, b, c = NULL, lower.tail = TRUE, log.p = FALSE) rmb(n, g, b, c = NULL)
x, q
|
numeric; vector of quantiles. |
p |
numeric; vector of probabilities. |
n |
numeric; number of observations. If |
g |
numeric; (vector of) the |
b |
numeric; (vector of) the |
c |
numeric; (vector of) the optional single |
log, log.p
|
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are
|
The MBBEFD class of curves are defined in Bernegger (1997) and are
often used to model insurance risk. The density is defined on the semi-open
interval and the distribution and quantile functions are defined on
the closed interval . The parameters must satisfy and
.
dmb gives the density, pmb gives the distribution function,
qmb gives the quantile function, and rmb generates random
deviates.
The length of the result is determined by n for rmb, and is the
length of x, p, or q as appropriate for the other
functions.
Numerical arguments other than n are recycled to the length of the
result. Logical arguments should be of length 1.
This package follows Bernegger's convention that the density function does not exist at 1. This differs from the mbbefd package.
Avraham Adler [email protected]
Bernegger, S. (1997) The Swiss Re Exposure Curves and the MBBEFD Distribution Class. ASTIN Bulletin 27(1), 99–111. doi:10.2143/AST.27.1.563208
mommb for parameter estimation.
all.equal(dmb(0.5, 1, 0), 0) dmb(0.2, 20, 5) pmb(0.98, 25, 4) qmb(0.98, 25, 4) == 1 all.equal(qmb(pmb(0.98, 25, 4), 25, 4), 0.98) set.seed(45) rmb(3, 4, 12) set.seed(45) rmb(99:101, 4, 12) # length(99:101) = 3, so generates same 3 values as aboveall.equal(dmb(0.5, 1, 0), 0) dmb(0.2, 20, 5) pmb(0.98, 25, 4) qmb(0.98, 25, 4) == 1 all.equal(qmb(pmb(0.98, 25, 4), 25, 4), 0.98) set.seed(45) rmb(3, 4, 12) set.seed(45) rmb(99:101, 4, 12) # length(99:101) = 3, so generates same 3 values as above
Returns the limited average severity at x of a random variable with an
MBBEFD distribution with parameters g and b.
ecmb(x, g, b, c = NULL, lower.tail = TRUE)ecmb(x, g, b, c = NULL, lower.tail = TRUE)
x |
numeric; vector of quantiles. |
g |
numeric; (vector of) the |
b |
numeric; (vector of) the |
c |
numeric; (vector of) the optional |
lower.tail |
logical; if TRUE (default), percentages are of the
total loss being less than or equal to |
Given random variable with an MBBEFD distribution with
parameters and , the exposure curve (EC) is
defined as the ratio of the limited average severity (LAS) of the
variable at divided by the unlimited expected severity of the
distribution:
If one considers as a policy limit, then the value of
ecmb(x, g, b) is the percentage of the total expected loss which will be
contained within the (reinsurance) policy limit. If lower.tail is
FALSE, the return value is the percentage of total loss which will exceed
the limit.
A numeric vector containing the values of the exposure curve for the passed
x, b, and g vectors. If lower.tail is FALSE,
the return value is the complement of the exposure curve.
Avraham Adler [email protected]
Bernegger, S. (1997) The Swiss Re Exposure Curves and the MBBEFD Distribution Class. ASTIN Bulletin 27(1), 99–111. doi:10.2143/AST.27.1.563208
dmb and pmb for the density and distribution.
all.equal(ecmb(c(0, 1), 20, 5), c(0, 1)) ecmb(0.25, 100, 34)all.equal(ecmb(c(0, 1), 20, 5), c(0, 1)) ecmb(0.25, 100, 34)
Attempts to find the best g and b parameters which are consistent
with the first and second moments of the supplied data.
mommb(x, m = FALSE, tol = NULL, na.rm = TRUE, opts = list())mommb(x, m = FALSE, tol = NULL, na.rm = TRUE, opts = list())
x |
numeric; If |
m |
logical; When |
tol |
numeric; tolerance of the expectation-maximization
algorithm. If too tight, algorithm may fail. Defaults to the square root of
|
na.rm |
logical; if |
opts |
list; Configuration options including:
|
There are two fitting algorithms.
The default is an expectation-maximization form based on sections 4.1 and 4.2 of
Bernegger (1997). With rare exceptions, the fitted and
parameters must conform to:
subject to:
where and are the “true” first and second raw
moments, is the empirical second raw moment, and is the
mass point probability of a maximal loss: .
The algorithm starts with the estimate as an upper bound.
However, in step 2 of section 4.2, the component is estimated as the
difference between the numerical integration of and the empirical
second moment——as seen in equation (4.3).
This is converted to by reciprocation and convergence is tested by the
difference between this new and its prior value. If the new
, the algorithm stops with an error.
Bernegger (2026) in Algorithm 3 (Appendix C) describes a grid-search algorithm
for converging on and . The original algorithm looks for the sets
of parameters which return the appropriate mean and coefficient of variation
(CV), the latter of which can be expressed in closed form using the
dilogarithm function. However, instead of the 50,000 point grid suggested in the
paper, this package implements the algorithm as a nested set of calls to the
one-dimensional optimization algorithm of optimize. This is significantly
faster and has the benefit of returning a value even when no zeros can be found.
The algorithm basically defaults to the ranges suggested in the paper, but these
may be passed by the user in the opts list. Sometimes, the algorithm
converges to the upper bound of . In this case, the package
implementation will try once more using the square root of maxg instead.
This can allow convergence—often to the same point of the EM
algorithm, given that converged. When this happens, the iter value will
be 2 instead of 1.
Returns a list containing:
g |
The fitted |
b |
The fitted |
iter |
For the EM algorithm, the number of iterations used. For the LS algorithm, the number of attempts (1 or 2 if the retry was needed; see Details). |
sqerr |
The squared error between the empirical mean and the
theoretical mean given the fitted |
Anecdotal evidence indicates that parameter estimates from either fitting algorithm can be volatile when sample sizes are small (fewer than a few hundred observations).
Avraham Adler [email protected]
Bernegger, Stefan. (1997) The Swiss Re Exposure Curves and the MBBEFD Distribution Class. ASTIN Bulletin 27(1), 99–111. doi:10.2143/AST.27.1.563208
Bernegger, Stefan. (2026) Properties of the MBBEFD Distribution Classes. https://www.researchgate.net/publication/400516019_Properties_of_the_MBBEF_D_Distribution_Classes
rmb for random variate generation.
set.seed(85L) x <- rmb(1000, 25, 4) mommb(x) mommb(x, opts = list(alg = "LS"))set.seed(85L) x <- rmb(1000, 25, 4) mommb(x) mommb(x, opts = list(alg = "LS"))