Density, distribution function, quantile function and
random generation for the generalised inverse-Gaussian distribution
with parameters p, a and b.
Usage
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
aandb. 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
Examples
rgig(20, p = 1, a = 1, b = 1)
#> [1] 0.8371749 4.2583339 3.3348899 3.3637128 2.6043964 3.4143659 1.9964603
#> [8] 7.5728501 1.2962493 1.9688975 0.2980122 2.2294513 1.7538838 3.0586088
#> [15] 1.2440944 0.1941158 6.2979916 4.8480040 0.1793622 2.8950139
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))
