Zipois {VGAM}R Documentation

Zero-Inflated Poisson Distribution

Description

Density, distribution function, quantile function and random generation for the zero-inflated Poisson distribution with parameter phi.

Usage

dzipois(x, lambda, phi = 0, log = FALSE)
pzipois(q, lambda, phi = 0)
qzipois(p, lambda, phi = 0)
rzipois(n, lambda, phi = 0)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

number of observations. Must be a single positive integer.

lambda

Vector of positive means.

phi

Probability of zero (ignoring the Poisson distribution), called phi. The default value of phi = 0 corresponds to the response having an ordinary Poisson distribution.

log

Logical. Return the logarithm of the answer?

Details

The probability function of Y is 0 with probability phi, and Poisson(lambda) with probability 1-phi. Thus

P(Y=0) = phi + (1-phi) * P(W=0)

where W is distributed Poisson(lambda).

Value

dzipois gives the density, pzipois gives the distribution function, qzipois gives the quantile function, and rzipois generates random deviates.

Note

The argument phi is recycled to the required length, and must have values which lie in the interval [0,1].

Author(s)

Thomas W. Yee

See Also

zipoisson, dpois, rzinegbin.

Examples

lambda = 3; phi = 0.2; x = (-1):7
(ii = dzipois(x, lambda, phi))
max(abs(cumsum(ii) - pzipois(x, lambda, phi))) # Should be 0
table(rzipois(100, lambda, phi))

table(qzipois(runif(100), lambda, phi))
round(dzipois(0:10, lambda, phi) * 100) # Should be similar

## Not run:  x = 0:10
barplot(rbind(dzipois(x, lambda, phi), dpois(x, lambda)),
        beside = TRUE, col = c("blue","orange"),
        main = paste("ZIP(", lambda, ", phi = ", phi, ") (blue) vs",
                     " Poisson(", lambda, ") (orange)", sep = ""),
        names.arg = as.character(x)) 
## End(Not run)

[Package VGAM version 0.8-4 Index]