ZIP | R Documentation |
Probability mass function and random generation for the zero-inflated Poisson distribution.
dzip(x, lambda, pi, log = FALSE)
pzip(q, lambda, pi, lower.tail = TRUE, log.p = FALSE)
qzip(p, lambda, pi, lower.tail = TRUE, log.p = FALSE)
rzip(n, lambda, pi)
x , q |
vector of quantiles. |
lambda |
vector of (non-negative) means. |
pi |
probability of extra zeros. |
log , log.p |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are |
p |
vector of probabilities. |
n |
number of observations. If |
Probability density function
f(x) = \left\{\begin{array}{ll}
\pi + (1 - \pi) e^{-\lambda} & x = 0 \\
(1 - \pi) \frac{\lambda^{x} e^{-\lambda}} {x!} & x > 0 \\
\end{array}\right.
Poisson
x <- rzip(1e5, 6, 0.33)
xx <- -2:20
plot(prop.table(table(x)), type = "h")
lines(xx, dzip(xx, 6, 0.33), col = "red")
xx <- seq(0, 20, by = 0.01)
plot(ecdf(x))
lines(xx, pzip(xx, 6, 0.33), col = "red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.