50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


hint (version 0.1-1)

Binomialintersection: The Binomial Intersection Distribution

Description

Density, distribution function, quantile function and random generation for the binomial intersection distribution.

Usage

dbint(n, A, range = NULL, log = FALSE) pbint(n, A, vals, upper.tail = TRUE, log.p = FALSE) qbint(p, n, A, upper.tail = TRUE, log.p = FALSE) rbint(num = 5, n, A)

Arguments

n
An integer specifying the number of categories in the urns.
A
A vector of integers specifying the numbers of balls drawn from each urn. The length of the vector equals the number of urns.
p
A probability between 0 and 1.
num
An integer specifying the number of random numbers to generate. Defaults to 5.
range, vals
A vector of integers specifying the intersection sizes for which probabilities (dhint) or cumulative probabilites (phint) should be computed (can be a single number). If range is NULL (default) then probabilities will be returned over the entire range of possible values.
log, log.p
Logical. If TRUE, probabilities p are given as log(p). Defaults to FALSE.
upper.tail
Logical. If TRUE, probabilities are P(X >= v), else P(X

Value

dbint, pbint, and qbint return a data frame with two columns: v, the intersection size, and p, the associated p-values. rbint returns an integer vector of random samples based on the binomial intersection distribution.

Details

The binomial intersection distribution is given by $$ P(X = v|N) = {b \choose v} \left(\prod_{i=1}^{N-1} p_{i}\right)^{v} \left(1 - \prod_{i=1}^{N-1} p_{i}\right)^{b-v} $$ where b gives the sample size which is smallest. This is an approximation for the hypergeometric intersection distribution when $n$ is large and $b$ is small relative to the samples taken from the $N-1$ other urns.

References

Kalinka, A.T. (2013). The probability of drawing intersections: extending the hypergeometric distribution. arXiv.1305.0717

See Also

Hyperintersection, hint.test, hint.dist.test, plotDistr, Hyperdistinct.

Examples

Run this code
## Generate the distribution of intersections sizes:
dd <- dbint(20, c(10, 12, 11, 14))
## Restrict the range of intersections.
dd <- dbint(20, c(10, 12), range = 0:5)
## Generate cumulative probabilities.
pp <- pbint(29, c(15, 8), vals = 5)
pp <- pbint(29, c(15, 8), vals = 2, upper.tail = FALSE)
## Extract quantiles:
qq <- qbint(0.15, 23, c(12, 10))
## Generate random samples from Binomial intersection distributions.
rr <- rbint(num = 10, 18, c(9, 14))

Run the code above in your browser using DataLab