# NOT RUN {
ivec <- c(2, 4) # Inflate these values
pstr.i <- (1:2)/10; size <- 10; prob <- 0.5;
y <- rgenibinom(1000, size, prob, inflate = ivec, pstr.i = pstr.i,
byrow = TRUE)
table(y)
(ii <- dgenibinom(0:11, size, prob, inflate = ivec, pstr.i = pstr.i,
byrow = TRUE))
table(rgenibinom(1000, size, prob, inflate = ivec,
pstr.i = pstr.i, byrow = TRUE))
# }
# NOT RUN {
x <- 0:size
barplot(rbind(dgenibinom(x, size, prob, inflate = ivec,
pstr.i = pstr.i, byrow = TRUE),
dbinom(x, size, prob)),
beside = TRUE, col = c("blue", "orange"),
main = paste("Gen-inf Binom(size = ", size, ", ",
"prob = ", prob, ", ",
"inflate = c(", paste(ivec, collapse = ","),
"), pstr.i = c(", paste(pstr.i, collapse = ","),
"), byrow = TRUE) vs",
" Binom(", size, ", ", prob, ")", sep = ""),
sub = "Generally-inflated binomial is blue; binomial is orange",
names.arg = as.character(x), las = 1, lwd = 2)
# }
Run the code above in your browser using DataLab