Density, distribution function, quantile function and random generation for the generalized binomial distribution with parameter vectors `size`

and `prob`

.

1 2 3 4 |

`x, q` |
vector of quantiles. |

`p` |
vector of probabilities. |

`N` |
number of observations. |

`size` |
vector of the number of trials for each type. |

`prob` |
vector of the success probabilities for each type. |

`log,log.p` |
logical; if TRUE probabilities p are given as log(p). |

`lower.tail` |
logical; if TRUE (default), probabilities are |

The generalized binomial distribution with `size`

=*c(n1,… ,nr)* and `prob`

=*c(p1,...,pr)* is the sum of *r* binomially distributed random variables with different *pi* (and, in case, with different *ni*):

Z=*∑ Zi*, * * *Z* ~ *gbinom*(`size`

,`prob`

), with *Zi* ~ *binom(ni,pi), i=1,...,r*.

Since the sum of Bernoulli distributed random variables is binomially distributed, *Z* can be also defined as:

Z=*∑ ∑ Zij*, with *Zij* ~ *binom(1,pi), j=1,...,ni*.

The pmf is obtained by an algorithm which is based on the convolution of Bernoulli distributions. See the references below for further information.

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

`rgbinom`

uses the inversion method (see Devroye, 1986).

`dgbinom`

gives the pmf, `pgbinom`

gives the cdf, `qgbinom`

gives the quantile function and `rgbinom`

generates random deviates.

If `size`

contains just one trial number and `prob`

one success probability, then the generalized binomial distribution results in the binomial distribution.

The generalized binomial distribution described here is also known as Poisson-binomial distribution. See the link below to the package `poibin`

for further information.

D.Kurz, H.Lewitschnig, J.Pilz, *Decision-Theoretical Model for Failures which are Tackled by Countermeasures*, IEEE Transactions on Reliability, Vol. 63, No. 2, June 2014.

K.J. Klauer, *Kriteriumsorientierte Tests*, Verlag fuer Psychologie, Hogrefe, 1987, Goettingen, p. 208 ff.

M.Fisz, *Wahrscheinlichkeitsrechnung und mathematische Statistik*, VEB Deutscher Verlag der Wissenschaften, 1973, p. 164 ff.

L.Devroye, Non-Uniform Random Variate Generation, Springer-Verlag, 1986, p. 85 ff.

`ppoibin`

, for another implementation of this distribution.

`dbinom`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
## n=10 defect devices, divided in 3 failure types n1=2, n2=5, n3=3.
## 3 countermeasures with effectivities p1=0.8, p2=0.7, p3=0.3 are available.
## use dgbinom() to get the probabilities for x=0,...,10 failures solved.
dgbinom(x=c(0:10),size=c(2,5,3),prob=c(0.8,0.7,0.3))
## generation of N=100000 random values
rgbinom(100000,size=c(2,5,3),prob=c(0.8,0.7,0.3))
## n1=100, n2=100, n3=200, p1=0.001, p2=0.005, p3=0.01
dgbinom(c(0:2),size=c(100,100,200),prob=c(0.001,0.005,0.01))
# 0.07343377 0.19260317 0.25173556
pgbinom(2,size=c(100,100,200),prob=c(0.001,0.005,0.01),lower.tail=FALSE)
# 0.4822275
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.