Learn R Programming

VGAM (version 1.1-1)

dgenpois: The Generalized Poisson Distribution

Description

Density for the Generalized Poisson Distribution.

Usage

dgenpois(x, lambda = 0, theta, log = FALSE)

Arguments

x,

vector of quantiles.

lambda, theta

See genpoisson. The default value of lambda corresponds to an ordinary Poisson distribution.

log

Logical. If TRUE then the logarithm of the density is returned.

Value

dgenpois gives the density. The value NaN is returned for elements not satisfying the parameter restrictions, e.g., if \(\lambda > 1\).

Details

Most of the background to this function is given in genpoisson. Some warnings relevant to this distribution are given there, especially relating to the complicated range of the parameter lambda about or near \(-1\).

Note that numerical round off errors etc. can occur; see below for an example.

See Also

genpoisson, dpois.

Examples

Run this code
# NOT RUN {
sum(dgenpois(0:1000, lambda = -0.5, theta = 2))  # Not perfect...
# }
# NOT RUN {
lambda <- -0.2; theta <- 2; y <- 0:10
proby <- dgenpois(y, lambda = lambda, theta = theta, log = FALSE)
plot(y, proby, type = "h", col = "blue", lwd = 2, ylab = "P[Y=y]",
     main = paste("Y ~ Generalized Poisson(lambda=", lambda,
                  ", theta=", theta, ")", sep = ""), las = 1,
     sub = "Orange is the Poisson probability function")
sum(proby)
lines(y + 0.1, dpois(y, theta), type = "h", lwd = 2, col = "orange")
# }

Run the code above in your browser using DataLab