hnbinom-extensions | R Documentation |
Score function, hessian, mean, and, variance
for the (zero-)hurdle negative binomial
distribution with parameters mu
(= mean of the
underlying negative binomial distribution), dispersion parameter theta
(or equivalently size
), and hurdle crossing probability
pi
(i.e., 1 - pi
is the probability for observed zeros).
shnbinom(x, mu, theta, size, pi, parameter = c("mu", "theta", "pi"), drop = TRUE)
hhnbinom(x, mu, theta, size, pi, parameter = c("mu", "theta", "pi"), drop = TRUE)
mean_hnbinom(mu, theta, size, pi, drop = TRUE)
var_hnbinom(mu, theta, size, pi, drop = TRUE)
x |
vector of (positive integer) quantiles. |
mu |
vector of non-negative means of the underlying negative binomial distribution. |
theta, size |
vector of strictly positive dispersion
parameters (shape parameter of the gamma mixing distribution).
Only one of |
pi |
vector of hurdle crossing probabilities (i.e., |
parameter |
character. Should the derivative with respect to
|
drop |
logical. Should the result be a matrix ( |
The underlying 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 hurdle density is then simply obtained as
g(x) = \pi \cdot \frac{f(x)}{1 - f(0)}
for x = 1, 2, \ldots
and g(0) = 1 - \pi
, respectively.
shnbinom
gives the score function (= derivative of
the log-density with respect to mu and/or theta and/or pi).
hhnbinom
gives the hessian (= 2nd derivative of
the log-density with respect to mu and/or theta and/or pi).
mean_hnbinom
and var_hnbinom
give the mean
and the variance, respectively.
dhnbinom
, dnbinom
, hurdle
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.