Learn R Programming

VGAM (version 1.1-6)

Genpois0: Generalized Poisson Distribution (Original Parameterization)

Description

Density, distribution function, quantile function and random generation for the original parameterization of the generalized Poisson distribution.

Usage

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"))

Arguments

x, q

Vector of quantiles.

p

Vector of probabilities.

n

Similar to runif.

theta, lambda

See genpoisson0. The default value of lambda corresponds to an ordinary Poisson distribution. Nonnegative values of lambda are currently required.

lower.tail, log

Similar to Poisson.

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 qgenpois0 with runif as its first argument. The value inputted may be abbreviated, e.g., alg = "n". The last 5 algorithms are a direct implementation of Demirtas (2017) and the relative performance of the algorithms are described there---however, the vectorization here may render the comments on relative speed as no longer holding.

Value

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 \(\lambda > 1\). For some of these functions such as rgenpois0 the input must not contain NAs or NaNs, etc. since the implemented algorithms are fragile.

Warning

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.

Details

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.

References

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.

See Also

genpoisson0, Genpois1, dpois.

Examples

Run this code
# NOT RUN {
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") 
# }

Run the code above in your browser using DataLab