zipois {attrCUSUM}R Documentation

The Zero Inflated Poisson Distribution

Description

Density, distribution function, quantile function and random generation for the zero inflated Poisson distribution with parameters (rho, lambda).

Usage

dzipois(x, rho, lambda, log = FALSE)

pzipois(q, rho, lambda, lower.tail = TRUE, log.p = FALSE)

qzipois(p, rho, lambda, lower.tail = TRUE, log.p = FALSE)

rzipois(n, rho, lambda)

Arguments

x

A non-negative integer-valued vector of quantiles.

q

A numeric vector of quantiles.

p

A vector of probabilities.

n

Number of random values to return, a length-one positive integer-valued vector.

rho

A length-one vector of zero inflation parameter on [0,1].

lambda

A length-one vector of positive means.

log, log.p

A length-one logical vector; if TRUE, probabilities p are given as log(p).

lower.tail

A length-one logical vector; if TRUE (the default), probabilities are P(X ≤ x), otherwise, P(X > x).

Details

The probability mass function of X is given by

P(X=x) = rho I(x = 0) + (1 - rho) P(Y=x), x=0,1,2,...,

where Y is distributed Poisson(lambda).

Value

dzipois gives the (log) density, pzipois gives the (log) distribution function, qzipois gives the quantile function, and rzipois generates random deviates.

Invalid arguments rise an error with a helpful message.

References

Lambert, D. (1992). Zero-Inflated Poisson Regression, with an Application to Defects in Manufacturing, Technometrics, 34(1), 1-14.

See Also

Poisson for the Poisson distribution.

Examples

# Example 1: dzipois
dzipois(x = 0:10, rho = 0.1, lambda = 5)

# Example 2: pzipois
pzipois(q = 2, rho = 0.1, lambda = 5)

# Example 3: qzipois
qzipois(p = pzipois(2, 0.1, 5), rho = 0.1, lambda = 5)

# Example 4: rzipois
n <- 1e+5
rho <- 0.2
lambda <- 5
mean(rzipois(n, rho, lambda)) # Sample mean
lambda * (1 - rho) # Theoretical mean

[Package attrCUSUM version 0.1.0 Index]