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] |
Maintainer: | Avraham Adler <[email protected]> |
License: | MPL-2.0 |
Version: | 0.0.4 |
Built: | 2024-11-19 05:25:26 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: | 0.0.4 |
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 |
RemoteUrl: | https://github.com/aadler/mbbefdlite |
RemoteRef: | HEAD |
RemoteSha: | beab09e7e3a202666abbe7d782bd313728d764bc |
Author: | Avraham Adler [aut, cre, cph] (<https://orcid.org/0000-0002-3039-0703>) |
Maintainer: | Avraham Adler <[email protected]> |
Index of help topics:
MBBEFDLite-package Statistical Functions for the Maxwell-Boltzmann-Bose-Einstein-Fermi-Dirac (MBBEFD) Family of Distributions dmb The MBBEFD Distribution ecmb Exposure Curve for the MBBEFD Distribution mommb Method of Moments Parameter Estimation for the MBBEFD distribution
Avraham Adler [aut, cre, cph] (<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 |
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
.
dnorm
gives the density, pnorm
gives the distribution function,
qnorm
gives the quantile function, and rnorm
generates random
deviates.
The length of the result is determined by n
for rnorm
, 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 exists 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) # Should equal previous call
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) # Should equal previous call
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, maxit = 100L, tol = .Machine$double.eps ^ 0.5, na.rm = TRUE)
mommb(x, maxit = 100L, tol = .Machine$double.eps ^ 0.5, na.rm = TRUE)
x |
numeric; vector of observations between 0 and 1. |
maxit |
integer; maximum number of iterations. |
tol |
numeric; tolerance. If too tight, algorithm may fail.
Defaults to the square root of |
na.rm |
logical; if |
The algorithm is 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 moments
and
is the empirical second moment.
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 attempts to restart with a larger
—a
smaller
. In this case, the algorithm tends to fail to converge.
Returns a list containing:
g |
The fitted |
b |
The fitted |
iter |
The number of iterations used. |
sqerr |
The squared error between the empirical mean and the
theoretical mean given the fitted |
Anecdotal evidence indicates that the results of this fitting algorithm can be volatile, especially with fewer than a few hundred observations.
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
rmb
for random variate generation.
set.seed(85L) x <- rmb(1000, 25, 4) mommb(x)
set.seed(85L) x <- rmb(1000, 25, 4) mommb(x)