d_ig: Inverse Gaussian Distribution Functions

View source: R/igp_distributions.R

d_igR Documentation

Inverse Gaussian Distribution Functions

Description

Density, distribution function, quantile function, and random generation for the Inverse Gaussian (Wald) distribution with mean mu and shape/scale parameter lambda.

Usage

d_ig(x, mu = 1, lambda = 1, log = FALSE)

p_ig(q, mu = 1, lambda = 1, lower.tail = TRUE, log.p = FALSE)

q_ig(p, mu = 1, lambda = 1, lower.tail = TRUE, log.p = FALSE)

r_ig(n, mu = 1, lambda = 1)

Arguments

x, q

Numeric vector of quantiles. Must be positive.

mu

Mean parameter. Must be strictly positive. Default is 1.

lambda

Shape parameter. Must be strictly positive. Default is 1.

log, log.p

Logical; if TRUE, probabilities/densities are returned on the log scale. Default is FALSE.

lower.tail

Logical; if TRUE (default), probabilities are P[X \le x], otherwise P[X > x].

p

Numeric vector of probabilities (between 0 and 1).

n

Number of observations to generate. Must be a single positive integer.

Details

The probability density function of the Inverse Gaussian distribution is:

f(x; \mu, \lambda) = \sqrt{\frac{\lambda}{2\pi x^3}} \exp\left(-\frac{\lambda (x - \mu)^2}{2\mu^2 x}\right), \quad x > 0

The cumulative distribution function is evaluated using:

F(x; \mu, \lambda) = \Phi\left(\sqrt{\frac{\lambda}{x}}\left(\frac{x}{\mu} - 1\right)\right) + \exp\left(\frac{2\lambda}{\mu}\right) \Phi\left(-\sqrt{\frac{\lambda}{x}}\left(\frac{x}{\mu} + 1\right)\right)

where \Phi(\cdot) is the standard normal cumulative distribution function.

Value

d_ig returns the density, p_ig returns the distribution function, q_ig returns the quantile function, and r_ig returns a vector of random variates of length n.

References

Wasan, M. T. (1968). On an inverse Gaussian process. Scandinavian Actuarial Journal, 1968(1-2), 69-96.

See Also

igp_fit, sim_igp

Examples

# Density and CDF
d_ig(1.5, mu = 2, lambda = 5)
p_ig(1.5, mu = 2, lambda = 5)

# Quantiles and random generation
q_ig(0.5, mu = 2, lambda = 5)
set.seed(123)
r_ig(5, mu = 2, lambda = 5)


IGPFrailty documentation built on Aug. 25, 2026, 9:08 a.m.