View source: R/igp_distributions.R
| d_ig | R Documentation |
Density, distribution function, quantile function, and random generation
for the Inverse Gaussian (Wald) distribution with mean mu and shape/scale
parameter lambda.
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)
x, q |
Numeric vector of quantiles. Must be positive. |
mu |
Mean parameter. Must be strictly positive. Default is |
lambda |
Shape parameter. Must be strictly positive. Default is |
log, log.p |
Logical; if |
lower.tail |
Logical; if |
p |
Numeric vector of probabilities (between 0 and 1). |
n |
Number of observations to generate. Must be a single positive integer. |
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.
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.
Wasan, M. T. (1968). On an inverse Gaussian process. Scandinavian Actuarial Journal, 1968(1-2), 69-96.
igp_fit, sim_igp
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.