Zipois {VGAM} | R Documentation |
Density, distribution function, quantile function and random generation
for the zero-inflated Poisson distribution with parameter phi
.
dzipois(x, lambda, phi = 0) pzipois(q, lambda, phi = 0) qzipois(p, lambda, phi = 0) rzipois(n, lambda, phi = 0)
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.
|
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).
dzipois
gives the density,
pzipois
gives the distribution function,
qzipois
gives the quantile function, and
rzipois
generates random deviates.
The argument phi
is recycled to the required length, and
must have values which lie in the interval [0,1].
Thomas W. Yee
lambda = 3 phi = 0.2 (i = dzipois(0:7, lambda, phi)) cumsum(i) - pzipois(0:7, lambda, phi) # Should be 0s 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","green"), main=paste("ZIP(", lambda, ", phi=", phi, ") (blue) vs", " Poisson(", lambda, ") (green)", sep=""), names.arg = as.character(x)) ## End(Not run)