[Stable]

The generalised g-and-h distribution is a flexible distribution used to model univariate data, similar to the g-k distribution. It is known for its ability to handle skewness and heavy-tailed behavior.

dist_gh(A, B, g, h, c = 0.8)

Arguments

A

Vector of A (location) parameters.

B

Vector of B (scale) parameters. Must be positive.

g

Vector of g parameters.

h

Vector of h parameters. Must be non-negative.

c

Vector of c parameters (used for generalised g-and-h). Often fixed at 0.8 which is the default.

Details

We recommend reading this documentation on https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.

In the following, let \(X\) be a g-and-h random variable with parameters A, B, g, h, and c.

Support: \((-\infty, \infty)\)

Mean: Not available in closed form.

Variance: Not available in closed form.

Probability density function (p.d.f):

The g-and-h distribution does not have a closed-form expression for its density. Instead, it is defined through its quantile function:

$$ Q(u) = A + B \left( 1 + c \frac{1 - \exp(-gz(u))}{1 + \exp(-gz(u))} \right) \exp(h z(u)^2/2) z(u) $$

where \(z(u) = \Phi^{-1}(u)\)

Cumulative distribution function (c.d.f):

The cumulative distribution function is typically evaluated numerically due to the lack of a closed-form expression.

See also

Examples

dist <- dist_gh(A = 0, B = 1, g = 0, h = 0.5)
dist
#> <distribution[1]>
#> [1] gh(A = 0, B = 1, g = 0, h = 0.5)

mean(dist)
#> [1] 0
variance(dist)
#> [1] NA
support(dist)
#> <support_region[1]>
#> [1] R
generate(dist, 10)
#> [[1]]
#>  [1]  0.49228295  0.39850091  0.25650522  0.68120836  1.21812625  0.60825965
#>  [7] -1.63069932 -0.51324031  1.33697154 -0.07476383
#> 

density(dist, 2)
#> [1] 0.05993837
density(dist, 2, log = TRUE)
#> [1] -2.814438

cdf(dist, 4)
#> [1] 0.9634416

quantile(dist, 0.7)
#> [1] 0.5617207