Package 'poisbinom'

Title: A Faster Implementation of the Poisson-Binomial Distribution
Description: Provides the probability, distribution, and quantile functions and random number generator for the Poisson-Binomial distribution. This package relies on FFTW to implement the discrete Fourier transform, so that it is much faster than the existing implementation of the same algorithm in R.
Authors: Santiago Olivella [aut, cre], Yuki Shiraito [aut, cre]
Maintainer: Santiago Olivella <[email protected]>
License: GPL (>= 2)
Version: 1.0.2
Built: 2024-10-26 03:55:00 UTC
Source: https://github.com/solivella/poisbinom

Help Index


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(Xx)Pr(X \leq x), otherwise, Pr(X>x)Pr(X > x).

Details

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

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,10,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.

Author(s)

Shiraito, Y. and Olivella, S. (2017).

References

Hong, Y. (2013) “On computing the distribution function for the Poisson binomial distribution”. Computational Statistics and Data Analysis, 59, 41–51.

Examples

## Binomial probabilities
pp <- runif(500)

## PMF
dpoisbinom(36, pp)

## CDF
ppoisbinom(36, pp)

## Quantile function
qpoisbinom(0.3, pp)

## Random deviates
rpoisbinom(5, pp)