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] 1.07894455 0.05112690 0.69507722 0.10781494 0.57541102 0.09775904
#> [7] 0.72425693 0.07744470 0.10488366 0.09774076
#>
#> [[2]]
#> [1] 1.0330900 1.2194419 1.5121365 0.4924413 0.5988697 0.2933520 1.0504641
#> [8] 0.7213668 2.0456752 0.9375396
#>
#> [[3]]
#> [1] 0.6901486 0.8387251 1.2387743 0.3433376 0.8834727 1.2280810 1.8763944
#> [8] 0.6190475 0.6404522 0.3534244
#>
#> [[4]]
#> [1] 0.15942589 5.80762232 0.27330751 0.85670028 0.07813360 0.02977769
#> [7] 0.69785683 2.37435832 0.03764314 1.82086238
#>
#> [[5]]
#> [1] 24.364550 1.004793 5.051222 1.274559 1.807814 7.478857 4.792405
#> [8] 1.021880 0.892786 8.178590
#>
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