ZeroTruncatedPoisson {actuar}R Documentation

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 <= x], otherwise, P[X > x].

Details

The zero-truncated Poisson distribution has probability mass function

p(x) = lambda^x exp(-lambda)/[x! (1 - exp(-lambda))] = lambda^x/[x! (e^lambda - 1)]

for x = 1, 2, ..., and p(1) = 1 when λ = 0. The cumulative distribution function is

P(x) = [F(x) - F(0)]/[1 - F(0)],

where F(x) is the distribution function of the standard Poisson.

The mean is λ/(1 - exp(-λ)) and the variance is λ[1 - (λ+1)exp(-λ)]/(1 - exp(-λ))^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 = λ.

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) ≥ p, where P is the distribution function.

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.

Note

Functions {d,p,q}ztpois use {d,p,q}pois for all but the trivial input values and p(0).

rztpois uses the simple inversion algorithm suggested by Peter Dalgaard on the r-help mailing list on 1 May 2005 (https://stat.ethz.ch/pipermail/r-help/2005-May/070680.html).

Author(s)

Vincent Goulet vincent.goulet@act.ulaval.ca

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

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))

[Package actuar version 3.1-4 Index]