phi
.dzibinom(x, size, prob, log = FALSE, phi = 0)
pzibinom(q, size, prob, lower.tail = TRUE, log.p = FALSE, phi = 0)
qzibinom(p, size, prob, lower.tail = TRUE, log.p = FALSE, phi = 0)
rzibinom(n, size, prob, phi = 0)
zibinomial
.pbinom
.dzibinom
gives the density,
pzibinom
gives the distribution function,
qzibinom
gives the quantile function, and
rzibinom
generates random deviates.zibinomial
,
dbinom
.prob = 0.2; size = 10; phi = 0.5
(ii = dzibinom(0:size, size, prob, phi = phi))
max(abs(cumsum(ii) - pzibinom(0:size, size, prob, phi = phi))) # Should be 0
table(rzibinom(100, size, prob, phi = phi))
table(qzibinom(runif(100), size, prob, phi = phi))
round(dzibinom(0:10, size, prob, phi = phi) * 100) # Should be similar
x = 0:size
barplot(rbind(dzibinom(x, size, prob, phi = phi),
dbinom(x, size, prob)),
beside = TRUE, col = c("blue", "green"), ylab = "Probability",
main = paste("ZIB(", size, ", ", prob, ", phi = ", phi, ") (blue) vs",
" Binomial(", size, ", ", prob, ") (green)", sep=""),
names.arg = as.character(x), las = 1, lwd = 2)
Run the code above in your browser using DataLab