g-and-h: g-and-h distribution functions

dghR Documentation

g-and-h distribution functions

Description

Density, distribution function, quantile function and random generation for the generalised g-and-h distribution

Usage

dgh(x, A, B, g, h, c = 0.8, log = FALSE, type = c("generalised", "tukey"))

pgh(q, A, B, g, h, c = 0.8, zscale = FALSE, type = c("generalised", "tukey"))

qgh(p, A, B, g, h, c = 0.8, type = c("generalised", "tukey"))

rgh(n, A, B, g, h, c = 0.8, type = c("generalised", "tukey"))

Arguments

x

Vector of quantiles.

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.

log

If true the log density is returned.

type

Can be "generalised" (default) or "tukey".

q

Vector of quantiles.

zscale

If true the N(0,1) quantile of the cdf is returned.

p

Vector of probabilities.

n

Number of draws to make.

Details

The Tukey and generalised g-and-h distributions are defined by their quantile functions. For Tukey's g-and-h distribution, this is

x(p) = A + B [(\exp(gz)-1) / g] \exp(hz^2/2).

The generalised g-and-h instead uses

x(p) = A + B [1 + c \tanh(gz/2)] z \exp(hz^2/2).

In both cases z is the standard normal quantile of p. Note that neither family of distributions is a special case of the other. Parameter restrictions include B>0 and h \geq 0. The generalised g-and-h distribution typically takes c=0.8. For more background information see the references.

rgh and qgh use quick direct calculations. However dgh and pgh involve slower numerical inversion of the quantile function.

Especially extreme values of the inputs will produce pgh output rounded to 0 or 1 (-Inf or Inf for zscale=TRUE). The corresponding dgh output will be 0 or -Inf for log=TRUE.

Value

dgh gives the density, pgh gives the distribution, qgh gives the quantile function, and rgh generates random deviates

References

Haynes ‘Flexible distributions and statistical models in ranking and selection procedures, with applications’ PhD Thesis QUT (1998) Rayner and MacGillivray ‘Numerical maximum likelihood estimation for the g-and-k and generalized g-and-h distributions’ Statistics and Computing, 12, 57-75 (2002) Tukey ‘Modern techniques in data analysis’ (1977) Yan and Genton ‘The Tukey g-and-h distribution’ Significance, 16, 12-13 (2019)

Examples

p = 1:9/10 ##Some probabilities
x = qgh(seq(0.1,0.9,0.1), A=3, B=1, g=2, h=0.5) ##g-and-h quantiles
rgh(5, A=3, B=1, g=2, h=0.5) ##g-and-h draws
dgh(x, A=3, B=1, g=2, h=0.5) ##Densities of x under g-and-h
dgh(x, A=3, B=1, g=2, h=0.5, log=TRUE) ##Log densities of x under g-and-h
pgh(x, A=3, B=1, g=2, h=0.5) ##Distribution function of x under g-and-h

gk documentation built on Aug. 10, 2023, 5:06 p.m.

Related to g-and-h in gk...