size <- 10; prob <- 0.15; pobs0 <- 0.05; x <- (-1):7
dzabinom(x, size = size, prob = prob, pobs0 = pobs0)
table(rzabinom(100, size = size, prob = prob, pobs0 = pobs0))
if (FALSE) x <- 0:10
barplot(rbind(dzabinom(x, size = size, prob = prob, pobs0 = pobs0),
dbinom(x, size = size, prob = prob)),
beside = TRUE, col = c("blue", "orange"), cex.main = 0.7, las = 1,
ylab = "Probability", names.arg = as.character(x),
main = paste("ZAB(size = ", size, ", prob = ", prob, ", pobs0 = ", pobs0,
") [blue] vs", " Binom(size = ", size, ", prob = ", prob,
") [orange] densities", sep = ""))
Run the code above in your browser using DataLab