Learn R Programming

poisbinom (version 1.0.1)

Poisson-Binomial: The Poisson Binomial Distribution

Description

Probability mass, distribution, quantile and function, and random number generator for the Poisson-Binomial distribution with parameter vector pp (the probability parameter of the component Binomial random variables).

Usage

dpoisbinom(x, pp, log_d = FALSE)
ppoisbinom(q, pp, lower_tail = TRUE, log_p = FALSE)
qpoisbinom(p, pp, lower_tail = TRUE, log_p = FALSE)
rpoisbinom(n,pp)

Arguments

x, q
vector of quantiles.
p, pp
vector of probabilities.
n
number of random deviates.
log_d, log_p
logical; if TRUE, probabilities are given in the log scale.
lower_tail
logical; if TRUE (default), probabilities are \(Pr(X \leq x)\), otherwise, \(Pr(X > x)\).

Value

dpoisbinom gives the mass, ppoisbinom gives the distribution function, qpoisbinom gives the quantile function and rpoisbinom generates random deviates.

If pp contains values outside of [\(0,1\)], an error is returned.

The length of the result is determined by n in rpoisbinom, and is the length of the first argument for all other functions.

Details

The Poisson-Binomial distribution is the distribution of a sum of \(n\) independent and not identically distributed Binomial random variables. It is parameterized by the vector of \(n\) possibly distinct probability parameters of these Binomial distributions, and is computed using a discrete Fourier transform. See Hong (2013) for details.

References

Hong, Y. (2013) ``On computing the distribution function for the Poisson binomial distribution''. Computational Statistics and Data Analysis, 59, 41--51.

Examples

Run this code
## Binomial probabilities
pp <- runif(500)

## PMF
dpoisbinom(36, pp)

## CDF
ppoisbinom(36, pp)

## Quantile function
qpoisbinom(0.3, pp)

## Random deviates
rpoisbinom(5, pp)

Run the code above in your browser using DataLab