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] 0.23598105 0.08006889 0.33919253 0.61672841 0.28186065 0.08434745
#> [7] 0.05161679 0.88082116 1.14277182 0.17594975
#>
#> [[2]]
#> [1] 4.0545783 2.3970749 0.4062618 0.9615467 1.3424244 1.1620347 0.7534668
#> [8] 1.2788239 5.1941938 1.3168952
#>
#> [[3]]
#> [1] 2.9777257 0.3816014 0.5849503 0.3229107 0.8470528 0.8547789 0.6516648
#> [8] 0.2986537 0.8589305 0.5138983
#>
#> [[4]]
#> [1] 0.89911667 0.13454877 0.55805566 0.35584563 0.03372935 0.78571274
#> [7] 1.83868554 11.76129911 0.19872379 13.10506917
#>
#> [[5]]
#> [1] 0.8966069 13.2374730 0.3268188 3.9699604 8.4845770 0.3806452
#> [7] 0.4311800 0.7250842 2.4687375 0.5400341
#>
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