Skip to contents

Probability mass function, distribution function, and random generation for the hurdle (zero-altered) Poisson distribution.

Usage

dhpois(x, lambda, zeroprob = 0.5, log = FALSE)

phpois(q, lambda, zeroprob = 0.5, lower.tail = TRUE, log.p = FALSE)

rhpois(n, lambda, zeroprob = 0.5)

Arguments

x, q

integer vector of counts

lambda

vector of (non-negative) means of the underlying Poisson

zeroprob

probability of a zero, between 0 and 1

log, log.p

logical; return log-density if TRUE

lower.tail

logical; if TRUE, probabilities are \(P[X \le x]\), otherwise, \(P[X > x]\).

n

number of random values to return.

Value

dhpois gives the probability mass function, phpois gives the distribution function, and rhpois generates random deviates.

Details

This implementation allows for automatic differentiation with RTMB.

A hurdle distribution models the zeros and the positive counts as two separate processes: the probability of a zero is a free parameter, and the positive counts follow the corresponding zero-truncated distribution. Writing \(p_0\) for zeroprob, $$P(X = 0) = p_0, \qquad P(X = x) = (1 - p_0)\,\frac{P_{\mathrm{Pois}}(x;\,\lambda)}{1 - \pi_0}, \quad x = 1, 2, \ldots$$ where \(\pi_0 = P_{\mathrm{Pois}}(0;\,\lambda)\) is the probability of a zero under the ordinary Poisson.

This differs from the zero-inflated Poisson, where the zeros are a mixture of structural zeros and zeros generated by the Poisson itself. In a hurdle model zeroprob is exactly the probability of observing a zero, so it can be larger or smaller than the Poisson would give on its own; zero-inflation can only ever add zeros. The two coincide with the ordinary Poisson when zeroprob equals \(\pi_0\).

References

Mullahy, J. (1986) Specification and testing of some modified count data models. Journal of Econometrics, 33, 341-365.

Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC, doi:10.1201/9780429298547. An older version can be found in https://www.gamlss.com/.

Examples

set.seed(123)
x <- rhpois(5, lambda = 2, zeroprob = 0.4)
d <- dhpois(x, lambda = 2, zeroprob = 0.4)
p <- phpois(x, lambda = 2, zeroprob = 0.4)