Zero-Truncated-NegBinomial {countreg} | R Documentation |
Density, distribution function, quantile function, random
generation, score function, hessian, mean, and variance
for the zero-truncated negative binomial
distribution with parameters mu
(= mean of the
untruncated distribution) and dispersion parameter theta
(or equivalently size
).
dztnbinom(x, mu, theta, size, log = FALSE) pztnbinom(q, mu, theta, size, lower.tail = TRUE, log.p = FALSE) qztnbinom(p, mu, theta, size, lower.tail = TRUE, log.p = FALSE) rztnbinom(n, mu, theta, size) sztnbinom(x, mu, theta, size, parameter = c("mu", "theta"), drop = TRUE) hztnbinom(x, mu, theta, size, parameter = c("mu", "theta"), drop = TRUE) mean_ztnbinom(mu, theta, size, drop = TRUE) var_ztnbinom(mu, theta, size, drop = TRUE)
x |
vector of (positive integer) quantiles. |
q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of random values to return. |
mu |
vector of non-negative means of the untruncated negative binomial distribution. |
theta, size |
vector of strictly positive dispersion
parameters (shape parameter of the gamma mixing distribution).
Only one of |
log, log.p |
logical. If |
lower.tail |
logical. If |
parameter |
character. Should the derivative with respect to
|
drop |
logical. Should the result be a matrix ( |
The untruncted negative binomial distribution has density
Γ(x + θ)/(Γ(θ) x!) (μ^y θ^θ)/((μ + θ)^(y + θ)
for x = 0, 1, 2, …. The zero-truncted density is then simply obtained as
g(x) = f(x)/(1 - f(0))
for x = 1, 2, ….
dztnbinom
gives the (log) density,
pztnbinom
gives the (log) distribution function,
qztnbinom
gives the quantile function,
rztnbinom
generates random deviates, and
sztnbinom
gives the score function (= derivative of
the log-density with respect to mu and/or theta).
hztnbinom
gives the hessian (= 2nd derivative of
the log-density with respect to mu and/or theta).
mean_ztnbinom
and var_ztnbinom
give the
mean and the variance, respectively.