R/dist_poisson_inverse_gaussian.R
dist_poisson_inverse_gaussian.RdThe Poisson-Inverse Gaussian distribution is a compound Poisson distribution where the rate parameter follows an Inverse Gaussian distribution. It is useful for modeling overdispersed count data.
dist_poisson_inverse_gaussian(mean, shape)We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_poisson_inverse_gaussian.html
In the following, let \(X\) be a Poisson-Inverse Gaussian random variable
with parameters mean = \(\mu\) and shape = \(\phi\).
Support: \(\{0, 1, 2, 3, ...\}\)
Mean: \(\mu\)
Variance: \(\frac{\mu}{\phi}(\mu^2 + \phi)\)
Probability mass function (p.m.f):
$$ P(X = x) = \frac{e^{\phi}}{\sqrt{2\pi}} \left(\frac{\phi}{\mu^2}\right)^{x/2} \frac{1}{x!} \int_0^\infty u^{x-1/2} \exp\left(-\frac{\phi u}{2} - \frac{\phi}{2\mu^2 u}\right) du $$
for \(x = 0, 1, 2, \ldots\)
Cumulative distribution function (c.d.f):
$$ P(X \le x) = \sum_{k=0}^{\lfloor x \rfloor} P(X = k) $$
The c.d.f does not have a closed form and is approximated numerically.
Moment generating function (m.g.f):
$$ E(e^{tX}) = \exp\left\{\phi\left[1 - \sqrt{1 - \frac{2\mu^2}{\phi}(e^t - 1)}\right]\right\} $$
for \(t < -\log(1 + \phi/(2\mu^2))\)
dist <- dist_poisson_inverse_gaussian(mean = rep(0.1, 3), shape = c(0.4, 0.8, 1))
dist
#> <distribution[3]>
#> [1] PIG(0.1, 0.4) PIG(0.1, 0.8) PIG(0.1, 1)
mean(dist)
#> [1] 0.1 0.1 0.1
variance(dist)
#> [1] 0.10250 0.10125 0.10100
support(dist)
#> <support_region[3]>
#> [1] N0 N0 N0
generate(dist, 10)
#> [[1]]
#> [1] 0 0 0 0 0 0 0 0 0 0
#>
#> [[2]]
#> [1] 0 0 0 0 0 0 0 0 0 1
#>
#> [[3]]
#> [1] 0 0 0 1 0 2 0 0 0 0
#>
density(dist, 2)
#> [1] 0.005366518 0.004961863 0.004877069
density(dist, 2, log = TRUE)
#> [1] -5.227576 -5.305974 -5.323211
cdf(dist, 4)
#> [1] 0.9999994 0.9999998 0.9999998
quantile(dist, 0.7)
#> [1] 0 0 0