The Zero-Truncated Poisson Distribution
Density function, distribution function, quantile function, random
generation for the Zero-Truncated Poisson distribution with parameter
lambda
.
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)
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 |
lower.tail |
logical; if |
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.
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.
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).
Vincent Goulet vincent.goulet@act.ulaval.ca
Klugman, S. A., Panjer, H. H. and Willmot, G. E. (2012), Loss Models, From Data to Decisions, Fourth Edition, Wiley.
dpois
for the standard Poisson distribution.
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))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.