Misplaced Pages

Wallenius' noncentral hypergeometric distribution

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Probability mass function for Wallenius' Noncentral Hypergeometric Distribution for different values of the odds ratio ω.
m1 = 80, m2 = 60, n = 100, ω = 0.1 ... 20

In probability theory and statistics, Wallenius' noncentral hypergeometric distribution (named after Kenneth Ted Wallenius) is a generalization of the hypergeometric distribution where items are sampled with bias.

This distribution can be illustrated as an urn model with bias. Assume, for example, that an urn contains m1 red balls and m2 white balls, totalling N = m1 + m2 balls. Each red ball has the weight ω1 and each white ball has the weight ω2. We will say that the odds ratio is ω = ω1 / ω2. Now we are taking n balls, one by one, in such a way that the probability of taking a particular ball at a particular draw is equal to its proportion of the total weight of all balls that lie in the urn at that moment. The number of red balls x1 that we get in this experiment is a random variable with Wallenius' noncentral hypergeometric distribution.

The matter is complicated by the fact that there is more than one noncentral hypergeometric distribution. Wallenius' noncentral hypergeometric distribution is obtained if balls are sampled one by one in such a way that there is competition between the balls. Fisher's noncentral hypergeometric distribution is obtained if the balls are sampled simultaneously or independently of each other. Unfortunately, both distributions are known in the literature as "the" noncentral hypergeometric distribution. It is important to be specific about which distribution is meant when using this name.

The two distributions are both equal to the (central) hypergeometric distribution when the odds ratio is 1.

The difference between these two probability distributions is subtle. See the Misplaced Pages entry on noncentral hypergeometric distributions for a more detailed explanation.

Univariate distribution

Univariate Wallenius' Noncentral Hypergeometric Distribution
Parameters m 1 , m 2 N {\displaystyle m_{1},m_{2}\in \mathbb {N} }
N = m 1 + m 2 {\displaystyle N=m_{1}+m_{2}}
n [ 0 , N ) {\displaystyle n\in [0,N)}
ω R + {\displaystyle \omega \in \mathbb {R} _{+}}
Support x [ x m i n , x m a x ] {\displaystyle x\in }
x m i n = max ( 0 , n m 2 ) {\displaystyle x_{min}=\max(0,n-m_{2})}
x m a x = min ( n , m 1 ) {\displaystyle x_{max}=\min(n,m_{1})}
PMF ( m 1 x ) ( m 2 n x ) 0 1 ( 1 t ω / D ) x ( 1 t 1 / D ) n x d t {\displaystyle {\binom {m_{1}}{x}}{\binom {m_{2}}{n-x}}\int _{0}^{1}(1-t^{\omega /D})^{x}(1-t^{1/D})^{n-x}\operatorname {d} t}
where D = ω ( m 1 x ) + ( m 2 ( n x ) ) {\displaystyle D=\omega (m_{1}-x)+(m_{2}-(n-x))}
Mean Approximated by solution μ {\displaystyle \mu } to
μ m 1 + ( 1 n μ m 2 ) ω = 1 {\displaystyle {\frac {\mu }{m_{1}}}+\left(1-{\frac {n-\mu }{m_{2}}}\right)^{\omega }=1}
Variance N a b ( N 1 ) ( m 1 b + m 2 a ) {\displaystyle \approx {\frac {Nab}{(N-1)(m_{1}b+m_{2}a)}}\,} ,   where
a = μ ( m 1 μ ) , b = ( n μ ) ( μ + m 2 n ) {\displaystyle a=\mu (m_{1}-\mu ),\;b=(n-\mu )(\mu +m_{2}-n)}
Recursive calculation of probability f(x,n) in Wallenius' distribution. The light grey fields are possible points on the way to the final point. The arrows indicate an arbitrary trajectory.

Wallenius' distribution is particularly complicated because each ball has a probability of being taken that depends not only on its weight, but also on the total weight of its competitors. And the weight of the competing balls depends on the outcomes of all preceding draws.

This recursive dependency gives rise to a difference equation with a solution that is given in open form by the integral in the expression of the probability mass function in the table above.

Closed form expressions for the probability mass function exist (Lyons, 1980), but they are not very useful for practical calculations because of extreme numerical instability, except in degenerate cases.

Several other calculation methods are used, including recursion, Taylor expansion and numerical integration (Fog, 2007, 2008).

The most reliable calculation method is recursive calculation of f(x,n) from f(x,n-1) and f(x-1,n-1) using the recursion formula given below under properties. The probabilities of all (x,n) combinations on all possible trajectories leading to the desired point are calculated, starting with f(0,0) = 1 as shown on the figure to the right. The total number of probabilities to calculate is n(x+1)-x. Other calculation methods must be used when n and x are so big that this method is too inefficient.

The probability that all balls have the same color is easier to calculate. See the formula below under multivariate distribution.

No exact formula for the mean is known (short of complete enumeration of all probabilities). The equation given above is reasonably accurate. This equation can be solved for μ by Newton-Raphson iteration. The same equation can be used for estimating the odds from an experimentally obtained value of the mean.

Properties of the univariate distribution

Wallenius' distribution has fewer symmetry relations than Fisher's noncentral hypergeometric distribution has. The only symmetry relates to the swapping of colors:

wnchypg ( x ; n , m 1 , m 2 , ω ) = wnchypg ( n x ; n , m 2 , m 1 , 1 / ω ) . {\displaystyle \operatorname {wnchypg} (x;n,m_{1},m_{2},\omega )=\operatorname {wnchypg} (n-x;n,m_{2},m_{1},1/\omega )\,.}

Unlike Fisher's distribution, Wallenius' distribution has no symmetry relating to the number of balls not taken.

The following recursion formula is useful for calculating probabilities:

wnchypg ( x ; n , m 1 , m 2 , ω ) = {\displaystyle \operatorname {wnchypg} (x;n,m_{1},m_{2},\omega )=}
wnchypg ( x 1 ; n 1 , m 1 , m 2 , ω ) ( m 1 x + 1 ) ω ( m 1 x + 1 ) ω + m 2 + x n + {\displaystyle \operatorname {wnchypg} (x-1;n-1,m_{1},m_{2},\omega ){\frac {(m_{1}-x+1)\omega }{(m_{1}-x+1)\omega +m_{2}+x-n}}+}
wnchypg ( x ; n 1 , m 1 , m 2 , ω ) m 2 + x n + 1 ( m 1 x ) ω + m 2 + x n + 1 {\displaystyle \operatorname {wnchypg} (x;n-1,m_{1},m_{2},\omega ){\frac {m_{2}+x-n+1}{(m_{1}-x)\omega +m_{2}+x-n+1}}}

Another recursion formula is also known:

wnchypg ( x ; n , m 1 , m 2 , ω ) = {\displaystyle \operatorname {wnchypg} (x;n,m_{1},m_{2},\omega )=}
wnchypg ( x 1 ; n 1 , m 1 1 , m 2 , ω ) m 1 ω m 1 ω + m 2 + {\displaystyle \operatorname {wnchypg} (x-1;n-1,m_{1}-1,m_{2},\omega ){\frac {m_{1}\omega }{m_{1}\omega +m_{2}}}+}
wnchypg ( x ; n 1 , m 1 , m 2 1 , ω ) m 2 m 1 ω + m 2 . {\displaystyle \operatorname {wnchypg} (x;n-1,m_{1},m_{2}-1,\omega ){\frac {m_{2}}{m_{1}\omega +m_{2}}}\,.}

The probability is limited by

f 1 ( x ) wnchypg ( x ; n , m 1 , m 2 , ω ) f 2 ( x ) , for ω < 1 , {\displaystyle \operatorname {f} _{1}(x)\leq \operatorname {wnchypg} (x;n,m_{1},m_{2},\omega )\leq \operatorname {f} _{2}(x)\,,\,\,{\text{for}}\,\,\omega <1\,,}
f 1 ( x ) wnchypg ( x ; n , m 1 , m 2 , ω ) f 2 ( x ) , for ω > 1 , where {\displaystyle \operatorname {f} _{1}(x)\geq \operatorname {wnchypg} (x;n,m_{1},m_{2},\omega )\geq \operatorname {f} _{2}(x)\,,\,\,{\text{for}}\,\,\omega >1\,,{\text{where}}}
f 1 ( x ) = ( m 1 x ) ( m 2 n x ) n ! ( m 1 + m 2 / ω ) x _ ( m 2 + ω ( m 1 x ) ) n x _ {\displaystyle \operatorname {f} _{1}(x)={\binom {m_{1}}{x}}{\binom {m_{2}}{n-x}}{\frac {n!}{(m_{1}+m_{2}/\omega )^{\underline {x}}\,(m_{2}+\omega (m_{1}-x))^{\underline {n-x}}}}}
f 2 ( x ) = ( m 1 x ) ( m 2 n x ) n ! ( m 1 + ( m 2 x 2 ) / ω ) x _ ( m 2 + ω m 1 ) n x _ , {\displaystyle \operatorname {f} _{2}(x)={\binom {m_{1}}{x}}{\binom {m_{2}}{n-x}}{\frac {n!}{(m_{1}+(m_{2}-x_{2})/\omega )^{\underline {x}}\,(m_{2}+\omega m_{1})^{\underline {n-x}}}}\,,}

where the underlined superscript indicates the falling factorial a b _ = a ( a 1 ) ( a b + 1 ) {\displaystyle a^{\underline {b}}=a(a-1)\ldots (a-b+1)} .

Multivariate distribution

The distribution can be expanded to any number of colors c of balls in the urn. The multivariate distribution is used when there are more than two colors.

Multivariate Wallenius' Noncentral Hypergeometric Distribution
Parameters c N {\displaystyle c\in \mathbb {N} }
m = ( m 1 , , m c ) N c {\displaystyle \mathbf {m} =(m_{1},\ldots ,m_{c})\in \mathbb {N} ^{c}}
N = i = 1 c m i {\displaystyle N=\sum _{i=1}^{c}m_{i}}
n [ 0 , N ) {\displaystyle n\in [0,N)}
ω = ( ω 1 , , ω c ) R + c {\displaystyle {\boldsymbol {\omega }}=(\omega _{1},\ldots ,\omega _{c})\in \mathbb {R} _{+}^{c}}
Support S = { x Z 0 + c : i = 1 c x i = n } {\displaystyle \mathrm {S} =\left\{\mathbf {x} \in \mathbb {Z} _{0+}^{c}\,:\,\sum _{i=1}^{c}x_{i}=n\right\}}
PMF ( i = 1 c ( m i x i ) ) 0 1 i = 1 c ( 1 t ω i / D ) x i d t , {\displaystyle \left(\prod _{i=1}^{c}{\binom {m_{i}}{x_{i}}}\right)\int _{0}^{1}\prod _{i=1}^{c}(1-t^{\omega _{i}/D})^{x_{i}}\operatorname {d} t\,,}
where D = ω ( m x ) = i = 1 c ω i ( m i x i ) {\displaystyle D={\boldsymbol {\omega }}\cdot (\mathbf {m} -\mathbf {x} )=\sum _{i=1}^{c}\omega _{i}(m_{i}-x_{i})}
Mean Approximated by solution μ 1 , , μ c {\displaystyle \mu _{1},\ldots ,\mu _{c}} to
( 1 μ 1 m 1 ) 1 / ω 1 = ( 1 μ 2 m 2 ) 1 / ω 2 = = ( 1 μ c m c ) 1 / ω c {\displaystyle \left(1-{\frac {\mu _{1}}{m_{1}}}\right)^{1/\omega _{1}}=\left(1-{\frac {\mu _{2}}{m_{2}}}\right)^{1/\omega _{2}}=\ldots =\left(1-{\frac {\mu _{c}}{m_{c}}}\right)^{1/\omega _{c}}}
i = 1 c μ i = n i [ 0 , c ] : 0 μ i m i . {\displaystyle \wedge \,\sum _{i=1}^{c}\mu _{i}=n\,\wedge \,\forall \,i\in \,:\,0\leq \mu _{i}\leq m_{i}\,.}
Variance Approximated by variance of Fisher's noncentral hypergeometric distribution with same mean.

The probability mass function can be calculated by various Taylor expansion methods or by numerical integration (Fog, 2008).

The probability that all balls have the same color, j, can be calculated as:

mwnchypg ( ( 0 , , 0 , x j , 0 , ) ; n , m , ω ) = m j n _ ( 1 ω j i = 1 c m i ω i ) n _ {\displaystyle \operatorname {mwnchypg} ((0,\ldots ,0,x_{j},0,\ldots );n,\mathbf {m} ,{\boldsymbol {\omega }})={\frac {m_{j}^{\,\,{\underline {n}}}}{\left({\frac {1}{\omega _{j}}}\sum _{i=1}^{c}m_{i}\omega _{i}\right)^{\underline {n}}}}}

for xj = nmj, where the underlined superscript denotes the falling factorial.

A reasonably good approximation to the mean can be calculated using the equation given above. The equation can be solved by defining θ so that

μ i = m i ( 1 e ω i θ ) {\displaystyle \mu _{i}=m_{i}(1-e^{\omega _{i}\theta })}

and solving

i = 1 c μ i = n {\displaystyle \sum _{i=1}^{c}\mu _{i}=n}

for θ by Newton-Raphson iteration.

The equation for the mean is also useful for estimating the odds from experimentally obtained values for the mean.

No good way of calculating the variance is known. The best known method is to approximate the multivariate Wallenius distribution by a multivariate Fisher's noncentral hypergeometric distribution with the same mean, and insert the mean as calculated above in the approximate formula for the variance of the latter distribution.

Properties of the multivariate distribution

The order of the colors is arbitrary so that any colors can be swapped.

The weights can be arbitrarily scaled:

mwnchypg ( x ; n , m , ω ) = mwnchypg ( x ; n , m , r ω ) {\displaystyle \operatorname {mwnchypg} (\mathbf {x} ;n,\mathbf {m} ,{\boldsymbol {\omega }})=\operatorname {mwnchypg} (\mathbf {x} ;n,\mathbf {m} ,r{\boldsymbol {\omega }})\,\,} for all r R + {\displaystyle r\in \mathbb {R} _{+}} .

Colors with zero number (mi = 0) or zero weight (ωi = 0) can be omitted from the equations.

Colors with the same weight can be joined:

mwnchypg ( x ; n , m , ( ω 1 , , ω c 1 , ω c 1 ) ) = {\displaystyle \operatorname {mwnchypg} \left(\mathbf {x} ;n,\mathbf {m} ,(\omega _{1},\ldots ,\omega _{c-1},\omega _{c-1})\right)\,=}
mwnchypg ( ( x 1 , , x c 1 + x c ) ; n , ( m 1 , , m c 1 + m c ) , ( ω 1 , , ω c 1 ) ) {\displaystyle \operatorname {mwnchypg} \left((x_{1},\ldots ,x_{c-1}+x_{c});n,(m_{1},\ldots ,m_{c-1}+m_{c}),(\omega _{1},\ldots ,\omega _{c-1})\right)\,\cdot }
hypg ( x c ; x c 1 + x c , m c , m c 1 + m c ) , {\displaystyle \operatorname {hypg} (x_{c};x_{c-1}+x_{c},m_{c},m_{c-1}+m_{c})\,,}

where hypg ( x ; n , m , N ) {\displaystyle \operatorname {hypg} (x;n,m,N)} is the (univariate, central) hypergeometric distribution probability.

Complementary Wallenius' noncentral hypergeometric distribution

Probability mass function for the Complementary Wallenius' Noncentral Hypergeometric Distribution for different values of the odds ratio ω.
m1 = 80, m2 = 60, n = 40, ω = 0.05 ... 10

The balls that are not taken in the urn experiment have a distribution that is different from Wallenius' noncentral hypergeometric distribution, due to a lack of symmetry. The distribution of the balls not taken can be called the complementary Wallenius' noncentral hypergeometric distribution.

Probabilities in the complementary distribution are calculated from Wallenius' distribution by replacing n with N-n, xi with mi - xi, and ωi with 1/ωi.

Software available

See also

References

  • Chesson, J. (1976). "A non-central multivariate hypergeometric distribution arising from biased sampling with application to selective predation". Journal of Applied Probability. Vol. 13, no. 4. Applied Probability Trust. pp. 795–797. doi:10.2307/3212535. JSTOR 3212535.
  • Fog, A. (2007). "Random number theory".
  • Fog, A. (2008). "Calculation Methods for Wallenius' Noncentral Hypergeometric Distribution". Communications in Statictics, Simulation and Computation. 37 (2): 258–273. doi:10.1080/03610910701790269. S2CID 9040568.
  • Johnson, N. L.; Kemp, A. W.; Kotz, S. (2005). Univariate Discrete Distributions. Hoboken, New Jersey: Wiley and Sons.
  • Lyons, N. I. (1980). "Closed Expressions for Noncentral Hypergeometric Probabilities". Communications in Statistics - Simulation and Computation. Vol. 9, no. 3. pp. 313–314. doi:10.1080/03610918008812156.
  • Manly, B. F. J. (1974). "A Model for Certain Types of Selection Experiments". Biometrics. Vol. 30, no. 2. International Biometric Society. pp. 281–294. doi:10.2307/2529649. JSTOR 2529649.
  • Wallenius, K. T. (1963). Biased Sampling: The Non-central Hypergeometric Probability Distribution. Ph.D. Thesis (Thesis). Stanford University, Department of Statistics.
Probability distributions (list)
Discrete
univariate
with finite
support
with infinite
support
Continuous
univariate
supported on a
bounded interval
supported on a
semi-infinite
interval
supported
on the whole
real line
with support
whose type varies
Mixed
univariate
continuous-
discrete
Multivariate
(joint)
Directional
Univariate (circular) directional
Circular uniform
Univariate von Mises
Wrapped normal
Wrapped Cauchy
Wrapped exponential
Wrapped asymmetric Laplace
Wrapped Lévy
Bivariate (spherical)
Kent
Bivariate (toroidal)
Bivariate von Mises
Multivariate
von Mises–Fisher
Bingham
Degenerate
and singular
Degenerate
Dirac delta function
Singular
Cantor
Families
Categories: