Density, distribution function, and random generation for the generally-inflated binomial distribution.
dgenibinom(x, size, prob, inflate = 0, pstr.i = 0, byrow.arg = FALSE,
log.arg = FALSE)
pgenibinom(q, size, prob, inflate = 0, pstr.i = 0, byrow.arg = FALSE)
rgenibinom(n, size, prob, inflate = 0, pstr.i = 0, byrow.arg = FALSE)
Same type of argument as in rbinom
.
Same type of argument as in dbinom
.
vector of nonnegative integers; the inflated values.
Must have unique values only.
A NULL
is acceptable and means an empty set.
Same as rgenipois
.
dgenibinom
gives the density,
pgenibinom
gives the distribution function,
rgenibinom
generates random deviates.
The generally-inflated binomial distribution is a mixture of an
ordinary binomial distribution with
a multinomial distribution.
Certain (inflated) values having some prespecified multinomial
probabilities can have structural values.
Since inflate = 0
and pstr.i = 0
then
the default is an ordinary binomial distribution.
Gentbinom
,
Genabinom
,
dposbinom
,
rbinom
.
# 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