Learn R Programming

glmmTMB (version 1.1.15.2)

dgenpois: The Generalized Poisson Distribution

Description

Density, cumulative density, random-deviate functions for the generalized Poisson distribution.

Usage

dgenpois(x, lambda1, lambda2, log = FALSE)

pgenpois(q, lambda1, lambda2, lower.tail = TRUE, log.p = FALSE)

rgenpois(n, lambda1, lambda2)

Value

dgenpois gives the density, pgenpois gives the cumulative distribution function, and rgenpois generates random deviates.

Arguments

x

a vector of (non-negative integer) quantiles

lambda1

a single numeric value for parameter lambda1 with \(lambda1 > 0\)

lambda2

a single numeric value for parameter lambda2 with \(-1 \le lambda2 < 1\). When lambda2=0, the generalized Poisson distribution reduces to the Poisson distribution

log

logical; if TRUE, the log-density is returned

q

a numeric vector of quantiles

lower.tail

logical; if TRUE (default), probabilities are \(P(X \le q)\).

log.p

logical; if TRUE, probabilities are returned on the log scale.

n

number of random deviates to draw

Author

Based on Joe and Zhu (2005). Original implementation by Vitali Witowski (2013).

Details

The generalized Poisson distribution has the density $$ p(x) = \lambda_1 (\lambda_1 + \lambda_2 \cdot x)^{x-1} \frac{ \exp(-\lambda_1-\lambda_2 \cdot x) )}{x!}$$ for \(x = 0,1,2,\ldots\), with \(\mbox{E}(X)= \frac{\lambda_1}{1-\lambda_2}\) and variance \(\mbox{var}(X)=\frac{\lambda_1}{(1-\lambda_2)^3}\).

References

Joe, H., Zhu, R. (2005). Generalized Poisson distribution: the property of mixture of Poisson and comparison with negative binomial distribution. Biometrical Journal 47(2):219--229.

See Also

Distributions for other standard distributions, including dpois for the Poisson distribution.

Examples

Run this code
dgenpois(x = seq(0, 20), lambda1 = 10, lambda2 = 0.5)
pgenpois(q = 5, lambda1 = 10, lambda2 = 0.5)
set.seed(101)
hist(rgenpois(n = 1000, lambda1 = 10, lambda2 = 0.5))

Run the code above in your browser using DataLab