Description Usage Arguments Details Value References See Also Examples
Density, distribution function, quantile function and random generation for the zero inflated Poisson distribution with parameters (rho, lambda).
1 2 3 4 5 6 7 |
x |
A non-negative integer-valued vector of quantiles. |
q |
A numeric vector of quantiles. |
p |
A vector of probabilities. |
n |
Number of random values to return, a length-one positive integer-valued vector. |
rho |
A length-one vector of zero inflation parameter on [0,1]. |
lambda |
A length-one vector of positive means. |
log, log.p |
A length-one logical vector; if TRUE, probabilities p are given as log(p). |
lower.tail |
A length-one logical vector; if TRUE (the default), probabilities are P(X ≤ x), otherwise, P(X > x). |
The probability mass function of X is given by
P(X=x) = rho I(x = 0) + (1 - rho) P(Y=x), x=0,1,2,...,
where Y is distributed Poisson(lambda).
dzipois
gives the (log) density,
pzipois
gives the (log) distribution function,
qzipois
gives the quantile function,
and rzipois
generates random deviates.
Invalid arguments rise an error with a helpful message.
Lambert, D. (1992). Zero-Inflated Poisson Regression, with an Application to Defects in Manufacturing, Technometrics, 34(1), 1-14.
Poisson for the Poisson distribution.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Example 1: dzipois
dzipois(x = 0:10, rho = 0.1, lambda = 5)
# Example 2: pzipois
pzipois(q = 2, rho = 0.1, lambda = 5)
# Example 3: qzipois
qzipois(p = pzipois(2, 0.1, 5), rho = 0.1, lambda = 5)
# Example 4: rzipois
n <- 1e+5
rho <- 0.2
lambda <- 5
mean(rzipois(n, rho, lambda)) # Sample mean
lambda * (1 - rho) # Theoretical mean
|
[1] 0.10606415 0.03032076 0.07580190 0.12633651 0.15792063 0.15792063
[7] 0.13160053 0.09400038 0.05875024 0.03263902 0.01631951
[1] 0.2121868
[1] 2
[1] 4.00825
[1] 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.