g-and-k: g-and-k distribution functions

dgkR Documentation

g-and-k distribution functions

Description

Density, distribution function, quantile function and random generation for the g-and-k distribution.

Usage

dgk(x, A, B, g, k, c = 0.8, log = FALSE)

pgk(q, A, B, g, k, c = 0.8, zscale = FALSE)

qgk(p, A, B, g, k, c = 0.8)

rgk(n, A, B, g, k, c = 0.8)

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.

k

Vector of k parameters. Must be at least -0.5.

c

Vector of c parameters. Often fixed at 0.8 which is the default.

log

If true the log density is returned.

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 g-and-k distribution is defined by its quantile function:

x(p) = A + B [1 + c \tanh(gz/2)] z(1 + z^2)^k,

where z is the standard normal quantile of p. Parameter restrictions include B>0 and k \geq -0.5. Typically c=0.8. For more background information see the references.

rgk and qgk use quick direct calculations. However dgk and pgk involve slower numerical inversion of the quantile function.

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

Value

dgk gives the density, pgk gives the distribution, qgk gives the quantile function, and rgk 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)

Examples

p = 1:9/10 ##Some probabilities
x = qgk(seq(0.1,0.9,0.1), A=3, B=1, g=2, k=0.5) ##g-and-k quantiles
rgk(5, A=3, B=1, g=2, k=0.5) ##g-and-k draws
dgk(x, A=3, B=1, g=2, k=0.5) ##Densities of x under g-and-k
dgk(x, A=3, B=1, g=2, k=0.5, log=TRUE) ##Log densities of x under g-and-k
pgk(x, A=3, B=1, g=2, k=0.5) ##Distribution function of x under g-and-k

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

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