Generalized Poisson Distribution (Original Parameterization)
Density, distribution function, quantile function and and random generation for the original parameterization of the generalized Poisson distribution.
dgenpois0(x, theta, lambda = 0, log = FALSE) pgenpois0(q, theta, lambda = 0, lower.tail = TRUE) qgenpois0(p, theta, lambda = 0) rgenpois0(n, theta, lambda = 0, algorithm = c("qgenpois0", "inv", "bup","chdn", "napp", "bran"))
x, q |
Vector of quantiles. |
p |
Vector of probabilities. |
n |
Similar to |
theta, lambda |
See |
lower.tail, log |
Similar to |
algorithm |
Character.
Six choices are available, standing for the
qgenpois0,
inversion, build-up, chop-down,
normal approximation and branching methods.
The first one is the default and
calls |
Most of the background to these functions are given
in genpoisson0
.
Some warnings relevant to this distribution are given there.
The complicated range of the
parameter lambda
when negative is no longer
supported because the distribution is not normalized.
For other GPD variants see Genpois1
.
dgenpois0
gives the density,
pgenpois0
gives the distribution function,
qgenpois0
gives the quantile function, and
rgenpois
generates random deviates.
For some of these functions such as
dgenpois0
and pgenpois0
the value NaN
is returned for elements not satisfying
the parameter restrictions, e.g., if λ > 1.
For some of these functions such as
rgenpois0
the input must not contain NA
s or NaN
s, etc. since
the implemented algorithms are fragile.
These have not been tested thoroughly.
For pgentpois0()
mapply
is called
with 0:q
as input, hence will be very slow and
memory-hungry for large values of q
.
Likewise qgentpois0()
and rgentpois0()
may suffer from the same limitations.
For rgentpois0()
:
(1). "inv"
, "bup"
and "chdn"
appear similar and
seem to work okay.
(2). "napp"
works only when theta is large, away from 0.
It suffers from 0-inflation.
(3). "bran"
has a relatively heavy RHS tail and
requires positive lambda
.
More details can be found in
Famoye (1997) and
Demirtas (2017).
T. W. Yee.
For rgenpois0()
the last 5 algorithms are based on
code written in H. Demirtas (2017) and vectorized by T. W. Yee;
but the "bran"
algorithm was rewritten from
Famoye (1997).
Demirtas, H. (2017). On accurate and precise generation of generalized Poisson variates. Communications in Statistics—Simulation and Computation, 46, 489–499.
Famoye, F. (1997). Generalized Poisson random variate generation. Amer. J. Mathematical and Management Sciences, 17, 219–237.
sum(dgenpois0(0:1000, theta = 2, lambda = 0.5)) ## Not run: theta <- 2; lambda <- 0.2; y <- 0:10 proby <- dgenpois0(y, theta = theta, lambda = lambda, log = FALSE) plot(y, proby, type = "h", col = "blue", lwd = 2, ylab = "Pr(Y=y)", main = paste0("Y ~ GP-0(theta=", theta, ", lambda=", lambda, ")"), las = 1, ylim = c(0, 0.3), sub = "Orange is the Poisson probability function") lines(y + 0.1, dpois(y, theta), type = "h", lwd = 2, col = "orange") ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.