Genapois {VGAM} | R Documentation |
Density, distribution function, and random generation for the generally-altered Poisson distribution.
dgenapois(x, lambda, alter = 0, pobs.a = 0, byrow.arg = FALSE, log = FALSE) pgenapois(q, lambda, alter = 0, pobs.a = 0, byrow.arg = FALSE) rgenapois(n, lambda, alter = 0, pobs.a = 0, byrow.arg = FALSE, maxits = 10000)
x, q, n, log |
Same type of argument as in |
lambda |
vector of positive means (of an ordinary Poisson distribution). Short vectors are recycled. |
alter |
vector of nonnegative integers; the altered values.
Must have unique values only.
A |
pobs.a, byrow.arg |
The first argument can be a |
maxits |
Fed into |
The generally-altered Poisson distribution is a Poisson
distribution with
the probability of certain (altered) values having some
prespecified probabilities.
It can be considered a mixture of a multinomial distribution
and a generally-truncated Poisson distribution.
Since alter = 0
and pobs.a = 0
then
the default is a 0-truncated (positive) Poisson distribution.
dgenapois
gives the density,
pgenapois
gives the distribution function,
rgenapois
generates random deviates.
See rgentpois
.
The function can run slowly for certain combinations
of pobs.a
and alter
, e.g.,
rgenapois(1e5, 1, alter = 0:9, pobs.a = (1:10)/100)
.
Failure to obtain random variates will result in some
NA
values instead.
T. W. Yee.
genapoisson
,
Genipois
,
Gentpois
,
dpospois
,
rpois
.
avec <- 2:4 # Alter these values pobs.a <- (1:3)/10; lambda <- 2; y <- rgenapois(1000, lambda, alter = avec, pobs.a = pobs.a, byrow = TRUE) table(y) (ii <- dgenapois(0:7, lambda, alter = avec, pobs.a = pobs.a, byrow = TRUE)) table(rgenapois(100, lambda, alter = avec, pobs.a = pobs.a, byrow = TRUE)) ## Not run: x <- 0:7 barplot(rbind(dgenapois(x, lambda, alter = avec, pobs.a = pobs.a, byrow = TRUE), dpois(x, lambda)), beside = TRUE, col = c("blue", "orange"), main = paste("Gen-alt Pois(lambda = ", lambda, ", ", "alter = c(", paste(avec, collapse = ","), "), pobs.a = c(", paste(pobs.a, collapse = ","), "), byrow = TRUE) vs", " Pois(", lambda, ")", sep = ""), sub = "Generally-altered Poisson is blue; Poisson is orange", names.arg = as.character(x), las = 1, lwd = 2) ## End(Not run)