Zanegbin | R Documentation |
Density, distribution function, quantile function and random
generation for the zero-altered negative binomial distribution
with parameter pobs0
.
dzanegbin(x, size, munb, pobs0 = 0, log = FALSE)
pzanegbin(q, size, munb, pobs0 = 0)
qzanegbin(p, size, munb, pobs0 = 0)
rzanegbin(n, size, munb, pobs0 = 0)
x , q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations.
If |
size , munb , log |
Parameters from the ordinary negative binomial distribution
(see |
pobs0 |
Probability of zero, called |
The probability function of Y
is 0 with
probability pobs0
, else a positive negative
binomial(\mu_{nb}
, size) distribution.
dzanegbin
gives the density and
pzanegbin
gives the distribution function,
qzanegbin
gives the quantile function, and
rzanegbin
generates random deviates.
The argument pobs0
is recycled to the required length,
and must have values which lie in the interval [0,1]
.
T. W. Yee
Gaitdnbinom
,
zanegbinomial
.
munb <- 3; size <- 4; pobs0 <- 0.3; x <- (-1):7
dzanegbin(x, munb = munb, size = size, pobs0 = pobs0)
table(rzanegbin(100, munb = munb, size = size, pobs0 = pobs0))
## Not run: x <- 0:10
barplot(rbind(dzanegbin(x, munb = munb, size = size, pobs0 = pobs0),
dnbinom(x, mu = munb, size = size)),
beside = TRUE, col = c("blue", "green"), cex.main = 0.7,
ylab = "Probability", names.arg = as.character(x), las = 1,
main = paste0("ZANB(munb = ", munb, ", size = ", size,",
pobs0 = ", pobs0,
") [blue] vs", " NB(mu = ", munb, ", size = ", size,
") [green] densities"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.