One-Inflated Positive Poisson Distribution
Density,
distribution function,
quantile function and random generation
for the one-inflated positive
Poisson distribution with parameter pstr1.
doipospois(x, lambda, pstr1 = 0, log = FALSE) poipospois(q, lambda, pstr1 = 0) qoipospois(p, lambda, pstr1 = 0) roipospois(n, lambda, pstr1 = 0)
x, p, q, n |
Same as |
lambda |
Vector of positive means. |
pstr1 |
Probability of a structural one (i.e., ignoring the positive Poisson distribution), called phi. The default value of phi = 0 corresponds to the response having a positive Poisson distribution. |
log |
Logical. Return the logarithm of the answer? |
The probability function of Y is 1 with probability phi, and PosPoisson(lambda) with probability 1-phi. Thus
P(Y=1) = phi + (1-phi) * P(W=1)
where W is distributed as a positive Poisson(lambda) random variate.
doipospois gives the density,
poipospois gives the distribution function,
qoipospois gives the quantile function, and
roipospois generates random deviates.
The argument pstr1 is recycled to the required length, and
usually has values which lie in the interval [0,1].
These functions actually allow for the zero-deflated
Poisson distribution. Here, pstr1 is also permitted
to lie in the interval [-lambda / (expm1(lambda) - lambda), 0].
The resulting probability of a unit count is less than
the nominal positive Poisson value, and the use of pstr1 to
stand for the probability of a structural 1 loses its
meaning.
When pstr1 equals -lambda / (expm1(lambda) - lambda)
this corresponds to the 0- and 1-truncated Poisson distribution.
T. W. Yee
lambda <- 3; pstr1 <- 0.2; x <- (-1):7
(ii <- doipospois(x, lambda, pstr1 = pstr1))
table(roipospois(100, lambda, pstr1 = pstr1))
round(doipospois(1:10, lambda, pstr1 = pstr1) * 100) # Should be similar
## Not run: x <- 0:10
par(mfrow = c(2, 1)) # One-Inflated Positive Poisson
barplot(rbind(doipospois(x, lambda, pstr1 = pstr1), dpospois(x, lambda)),
beside = TRUE, col = c("blue", "orange"),
main = paste("OIPP(", lambda, ", pstr1 = ", pstr1, ") (blue) vs",
" PosPoisson(", lambda, ") (orange)", sep = ""),
names.arg = as.character(x))
deflat.limit <- -lambda / (expm1(lambda) - lambda) # 0-deflated Pos Poisson
newpstr1 <- round(deflat.limit, 3) + 0.001 # Inside and near the boundary
barplot(rbind(doipospois(x, lambda, pstr1 = newpstr1),
dpospois(x, lambda)),
beside = TRUE, col = c("blue","orange"),
main = paste("ODPP(", lambda, ", pstr1 = ", newpstr1, ") (blue) vs",
" PosPoisson(", lambda, ") (orange)", sep = ""),
names.arg = as.character(x))
## End(Not run)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.