# NOT RUN {
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))
# }
Run the code above in your browser using DataLab