ztnbinom-extensions | R Documentation |
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
).
sztnbinom(x, mu, theta, size, parameter = c("mu", "theta", "size"), 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. |
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 |
parameter |
character. Should the derivative with respect to
|
drop |
logical. Should the result be a matrix ( |
The untruncated negative binomial distribution has density
f(x) =
\frac{\Gamma(x + \theta)}{\Gamma(\theta) x!} \cdot \frac{\mu^y \theta^\theta}{(\mu + \theta)^{y + \theta}}
for x = 0, 1, 2, \ldots
. The zero-truncated density is then simply obtained as
g(x) = \frac{f(x)}{1 - f(0)}
for x = 1, 2, \ldots
.
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.
dztnbinom
, dnbinom
, zerotrunc
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.