Density, distribution function, quantile function, and 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)
vector of (non-negative integer) quantiles.
vector of (non-negative) Poisson parameters.
logical indicating whether probabilities p are given as log(p).
vector of quantiles.
logical indicating whether probabilities are
vector of probabilities.
number of random values to return.
The Poisson distribution left-truncated at zero (or zero-truncated Poisson for short) is the distribution obtained, when considering a Poisson variable Y conditional on Y being greater than zero.
All functions follow the usual conventions of d/p/q/r functions
in base R. In particular, all four ztpois
functions for the
zero-truncated Poisson distribution call the corresponding pois
functions for the Poisson distribution from base R internally.
ZTPoisson
, dpois
## theoretical probabilities for a zero-truncated Poisson distribution
x <- 0:8
p <- dztpois(x, lambda = 2.5)
plot(x, p, type = "h", lwd = 2)
## corresponding empirical frequencies from a simulated sample
set.seed(0)
y <- rztpois(500, lambda = 2.5)
hist(y, breaks = -1:max(y) + 0.5)
Run the code above in your browser using DataLab