Learn R Programming

RecordTest (version 2.2.0)

Poisson-Binomial: The Poisson Binomial Distribution

Description

Density, distribution function, quantile function and random generation for the Poisson binomial distribution with parameters size and prob.

This is conventionally interpreted as the number of successes in size * length(prob) trials with success probabilities prob.

Usage

dpoisbinom(x, size = 1, prob, log = FALSE)

ppoisbinom(q, size = 1, prob, lower.tail = TRUE, log.p = FALSE)

qpoisbinom(p, size = 1, prob, lower.tail = TRUE, log.p = FALSE)

rpoisbinom(n, size = 1, prob)

Value

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

The length of the result is determined by x, q, p

or n.

Arguments

x, q

Vector of quantiles.

size

The Poisson binomial distribution has size times the vector of probabilities prob.

prob

Vector with the probabilities of success on each trial.

log, log.p

Logical. If TRUE, probabilities \(p\) are given as \(\log(p)\).

lower.tail

Logical. If TRUE (default), probabilities are \(P(X \le x)\), otherwise, \(P(X > x)\).

p

Vector of probabilities.

n

Number of observations.

Author

Jorge Castillo-Mateo

Details

The Poisson binomial distribution with size = 1 and prob \(= (p_1,p_2,\ldots,p_n)\) has density $$p(x) = \sum_{A \in F_x} \prod_{i \in A} p_i \prod_{j \in A^c} (1-p_j)$$ for \(x=0,1,\ldots,n\); where \(F_x\) is the set of all subsets of \(x\) integers that can be selected from \(\{1,2,\ldots,n\}\).

\(p(x)\) is computed using Hong (2013) algorithm, see the reference below.

The quantile is defined as the smallest value \(x\) such that \(F(x) \ge p\), where \(F\) is the cumulative distribution function.

References

Hong Y (2013). “On Computing the Distribution Function for the Poisson Binomial Distribution.” Computational Statistics & Data Analysis, 59(1), 41-51. tools:::Rd_expr_doi("10.1016/j.csda.2012.10.006").