hnbinom {countreg}R Documentation

The Hurdle Negative Binomial Distribution

Description

Density, distribution function, quantile function, random generation, 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).

Usage

dhnbinom(x, mu, theta, size, pi, log = FALSE)
phnbinom(q, mu, theta, size, pi, lower.tail = TRUE, log.p = FALSE)
qhnbinom(p, mu, theta, size, pi, lower.tail = TRUE, log.p = FALSE)
rhnbinom(n, mu, theta, size, pi)
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)

Arguments

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 underlying negative binomial distribution.

theta, size

vector of strictly positive dispersion parameters (shape parameter of the gamma mixing distribution). Only one of theta or size must be specified.

pi

vector of hurdle crossing probabilities (i.e., 1 - pi is the probability for observed zeros).

log, log.p

logical. If TRUE, probabilities p are given as log(p).

lower.tail

logical. If TRUE (default), probabilities are P[X ≤ x], otherwise, P[X > x].

parameter

character. Should the derivative with respect to "mu" and/or "theta" and/or "pi" be computed?

drop

logical. Should the result be a matrix (drop = FALSE) or should the dimension be dropped (drop = TRUE, the default)?

Details

The underlying negative binomial distribution has density

Γ(x + θ)/(Γ(θ) x!) (μ^y θ^θ)/((μ + θ)^(y + θ)

for x = 0, 1, 2, …. The hurdle density is then simply obtained as

g(x) = π f(x)/(1 - f(0))

for x = 1, 2, … and g(0) = 1 - π, respectively.

Value

dhnbinom gives the (log) density, phnbinom gives the (log) distribution function, qhnbinom gives the quantile function, rhnbinom generates random deviates, and 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.

See Also

dnbinom, hurdle


[Package countreg version 0.2-1 Index]