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.5629883 0.2060921 0.3051657 0.1584182 0.7711641 0.3382288 2.7401981
#> [8] 0.1503138 0.2775963 0.5354278
#>
#> [[2]]
#> [1] 0.5425053 0.4850582 0.6875809 0.8270709 0.2505179 0.5801985 2.3554405
#> [8] 0.4080598 0.2229864 1.0349064
#>
#> [[3]]
#> [1] 0.4930204 0.9652834 0.3126297 1.0958621 1.1199505 1.0751993 0.4422182
#> [8] 1.2580362 1.1647260 0.4570859
#>
#> [[4]]
#> [1] 0.75231438 0.24866202 0.08601968 0.18744721 2.33020457 0.07944700
#> [7] 0.44054757 0.08747697 4.58991939 0.10296670
#>
#> [[5]]
#> [1] 1.1630644 0.2300572 4.7381281 5.6722674 0.6759975 3.4006034 0.9060747
#> [8] 1.1232588 5.6278388 0.8298448
#>
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