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 |
lower.tail |
logical; if |
Details
The zero-truncated Poisson distribution has probability mass function
for , and
when
.
The cumulative distribution function is
where is the distribution function of the standard Poisson.
The mean is and the variance is
.
In the terminology of Klugman et al. (2012), the zero-truncated
Poisson is a member of the class of distributions
with
and
.
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 such that
, where
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 .
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))