munb = 3; size = 4; p0 = 0.3
x = (-1):7
(ii = dzanegbin(x, p0=p0, munb=munb, size=size))
table(rzanegbin(100, p0=p0, munb=munb, size=size))
x = 0:10
barplot(rbind(dzanegbin(x, p0=p0, munb=munb, size=size),
dnbinom(x, mu=munb, size=size)),
beside = TRUE, col = c("blue","green"),
main=paste("ZANB(p0=", p0, ", munb=", munb, ", size=", size, ") (blue) vs",
" NB(mu=", munb, ", size=", size, ") (green)", sep=""),
names.arg = as.character(x), cex.main=0.7, las=1)
Run the code above in your browser using DataLab