Pospois {VGAMdata} | R Documentation |
Positive-Poisson Distribution
Description
Density, distribution function, quantile function and random generation for the positive-Poisson distribution.
Usage
dpospois(x, lambda, log = FALSE)
ppospois(q, lambda)
qpospois(p, lambda)
rpospois(n, lambda)
Arguments
x , q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations.
Fed into |
lambda |
vector of positive means (of an ordinary Poisson distribution). Short vectors are recycled. |
log |
logical. |
Details
The positive-Poisson distribution is a Poisson distribution but with the probability of a zero being zero. The other probabilities are scaled to add to unity. The mean therefore is
\lambda / (1-\exp(-\lambda)).
As \lambda
increases, the positive-Poisson and Poisson
distributions become more similar.
Unlike similar functions for the Poisson distribution, a zero value
of lambda
returns a NaN
.
Value
dpospois
gives the density,
ppospois
gives the distribution function,
qpospois
gives the quantile function, and
rpospois
generates random deviates.
Note
These functions are or are likely to be deprecated.
Use Gaitdpois
instead.
The family function pospoisson
estimates
\lambda
by maximum likelihood estimation.
Author(s)
T. W. Yee
See Also
Gaitdpois
,
pospoisson
,
zapoisson
,
zipoisson
,
rpois
.
Examples
lambda <- 2; y = rpospois(n = 1000, lambda)
table(y)
mean(y) # Sample mean
lambda / (1 - exp(-lambda)) # Population mean
(ii <- dpospois(0:7, lambda))
cumsum(ii) - ppospois(0:7, lambda) # Should be 0s
table(rpospois(100, lambda))
table(qpospois(runif(1000), lambda))
round(dpospois(1:10, lambda) * 1000) # Should be similar
## Not run: x <- 0:7
barplot(rbind(dpospois(x, lambda), dpois(x, lambda)),
beside = TRUE, col = c("blue", "orange"),
main = paste("Positive Poisson(", lambda, ") (blue) vs",
" Poisson(", lambda, ") (orange)", sep = ""),
names.arg = as.character(x), las = 1, lwd = 2)
## End(Not run)