dpoisbinom: The Poisson Binomial Distribution

Description Usage Arguments Details Value Author(s) References Examples

View source: R/RcppExports.R

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

1
2
3
4
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 ≤q x), otherwise, Pr(X > x).

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.

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.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Binomial probabilities
pp <- runif(500)

## PMF
dpoisbinom(36, pp)

## CDF
ppoisbinom(36, pp)

## Quantile function
qpoisbinom(0.3, pp)

## Random deviates
rpoisbinom(5, pp)

Example output

[1] 1.862885e-17
[1] 2.918253e-15
[1] 252
[1] 263 249 263 252 268

poisbinom documentation built on May 2, 2019, 2:39 a.m.