# NOT RUN {
lambda <- 2; y <- rgentpois(n = 1000, lambda, truncate = 3:5)
table(y)
tvec <- 2:4 # Truncate these values
(ii <- dgentpois(0:7, lambda, truncate = tvec))
table(rgentpois(100, lambda, truncate = tvec))
# }
# NOT RUN {
x <- 0:7
barplot(rbind(dgentpois(x, lambda, truncate = tvec),
dpois(x, lambda)),
beside = TRUE, col = c("blue", "orange"),
main = paste("Gen-truncated Pois(lambda = ", lambda, ", ",
"truncate = c(", paste(tvec, collapse = ","),
")) vs",
" Pois(", lambda, ")", sep = ""),
sub = "Generally-truncated Poisson is blue; Poisson is orange",
names.arg = as.character(x), las = 1, lwd = 2)
# }
Run the code above in your browser using DataLab