Probability mass function and random generation for the zero-inflated binomial distribution.
dzib(x, size, prob, pi, log = FALSE)pzib(q, size, prob, pi, lower.tail = TRUE, log.p = FALSE)
qzib(p, size, prob, pi, lower.tail = TRUE, log.p = FALSE)
rzib(n, size, prob, pi)
vector of quantiles.
number of trials (zero or more).
probability of success in each trial. 0 < prob <= 1
.
probability of extra zeros.
logical; if TRUE, probabilities p are given as log(p).
logical; if TRUE (default), probabilities are
vector of probabilities.
number of observations. If length(n) > 1
,
the length is taken to be the number required.
Probability density function
x <- rzib(1e5, 10, 0.6, 0.33)
xx <- -2:20
plot(prop.table(table(x)), type = "h")
lines(xx, dzib(xx, 10, 0.6, 0.33), col = "red")
xx <- seq(0, 20, by = 0.01)
plot(ecdf(x))
lines(xx, pzib(xx, 10, 0.6, 0.33), col = "red")
Run the code above in your browser using DataLab