# NOT RUN {
avec <- 2:4 # Alter these values
pobs.a <- (1:3)/10; size <- 10; prob <- 0.5;
y <- rgenabinom(1000, size, prob, alter = avec,
pobs.a = pobs.a, byrow = TRUE)
table(y)
(ii <- dgenabinom(0:7, size, prob, alter = avec,
pobs.a = pobs.a, byrow = TRUE))
table(rgenabinom(100, size, prob, alter = avec,
pobs.a = pobs.a, byrow = TRUE))
# }
# NOT RUN {
x <- 0:size
barplot(rbind(dgenabinom(x, size, prob, alter = avec, pobs.a = pobs.a,
byrow = TRUE),
dbinom(x, size, prob)),
beside = TRUE, col = c("blue", "orange"),
main = paste("Gen-alt Binom(size = ", size, ", ",
"prob = ", prob, ", ",
"alter = c(", paste(avec, collapse = ","),
"), pobs.a = c(", paste(pobs.a, collapse = ","),
"), byrow = TRUE) vs",
" Binom(", size, ", ", prob, ")", sep = ""),
sub = "Generally-altered binomial is blue; binomial is orange",
names.arg = as.character(x), las = 1, lwd = 2)
# }
Run the code above in your browser using DataLab