actuar (version 3.0-0)

ZeroTruncatedPoisson: The Zero-Truncated Poisson Distribution

Description

Density function, distribution function, quantile function, random generation for the Zero-Truncated Poisson distribution with parameter lambda.

Usage

dztpois(x, lambda, log = FALSE)
pztpois(q, lambda, lower.tail = TRUE, log.p = FALSE)
qztpois(p, lambda, lower.tail = TRUE, log.p = FALSE)
rztpois(n, lambda)

Arguments

x

vector of (strictly positive integer) quantiles.

q

vector of quantiles.

p

vector of probabilities.

n

number of values to return.

lambda

vector of (non negative) means.

log, log.p

logical; if TRUE, probabilities \(p\) are returned as \(\log(p)\).

lower.tail

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

Value

dztpois gives the (log) probability mass function, pztpois gives the (log) distribution function, qztpois gives the quantile function, and rztpois generates random deviates.

Invalid lambda will result in return value NaN, with a warning.

The length of the result is determined by n for rztpois, and is the maximum of the lengths of the numerical arguments for the other functions.

Details

The zero-truncated Poisson distribution has probability mass function $$% p(x) = \frac{e^{-/lambda} \lambda^x}{x! (1 - e^{-\lambda})} = \frac{\lambda^x}{x! (e^{\lambda} - 1)}$$ for \(x = 1, 2, ...\), and \(p(1) = 1\) when \(\lambda = 0\). The cumulative distribution function is $$P(x) = \frac{F(x) - F(0)}{1 - F(0)},$$ where \(F(x)\) is the distribution function of the standard Poisson.

The mean is \(\lambda/(1 - e^{-\lambda})^2\) and the variance is \(\lambda[1 - (\lambda+1)e^{-\lambda}]/(1 - e^{-\lambda})^2\).

In the terminology of Klugman et al. (2012), the zero-truncated Poisson is a member of the \((a, b, 1)\) class of distributions with \(a = 0\) and \(b = \lambda\).

If an element of x is not integer, the result of dztpois is zero, with a warning.

The quantile is defined as the smallest value \(x\) such that \(P(x) \ge p\), where \(P\) is the distribution function.

References

Klugman, S. A., Panjer, H. H. and Willmot, G. E. (2012), Loss Models, From Data to Decisions, Fourth Edition, Wiley.

See Also

dpois for the standard Poisson distribution.

Examples

Run this code
# NOT RUN {
dztpois(1:5, lambda = 1)
dpois(1:5, lambda = 1)/ppois(0, 1, lower = FALSE) # same

pztpois(1, lambda = 0)          # point mass at 1

qztpois(pztpois(1:10, 1), 1)

x <- seq(0, 8)
plot(x, dztpois(x, 2), type = "h", lwd = 2, ylab = "p(x)",
     main = "Zero-Truncated Poisson(2) and Poisson(2) PDF")
points(x, dpois(x, 2), pch = 19, col = "red")
legend("topright", c("ZT Poisson probabilities", "Poisson probabilities"),
       col = c("black", "red"), lty = c(1, 0), lwd = 2, pch = c(NA, 19))
# }

Run the code above in your browser using DataCamp Workspace