dist_inverse_gaussian(mean, shape)The inverse Gaussian distribution (also known as the Wald distribution) is commonly used to model positive-valued data, particularly in contexts involving first passage times and reliability analysis.
We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_inverse_gaussian.html
In the following, let \(X\) be an Inverse Gaussian random variable with
parameters mean = \(\mu\) and shape = \(\lambda\).
Support: \((0, \infty)\)
Mean: \(\mu\)
Variance: \(\frac{\mu^3}{\lambda}\)
Probability density function (p.d.f):
$$ f(x) = \sqrt{\frac{\lambda}{2\pi x^3}} \exp\left(-\frac{\lambda(x - \mu)^2}{2\mu^2 x}\right) $$
Cumulative distribution function (c.d.f):
$$ F(x) = \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\) is the standard normal c.d.f.
Moment generating function (m.g.f):
$$ E(e^{tX}) = \exp\left(\frac{\lambda}{\mu} \left(1 - \sqrt{1 - \frac{2\mu^2 t}{\lambda}}\right)\right) $$
for \(t < \frac{\lambda}{2\mu^2}\).
Skewness: \(3\sqrt{\frac{\mu}{\lambda}}\)
Excess Kurtosis: \(\frac{15\mu}{\lambda}\)
Quantiles: No closed-form expression, approximated numerically.
dist <- dist_inverse_gaussian(mean = c(1,1,1,3,3), shape = c(0.2, 1, 3, 0.2, 1))
dist
#> <distribution[5]>
#> [1] IG(1, 0.2) IG(1, 1) IG(1, 3) IG(3, 0.2) IG(3, 1)
mean(dist)
#> [1] 1 1 1 3 3
variance(dist)
#> [1] 5.0000000 1.0000000 0.3333333 135.0000000 27.0000000
support(dist)
#> <support_region[5]>
#> [1] (0,Inf) (0,Inf) (0,Inf) (0,Inf) (0,Inf)
generate(dist, 10)
#> [[1]]
#> [1] 2.45910676 0.22123262 6.23823209 0.07104196 1.43460040 0.27032112
#> [7] 0.08382297 0.09609657 0.17263381 0.77774388
#>
#> [[2]]
#> [1] 0.3447946 0.3647296 0.9320376 1.3150448 1.2403870 1.1067591 0.2944853
#> [8] 0.6407613 1.9933257 0.2436676
#>
#> [[3]]
#> [1] 2.1713439 1.5791784 2.0057523 0.5730838 2.1741722 1.0552754 0.8085446
#> [8] 1.1075496 0.4146280 0.9146648
#>
#> [[4]]
#> [1] 0.15463674 0.09635198 0.02577096 0.13144778 0.35719306 0.31748801
#> [7] 1.30775876 0.24429247 0.03457133 1.07472814
#>
#> [[5]]
#> [1] 4.8541029 0.3861106 2.0027913 0.8479234 0.3214063 1.6236676 3.8844699
#> [8] 0.6171115 7.8789276 1.2210913
#>
density(dist, 2)
#> [1] 0.06000195 0.10984782 0.11539974 0.06272885 0.13718333
density(dist, 2, log = TRUE)
#> [1] -2.813378 -2.208659 -2.159353 -2.768934 -1.986437
cdf(dist, 4)
#> [1] 0.9454196 0.9790764 0.9983186 0.8735512 0.8031695
quantile(dist, 0.7)
#> [1] 0.6758386 1.0851197 1.1505484 1.0143030 2.5216357