VGAM (version 1.1-1)

Genipois: Generally-Inflated Poisson Distribution

Description

Density, distribution function, and random generation for the generally-inflated Poisson distribution.

Usage

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)

Arguments

x, q, n, log.arg

Same type of argument as in rpois.

lambda

vector of positive means (of an ordinary Poisson distribution). Short vectors are recycled.

inflate

vector of nonnegative integers; the inflated values. Must have unique values only. A NULL is acceptable and means an empty set.

pstr.i, byrow.arg

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.

Value

dgenipois gives the density, pgenipois gives the distribution function, rgenipois generates random deviates.

Details

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.

See Also

genipoisson, Gentpois, Genapois, dpospois, rpois.

Examples

Run this code
# 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