prob <- 0.2; size <- 10; pstr0 <- 0.5
(ii <- dzibinom(0:size, size, prob, pstr0 = pstr0))
max(abs(cumsum(ii) - pzibinom(0:size, size, prob, pstr0 = pstr0))) # 0?
table(rzibinom(100, size, prob, pstr0 = pstr0))
table(qzibinom(runif(100), size, prob, pstr0 = pstr0))
round(dzibinom(0:10, size, prob, pstr0 = pstr0) * 100) # Similar?
if (FALSE) x <- 0:size
barplot(rbind(dzibinom(x, size, prob, pstr0 = pstr0),
dbinom(x, size, prob)),
beside = TRUE, col = c("blue", "green"), ylab = "Probability",
main = paste0("ZIB(", size, ", ", prob, ", pstr0 = ", pstr0, ")",
" (blue) vs Binomial(", size, ", ", prob, ") (green)"),
names.arg = as.character(x), las = 1, lwd = 2)
Run the code above in your browser using DataLab