zip {bizicount} R Documentation

## The zero-inflated Poisson (ZIP) distribution

### Description

These functions are used to evaluate the zero-inflated Poisson distribution's probability mass function (PMF), cumulative distribution function (CDF), and quantile function (inverse CDF), as well as generate random realizations from the ZIP distribution.

### Usage

dzip(x, lambda, psi, log = FALSE, recycle = FALSE)

rzip(n, lambda, psi, recycle = FALSE)

pzip(q, lambda, psi, lower.tail = TRUE, log.p = FALSE, recycle = FALSE)

qzip(p, lambda, psi, lower.tail = TRUE, log.p = FALSE, recycle = FALSE)


### Arguments

 x, q Vector of quantiles at which to evaluate the PMF and CDF, respectively. Should be non-negative integers. lambda Vector of means for the count portion of the zero-inflated Poisson distribution. Should be non-negative. NOTE: This is not the mean of the zero-inflated Poisson distribution; it is the mean of the Poisson component of the mixture distribution. See 'Details.' psi Vector of zero-inflation probabilities. log, log.p Logical indicating whether probabilities should be returned on log scale (for dzip and pzip), or are supplied on log-scale (for qzip). recycle Logical indicating whether to permit arbitrary recycling of arguments with unequal length. See 'Details' and 'Examples.' n Number of realizations from the distribution to generate lower.tail Logical indicating whether probabilities should be Pr(X \le x) or Pr(X > x) p Vector of probabilities at which to evaluate the quantile function.

### Details

The zero inflated Poisson distribution is a mixture of a Poisson and a degenerate point-mass at 0. It has the form

\psi + (1-\psi)(\lambda^x e^-\lambda)/x!

, with mean (1-\psi)\lambda. Thus, the parameter lambda above is the mean of the Poisson distribution that forms part of the zero-inflated distribution, not the mean of the ZIP distribution.

recycle – If FALSE (default), all arguments must have identical length, there can be two unique lengths for the arguments, provided that one of those lengths is 1. For example, lambda = c(1,2,3) and psi=.5 is acceptable because there are two unique lengths, and one of them is length 1. However, lambda=c(1,2,3) and psi=c(.5,.2) would fail, as there are two distinct lengths, none of which is 1. If ⁠TRUE,⁠ no additional checks (beyond those in base R's functions) are made to ensure that the argument vectors have the same length.

### Value

dzip returns the mass function evaluated at x, pzip returns the CDF evaluated at q, qzip returns the quantile function evaluated at p, and rzip returns random variates with the specified parameters.

John Niehaus

### References

Lambert, Diane. "Zero-inflated Poisson regression, with an application to defects in manufacturing." Technometrics 34.1 (1992): 1-14.

### Examples

# Unequal lengths, but one of them is length 1, others are same length (3).
# No error.

x = c(1,2,3)
lambda = c(3,4,5)
psi = .1

dzip(x, lambda, psi)

# unequal lengths, at least one of them is not length 1,
# error

## Not run:

x = c(1,2,3)
lambda = c(3,4)
psi = .1

dzip(x, lambda, psi)

## End(Not run)

# unequal lengths, at least one of them is not length 1.
# but set recycle = T to permit arbitrary recycling.

x = c(1,2,3)
lambda = c(3,4)
psi = .1

dzip(x, lambda, psi, recycle=TRUE)


[Package bizicount version 1.3.2 Index]