Binomialintersection: The Binomial Intersection Distribution

Description Usage Arguments Details Examples

Description

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

Usage

1
2
3
4
5
6
7
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.

range

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

Logical. If TRUE, probabilities p are given as log(p). Defaults to FALSE.

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.

upper.tail

Logical. If TRUE, probabilities are P(X >= v), else P(X <= v). Defaults to TRUE.

log.p

Logical. If TRUE, probabilities p are given as log(p). Defaults to FALSE.

p

A probability between 0 and 1.

num

An integer specifying the number of random numbers to generate. Defaults to 5.

Details

The binomial intersection distribution is given by

P(X = v|N) = choose(b,v)*((prod_{i=1}^{N-1} p_i)^v) * (1 - prod_{i=1}^{N-1} p_i)^(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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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))

hint documentation built on Feb. 2, 2022, 5:10 p.m.