Density, distribution function, quantile function and random generation for the generalised inverse-Gaussian distribution with parameters p, a and b.

dgig(x, p, a, b, log = FALSE)

rgig(n, p, a, b, seed = 0)

pgig(q, p, a, b, lower.tail = TRUE, log.p = FALSE)

qgig(prob, p, a, b, lower.tail = TRUE, log.p = FALSE)

Arguments

x, q

vector of quantiles.

p

parameter p.

a, b

parameters a and b. Must be positive.

log, log.p

logical; if TRUE, probabilities/densities \(p\) are returned as \(log(p)\).

n,

number of observations.

seed

Seed for the random generation.

lower.tail

logical; if TRUE, probabilities are \(P[X\leq x]\), otherwise, \(P[X>x]\).

prob

vector of probabilities.

Value

dgig gives the density, pgig gives the distribution function, qgig gives the quantile function, and rgig generates random deviates.

Invalid arguments will result in return value NaN, with a warning.

The length of the result is determined by n for rgig.

Details

The generalised inverse-Gaussian distribution has density given by $$f(x; p, a, b) = ((a/b)^{p/2})/(2K_p(\sqrt{ab})) x^{p-1} \exp\{-(a/2)x - (b/2)/x\},$$ where \(K_p\) is modified Bessel function of the second kind of order \(p\), \(x>0\), \(a,b>0\) and \(p\in\mathbb{R}\). See Jørgensen (1982) for further details.

References

Jørgensen, Bent (1982). Statistical Properties of the Generalized Inverse Gaussian Distribution. Lecture Notes in Statistics. 9. New York–Berlin: Springer-Verlag. doi:10.1007/978-1-4612-5698-4

See also

Examples

rgig(20, p = 1, a = 1, b = 1)
#>  [1] 2.9444838 4.0846094 4.2805053 0.6471970 4.8549447 3.6693253 1.4053631
#>  [8] 0.7797178 4.0738812 0.3014482 2.2481510 6.4813526 1.2021558 1.7445749
#> [15] 2.0771606 0.9553828 2.4208380 1.9821741 5.5704748 4.9754300
pgig(0.4, p = 1, a = 1, b = 1)
#> [1] 0.02956016
qgig(0.8, p = 1, a = 1, b = 1)
#> [1] 4.055929
plot(function(x){dgig(x, p = 1, a = 1, b = 1)}, main =
"Generalised inverse-Gaussian density", ylab = "Probability density",
xlim = c(0,10))