% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/distributions.R
\name{gig}
\alias{gig}
\alias{dgig}
\alias{rgig}
\alias{pgig}
\alias{qgig}
\title{The Generalised Inverse-Gaussian (GIG) Distribution}
\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{
\item{x, q}{vector of quantiles.}

\item{p}{parameter \code{p}.}

\item{a, b}{parameters \code{a} and \code{b}. Must be positive.}

\item{log, log.p}{logical; if \code{TRUE}, probabilities/densities \eqn{p} are
returned as \eqn{log(p)}.}

\item{n, }{number of observations.}

\item{seed}{Seed for the random generation.}

\item{lower.tail}{logical; if \code{TRUE}, probabilities are \eqn{P[X\leq x]},
otherwise, \eqn{P[X>x]}.}

\item{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 \code{n} for rgig.
}
\description{
Density, distribution function, quantile function and
random generation for the generalised inverse-Gaussian distribution
 with parameters \code{p}, \code{a} and \code{b}.
}
\details{
The generalised inverse-Gaussian distribution has density given
by
 \deqn{f(x; p, a, b) = ((a/b)^{p/2})/(2K_p(\sqrt{ab})) x^{p-1} \exp\{-(a/2)x - (b/2)/x\},}
 where \eqn{K_p} is modified Bessel function of the second kind of order \eqn{p},
 \eqn{x>0}, \eqn{a,b>0} and \eqn{p\in\mathbb{R}}.
 See Jørgensen (1982) for further details.
}
\examples{
rgig(20, p = 1, a = 1, b = 1)
pgig(0.4, p = 1, a = 1, b = 1)
qgig(0.8, p = 1, a = 1, b = 1)
plot(function(x){dgig(x, p = 1, a = 1, b = 1)}, main =
"Generalised inverse-Gaussian density", ylab = "Probability density",
xlim = c(0,10))
}
\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}
}
\seealso{
\code{\link{dnig}}, \code{\link{dig}}, \code{\link{digam}}
}
