PoissonInverseGaussian | R Documentation |
Density function, distribution function, quantile function and random
generation for the Poisson-inverse Gaussian discrete distribution with
parameters mean
and shape
.
dpoisinvgauss(x, mean, shape = 1, dispersion = 1/shape,
log = FALSE)
ppoisinvgauss(q, mean, shape = 1, dispersion = 1/shape,
lower.tail = TRUE, log.p = FALSE)
qpoisinvgauss(p, mean, shape = 1, dispersion = 1/shape,
lower.tail = TRUE, log.p = FALSE)
rpoisinvgauss(n, mean, shape = 1, dispersion = 1/shape)
x |
vector of (positive integer) quantiles. |
q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations. If |
mean, shape |
parameters. Must be strictly positive. Infinite values are supported. |
dispersion |
an alternative way to specify the shape. |
log, log.p |
logical; if |
lower.tail |
logical; if |
The Poisson-inverse Gaussian distribution is the result of the continuous mixture between a Poisson distribution and an inverse Gaussian, that is, the distribution with probability mass function
%
p(x) = \int_0^\infty \frac{\lambda^x e^{-\lambda}}{x!}\,
g(\lambda; \mu, \phi)\, d\lambda,
where g(\lambda; \mu, \phi)
is the density
function of the inverse Gaussian distribution with parameters
mean
= \mu
and dispersion
= \phi
(see
dinvgauss
).
The resulting probability mass function is
%
p(x) = \sqrt{\frac{2}{\pi \phi}}
\frac{e^{(\phi\mu)^{-1}}}{x!}
\left(
\sqrt{2\phi\left(1 + \frac{1}{2\phi\mu^2}\right)}
\right)^{-(x - \frac{1}{2})}
K_{x - \frac{1}{2}}
\left(
\sqrt{\frac{2}{\phi}\left(1 + \frac{1}{2\phi\mu^2}\right)}
\right),
for x = 0, 1, \dots
, \mu > 0
, \phi > 0
and where
K_\nu(x)
is the modified Bessel function of the third
kind implemented by R's besselK()
and defined in its
help.
The limiting case \mu = \infty
has well defined
probability mass and distribution functions, but has no finite
strictly positive, integer moments. The pmf in this case reduces to
%
p(x) = \sqrt{\frac{2}{\pi \phi}}
\frac{1}{x!}
(\sqrt{2\phi})^{-(x - \frac{1}{2})}
K_{x - \frac{1}{2}}(\sqrt{2/\phi}).
The limiting case \phi = 0
is a degenerate distribution in
x = 0
.
If an element of x
is not integer, the result of
dpoisinvgauss
is zero, with a warning.
The quantile is defined as the smallest value x
such that
F(x) \ge p
, where F
is the distribution function.
dpoisinvgauss
gives the probability mass function,
ppoisinvgauss
gives the distribution function,
qpoisinvgauss
gives the quantile function, and
rpoisinvgauss
generates random deviates.
Invalid arguments will result in return value NaN
, with a warning.
The length of the result is determined by n
for
rpoisinvgauss
, and is the maximum of the lengths of the
numerical arguments for the other functions.
[dpqr]pig
are aliases for [dpqr]poisinvgauss
.
qpoisinvgauss
is based on qbinom
et al.; it uses the
Cornish–Fisher Expansion to include a skewness correction to a normal
approximation, followed by a search.
Vincent Goulet vincent.goulet@act.ulaval.ca
Holla, M. S. (1966), “On a Poisson-Inverse Gaussian Distribution”, Metrika, vol. 15, p. 377-384.
Johnson, N. L., Kemp, A. W. and Kotz, S. (2005), Univariate Discrete Distributions, Third Edition, Wiley.
Klugman, S. A., Panjer, H. H. and Willmot, G. E. (2012), Loss Models, From Data to Decisions, Fourth Edition, Wiley.
Shaban, S. A., (1981) “Computation of the poisson-inverse gaussian distribution”, Communications in Statistics - Theory and Methods, vol. 10, no. 14, p. 1389-1399.
dpois
for the Poisson distribution,
dinvgauss
for the inverse Gaussian distribution.
## Tables I and II of Shaban (1981)
x <- 0:2
sapply(c(0.4, 0.8, 1), dpoisinvgauss, x = x, mean = 0.1)
sapply(c(40, 80, 100, 130), dpoisinvgauss, x = x, mean = 1)
qpoisinvgauss(ppoisinvgauss(0:10, 1, dis = 2.5), 1, dis = 2.5)
x <- rpoisinvgauss(1000, 1, dis = 2.5)
y <- sort(unique(x))
plot(y, table(x)/length(x), type = "h", lwd = 2,
pch = 19, col = "black", xlab = "x", ylab = "p(x)",
main = "Empirical vs theoretical probabilities")
points(y, dpoisinvgauss(y, 1, dis = 2.5),
pch = 19, col = "red")
legend("topright", c("empirical", "theoretical"),
lty = c(1, NA), pch = c(NA, 19), col = c("black", "red"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.