Misplaced Pages

Fisher's 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 Fisher's noncentral hypergeometric distribution for different values of the odds ratio ω.
m1 = 80, m2 = 60, n = 100, ω = 0.01, ..., 1000
Biologist and statistician Ronald Fisher

In probability theory and statistics, Fisher's noncentral hypergeometric distribution is a generalization of the hypergeometric distribution where sampling probabilities are modified by weight factors. It can also be defined as the conditional distribution of two or more binomially distributed variables dependent upon their fixed sum.

The distribution may be illustrated by the following urn model. 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 balls randomly in such a way that the probability of taking a particular ball is proportional to its weight, but independent of what happens to the other balls. The number of balls taken of a particular color follows the binomial distribution. If the total number n of balls taken is known then the conditional distribution of the number of taken red balls for given n is Fisher's noncentral hypergeometric distribution. To generate this distribution experimentally, we have to repeat the experiment until it happens to give n balls.

If we want to fix the value of n prior to the experiment then we have to take the balls one by one until we have n balls. The balls are therefore no longer independent. This gives a slightly different distribution known as Wallenius' noncentral hypergeometric distribution. It is far from obvious why these two distributions are different. See the entry for noncentral hypergeometric distributions for an explanation of the difference between these two distributions and a discussion of which distribution to use in various situations.

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

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.

Fisher's noncentral hypergeometric distribution was first given the name extended hypergeometric distribution (Harkness, 1965), and some authors still use this name today.

Univariate distribution

Univariate Fisher's 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 min , x max ] {\displaystyle x\in }
x min = max ( 0 , n m 2 ) {\displaystyle x_{\min }=\max(0,n-m_{2})}
x max = min ( n , m 1 ) {\displaystyle x_{\max }=\min(n,m_{1})}
PMF ( m 1 x ) ( m 2 n x ) ω x P 0 {\displaystyle {\frac {{\binom {m_{1}}{x}}{\binom {m_{2}}{n-x}}\omega ^{x}}{P_{0}}}}
where P 0 = y = x min x max ( m 1 y ) ( m 2 n y ) ω y {\displaystyle P_{0}=\sum _{y=x_{\min }}^{x_{\max }}{\binom {m_{1}}{y}}{\binom {m_{2}}{n-y}}\omega ^{y}}
Mean P 1 P 0 {\displaystyle {\frac {P_{1}}{P_{0}}}} , where P k = y = x min x max ( m 1 y ) ( m 2 n y ) ω y y k {\displaystyle P_{k}=\sum _{y=x_{\min }}^{x_{\max }}{\binom {m_{1}}{y}}{\binom {m_{2}}{n-y}}\omega ^{y}\,y^{k}}
Mode 2 C B B 2 4 A C {\displaystyle \,\,\left\lfloor {\frac {-2C}{B-{\sqrt {B^{2}-4AC}}}}\right\rfloor \,} , where A = ω 1 {\displaystyle A=\omega -1} , B = m 1 + n N ( m 1 + n + 2 ) ω {\displaystyle B=m_{1}+n-N-(m_{1}+n+2)\omega } , C = ( m 1 + 1 ) ( n + 1 ) ω {\displaystyle C=(m_{1}+1)(n+1)\omega } .
Variance P 2 P 0 ( P 1 P 0 ) 2 {\displaystyle {\frac {P_{2}}{P_{0}}}-\left({\frac {P_{1}}{P_{0}}}\right)^{2}} , where Pk is given above.

The probability function, mean and variance are given in the adjacent table.

An alternative expression of the distribution has both the number of balls taken of each color and the number of balls not taken as random variables, whereby the expression for the probability becomes symmetric.

The calculation time for the probability function can be high when the sum in P0 has many terms. The calculation time can be reduced by calculating the terms in the sum recursively relative to the term for y = x and ignoring negligible terms in the tails (Liao and Rosen, 2001).

The mean can be approximated by:

μ 2 c b b 2 4 a c {\displaystyle \mu \approx {\frac {-2c}{b-{\sqrt {b^{2}-4ac}}}}\,} ,

where a = ω 1 {\displaystyle a=\omega -1} , b = m 1 + n N ( m 1 + n ) ω {\displaystyle b=m_{1}+n-N-(m_{1}+n)\omega } , c = m 1 n ω {\displaystyle c=m_{1}n\omega } .

The variance can be approximated by:

σ 2 N N 1 / ( 1 μ + 1 m 1 μ + 1 n μ + 1 μ + m 2 n ) {\displaystyle \sigma ^{2}\approx {\frac {N}{N-1}}{\bigg /}\left({\frac {1}{\mu }}+{\frac {1}{m_{1}-\mu }}+{\frac {1}{n-\mu }}+{\frac {1}{\mu +m_{2}-n}}\right)} .

Better approximations to the mean and variance are given by Levin (1984, 1990), McCullagh and Nelder (1989), Liao (1992), and Eisinga and Pelzer (2011). The saddlepoint methods to approximate the mean and the variance suggested Eisinga and Pelzer (2011) offer extremely accurate results.

Properties

The following symmetry relations apply:

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

Recurrence relation:

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

The distribution is affectionately called "finchy-pig," based on the abbreviation convention above.

Derivation

The univariate noncentral hypergeometric distribution may be derived alternatively as a conditional distribution in the context of two binomially distributed random variables, for example when considering the response to a particular treatment in two different groups of patients participating in a clinical trial. An important application of the noncentral hypergeometric distribution in this context is the computation of exact confidence intervals for the odds ratio comparing treatment response between the two groups.

Suppose X and Y are binomially distributed random variables counting the number of responders in two corresponding groups of size mX and mY respectively,

X Bin ( m X , π X ) , Y Bin ( m Y , π Y ) {\displaystyle X\sim \operatorname {Bin} (m_{X},\pi _{X}),\quad Y\sim \operatorname {Bin} (m_{Y},\pi _{Y})\,} .

Their odds ratio is given as

ω = ω X ω Y = π X / ( 1 π X ) π Y / ( 1 π Y ) {\displaystyle \omega ={\frac {\omega _{X}}{\omega _{Y}}}={\frac {\pi _{X}/(1-\pi _{X})}{\pi _{Y}/(1-\pi _{Y})}}} .

The responder prevalence π i {\displaystyle \pi _{i}} is fully defined in terms of the odds ω i {\displaystyle \omega _{i}} , i { X , Y } {\displaystyle i\in \{X,Y\}} , which correspond to the sampling bias in the urn scheme above, i.e.

π i = ω i 1 + ω i {\displaystyle \pi _{i}={\frac {\omega _{i}}{1+\omega _{i}}}} .

The trial can be summarized and analyzed in terms of the following contingency table.

      Treatment  Group responder non-responder Total
X x . mX
Y y . mY
Total n . N

In the table, n = x + y {\displaystyle n=x+y} corresponds to the total number of responders across groups, and N to the total number of patients recruited into the trial. The dots denote corresponding frequency counts of no further relevance.

The sampling distribution of responders in group X conditional upon the trial outcome and prevalences, P r ( X = x | X + Y = n , m X , m Y , ω X , ω Y ) {\displaystyle Pr(X=x\;|\;X+Y=n,m_{X},m_{Y},\omega _{X},\omega _{Y})} , is noncentral hypergeometric:

F ( X , ω ) : = P r ( X = x | X + Y = n , m X , m Y , ω X , ω Y ) = P r ( X = x , X + Y = n | m X , m Y , ω X , ω Y ) P r ( X + Y = n | m X , m Y , ω X , ω Y ) = P r ( X = x | m X , ω X ) P r ( Y = n x | m Y , ω Y , X = x ) P r ( X + Y = n | m X , m Y , ω X , ω Y ) = ( m X x ) π X x ( 1 π X ) m X x ( m Y n x ) π Y n x ( 1 π Y ) m Y ( n x ) P r ( X + Y = n | m X , m Y , ω X , ω Y ) = ( m X x ) ω X x ( 1 π X ) m X ( m Y n x ) ω Y n x ( 1 π Y ) m Y P r ( X + Y = n | m X , m Y , ω X , ω Y ) = ( m X x ) ( m Y n x ) ω x ( 1 π X ) m X ω Y n ( 1 π Y ) m Y ( 1 π X ) m X ω Y n ( 1 π Y ) m Y u = max ( 0 , n m Y ) min ( m X , n ) ( m X u ) ( m Y n u ) ω u = ( m X x ) ( m Y n x ) ω x u = max ( 0 , n m Y ) min ( m X , n ) ( m X u ) ( m Y n u ) ω u {\displaystyle {\begin{aligned}F(X,\omega ):&=Pr(X=x\;|\;X+Y=n,m_{X},m_{Y},\omega _{X},\omega _{Y})\\&={\frac {Pr(X=x,X+Y=n\;|\;m_{X},m_{Y},\omega _{X},\omega _{Y})}{Pr(X+Y=n\;|\;m_{X},m_{Y},\omega _{X},\omega _{Y})}}\\&={\frac {Pr(X=x\;|\;m_{X},\omega _{X})Pr(Y=n-x\;|\;m_{Y},\omega _{Y},X=x)}{Pr(X+Y=n\;|\;m_{X},m_{Y},\omega _{X},\omega _{Y})}}\\&={\frac {{\binom {m_{X}}{x}}\pi _{X}^{x}(1-\pi _{X})^{m_{X}-x}{\binom {m_{Y}}{n-x}}\pi _{Y}^{n-x}(1-\pi _{Y})^{m_{Y}-(n-x)}}{Pr(X+Y=n\;|\;m_{X},m_{Y},\omega _{X},\omega _{Y})}}\\&={\frac {{\binom {m_{X}}{x}}\omega _{X}^{x}(1-\pi _{X})^{m_{X}}{\binom {m_{Y}}{n-x}}\omega _{Y}^{n-x}(1-\pi _{Y})^{m_{Y}}}{Pr(X+Y=n\;|\;m_{X},m_{Y},\omega _{X},\omega _{Y})}}\\&={\frac {{\binom {m_{X}}{x}}{\binom {m_{Y}}{n-x}}\omega ^{x}(1-\pi _{X})^{m_{X}}\omega _{Y}^{n}(1-\pi _{Y})^{m_{Y}}}{(1-\pi _{X})^{m_{X}}\omega _{Y}^{n}(1-\pi _{Y})^{m_{Y}}\sum _{u=\max(0,n-m_{Y})}^{\min(m_{X},n)}{\binom {m_{X}}{u}}{\binom {m_{Y}}{n-u}}\omega ^{u}}}\\&={\frac {{\binom {m_{X}}{x}}{\binom {m_{Y}}{n-x}}\omega ^{x}}{\sum _{u=\max(0,n-m_{Y})}^{\min(m_{X},n)}{\binom {m_{X}}{u}}{\binom {m_{Y}}{n-u}}\omega ^{u}}}\end{aligned}}}

Note that the denominator is essentially just the numerator, summed over all events of the joint sample space ( X , Y ) {\displaystyle (X,Y)} for which it holds that X + Y = n {\displaystyle X+Y=n} . Terms independent of X can be factored out of the sum and cancel out with the numerator.

Multivariate distribution

Multivariate Fisher's 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 1 P 0 i = 1 c ( m i x i ) ω i x i {\displaystyle {\frac {1}{P_{0}}}\prod _{i=1}^{c}{\binom {m_{i}}{x_{i}}}\omega _{i}^{x_{i}}}
where P 0 = ( y 0 , , y c ) S i = 1 c ( m i y i ) ω i y i {\displaystyle P_{0}=\sum _{(y_{0},\ldots ,y_{c})\in \mathrm {S} }\prod _{i=1}^{c}{\binom {m_{i}}{y_{i}}}\omega _{i}^{y_{i}}}
Mean The mean μi of xi can be approximated by
μ i = m i r ω i r ω i + 1 {\displaystyle \mu _{i}={\frac {m_{i}r\omega _{i}}{r\omega _{i}+1}}} where r is the unique positive solution to i = 1 c μ i = n {\displaystyle \sum _{i=1}^{c}\mu _{i}=n\,} .

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.

The probability function and a simple approximation to the mean are given to the right. Better approximations to the mean and variance are given by McCullagh and Nelder (1989).

Properties

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

The weights can be arbitrarily scaled:

mfnchypg ( x ; n , m , ω ) = mfnchypg ( x ; n , m , r ω ) {\displaystyle \operatorname {mfnchypg} (\mathbf {x} ;n,\mathbf {m} ,{\boldsymbol {\omega }})=\operatorname {mfnchypg} (\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:

mfnchypg ( x ; n , m , ( ω 1 , , ω c 1 , ω c 1 ) ) = mfnchypg ( ( x 1 , , x c 1 + x c ) ; n , ( m 1 , , m c 1 + m c ) , ( ω 1 , , ω c 1 ) ) hypg ( x c ; x c 1 + x c , m c , m c 1 + m c ) {\displaystyle {\begin{aligned}&{}\operatorname {mfnchypg} \left(\mathbf {x} ;n,\mathbf {m} ,(\omega _{1},\ldots ,\omega _{c-1},\omega _{c-1})\right)\\&{}=\operatorname {mfnchypg} \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 \\&\qquad \operatorname {hypg} (x_{c};x_{c-1}+x_{c},m_{c},m_{c-1}+m_{c})\end{aligned}}}

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

Applications

Fisher's noncentral hypergeometric distribution is useful for models of biased sampling or biased selection where the individual items are sampled independently of each other with no competition. The bias or odds can be estimated from an experimental value of the mean. Use Wallenius' noncentral hypergeometric distribution instead if items are sampled one by one with competition.

Fisher's noncentral hypergeometric distribution is used mostly for tests in contingency tables where a conditional distribution for fixed margins is desired. This can be useful, for example, for testing or measuring the effect of a medicine. See McCullagh and Nelder (1989).

Software available

See also

References

Breslow, N. E.; Day, N. E. (1980), Statistical Methods in Cancer Research, Lyon: International Agency for Research on Cancer.

Eisinga, R.; Pelzer, B. (2011), "Saddlepoint approximations to the mean and variance of the extended hypergeometric distribution" (PDF), Statistica Neerlandica, vol. 65, no. 1, pp. 22–31, doi:10.1111/j.1467-9574.2010.00468.x.

Fog, A. (2007), Random number theory.

Fog, A. (2008), "Sampling Methods for Wallenius' and Fisher's Noncentral Hypergeometric Distributions", Communications in Statictics, Simulation and Computation, vol. 37, no. 2, pp. 241–257, doi:10.1080/03610910701790236, S2CID 14904723.

Johnson, N. L.; Kemp, A. W.; Kotz, S. (2005), Univariate Discrete Distributions, Hoboken, New Jersey: Wiley and Sons.

Levin, B. (1984), "Simple Improvements on Cornfield's approximation to the mean of a noncentral Hypergeometric random variable", Biometrika, vol. 71, no. 3, pp. 630–632, doi:10.1093/biomet/71.3.630.

Levin, B. (1990), "The saddlepoint correction in conditional logistic likelihood analysis", Biometrika, vol. 77, no. 2, , pp. 275–285, doi:10.1093/biomet/77.2.275, JSTOR 2336805.

Liao, J. (1992), "An Algorithm for the Mean and Variance of the Noncentral Hypergeometric Distribution", Biometrics, vol. 48, no. 3, , pp. 889–892, doi:10.2307/2532354, JSTOR 2532354.

Liao, J. G.; Rosen, O. (2001), "Fast and Stable Algorithms for Computing and Sampling from the Noncentral Hypergeometric Distribution", The American Statistician, vol. 55, no. 4, pp. 366–369, doi:10.1198/000313001753272547, S2CID 121279235.

McCullagh, P.; Nelder, J. A. (1989), Generalized Linear Models, 2. ed., London: Chapman and Hall.

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: