
Density, distribution function, and random generation for the generally-inflated Poisson distribution.
dgenipois(x, lambda, inflate = 0, pstr.i = 0, byrow.arg = FALSE,
log.arg = FALSE)
pgenipois(q, lambda, inflate = 0, pstr.i = 0, byrow.arg = FALSE)
rgenipois(n, lambda, inflate = 0, pstr.i = 0, byrow.arg = FALSE)
Same type of argument as in rpois
.
vector of positive means (of an ordinary Poisson distribution). Short vectors are recycled.
vector of nonnegative integers; the inflated values.
Must have unique values only.
A NULL
is acceptable and means an empty set.
The first argument can be a length(inflate)
-vector of
probabilities;
else a matrix of dimension n x length(inflate)
of probabilities.
If a vector then this matrix is constructed from the vector
using byrow.arg
to determine the enumeration of the elements
(similar to matrix
).
One can think of this matrix as comprising of
structural probabilities.
Then the matrix augmented with one more column on the RHS so it has
dimension n x (length(inflate) + 1)
and whose rowSums
is a vector of 1s.
Finally,
for rgenipois
,
a multinomial sample is taken and if it belongs to the final
column then Poisson random variates are drawn.
dgenipois
gives the density,
pgenipois
gives the distribution function,
rgenipois
generates random deviates.
The generally-inflated Poisson distribution is a mixture of an
ordinary Poisson distribution with
a multinomial distribution.
Certain (inflated) values having some prespecified multinomial
probabilities can have structural values.
Since inflate = 0
and pstr.i = 0
then
the default is an ordinary Poisson distribution.
genipoisson
,
Gentpois
,
Genapois
,
dpospois
,
rpois
.
# NOT RUN {
ivec <- 2:4 # Inflate these values
pstr.i <- (1:3)/10; lambda <- 2;
y <- rgenipois(1000, lambda, inflate = ivec, pstr.i = pstr.i, byrow = TRUE)
table(y)
(ii <- dgenipois(0:7, lambda, inflate = ivec, pstr.i = pstr.i, byrow=TRUE))
table(rgenipois(1000, lambda, inflate = ivec, pstr.i = pstr.i, byrow=TRUE))
# }
# NOT RUN {
x <- 0:7
barplot(rbind(dgenipois(x, lambda, inflate = ivec, pstr.i = pstr.i,
byrow = TRUE),
dpois(x, lambda)),
beside = TRUE, col = c("blue", "orange"),
main = paste("Gen-inf Pois(lambda = ", lambda, ", ",
"inflate = c(", paste(ivec, collapse = ","),
"), pstr.i = c(", paste(pstr.i, collapse = ","),
"), byrow = TRUE) vs",
" Pois(", lambda, ")", sep = ""),
sub = "Generally-inflated Poisson is blue; Poisson is orange",
names.arg = as.character(x), las = 1, lwd = 2)
# }
Run the code above in your browser using DataLab