zinb | R Documentation |
These functions are used to evaluate the zero-inflated negative binomial distribution's probability mass function (PMF), cumulative distribution function (CDF), and quantile function (inverse CDF), as well as generate random realizations from the ZINB distribution.
dzinb(
x,
size,
psi,
mu = NULL,
prob = NULL,
lower.tail = TRUE,
log = FALSE,
recycle = FALSE
)
pzinb(
q,
size,
psi,
mu = NULL,
prob = NULL,
lower.tail = TRUE,
log.p = FALSE,
recycle = FALSE
)
qzinb(
p,
size,
psi,
mu = NULL,
prob = NULL,
lower.tail = TRUE,
log.p = FALSE,
recycle = FALSE
)
rzinb(n, size, psi, mu = NULL, prob = NULL, recycle = FALSE)
x , q |
Vector of quantiles at which to evaluate the PMF and CDF, respectively. Should be non-negative integers. |
size |
The inverse dispersion parameter, or number of successful trials,
both for the negative binomial portion of the ZINB mixture distribution.
See |
psi |
Vector of zero-inflation probabilities. |
mu |
Vector of means for the count portion of the zero-inflated negative
binomial distribution. Only one of |
prob |
The probability of success on each trial in the negative binomial portion of the mixture distribution. Only one of |
lower.tail |
Logical indicating whether probabilities should be
|
log , log.p |
Logical indicating whether probabilities should be returned
on log scale (for |
recycle |
Logical indicating whether to permit arbitrary recycling of arguments with unequal length. See 'Details' and 'Examples.' |
p |
Vector of probabilities at which to evaluate the quantile function. |
n |
Number of realizations to generate from the distribution |
dzinb
returns the mass function evaluated at x
,
pzinb
returns the CDF evaluated at q
, qzinb
returns the quantile
function evaluated at p
, and rzinb
returns random realizations with the
specified parameters.
John Niehaus
Lambert, Diane. "Zero-inflated Poisson regression, with an application to defects in manufacturing." Technometrics 34.1 (1992): 1-14.
# zero-inflated negative binomial examples
# two unique lengthed arguments, one is length 1 though. No error.
dzinb(4, size=.25, mu= c(1,2,3), psi=c(.2, .1, .15))
# two unique lengthed arguments, one of them is not length 1
# error
## Not run:
dzinb(5, size=c(.25, .3), mu= c(1,2,3), psi=c(.2, .1, .15))
## End(Not run)
# two unique lengthed arguments, one of them is not length 1, set
# recycle = T, no error but can give innacurate results.
dzinb(5, size=c(.25, .3), mu= c(1,2,3), psi=c(.2, .1, .15), recycle=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.