munb <- 3; size <- 4; pobs0 <- 0.3; x <- (-1):7
dzanegbin(x, munb = munb, size = size, pobs0 = pobs0)
table(rzanegbin(100, munb = munb, size = size, pobs0 = pobs0))
if (FALSE) x <- 0:10
barplot(rbind(dzanegbin(x, munb = munb, size = size, pobs0 = pobs0),
dnbinom(x, mu = munb, size = size)),
beside = TRUE, col = c("blue", "green"), cex.main = 0.7,
ylab = "Probability", names.arg = as.character(x), las = 1,
main = paste0("ZANB(munb = ", munb, ", size = ", size,",
pobs0 = ", pobs0,
") [blue] vs", " NB(mu = ", munb, ", size = ", size,
") [green] densities"))
Run the code above in your browser using DataLab