arXiv:1610.07554v1 [] 24 Oct 2016

Some Relationships and Properties
of the Hypergeometric Distribution
Peter H. Peskun, Department of Mathematics and Statistics
York University, Toronto, Ontario M3J 1P3, Canada
E-mail: peskun@pascal.math.yorku.ca
Abstract
The binomial and Poisson distributions have interesting relationships with the beta and
gamma distributions, respectively, which involve their cumulative distribution functions and the
use of conjugate priors in Bayesian statistics. We briefly discuss these relationships and some
properties resulting from them which play an important role in the construction of exact nested
two-sided confidence intervals and the computation of two-tailed P-values. The purpose of this
article is to show that such relationships also exist between the hypergeometric distribution and
a special case of the Polya (or beta-binomial) distribution, and to derive some properties of the
hypergeometric distribution resulting from these relationships.
KEY WORDS: Beta, binomial, gamma, Poisson, and Polya (or beta-binomial) distributions;
Conjugate prior distribution; Cumulative distribution function; Posterior distribution.

1.

INTRODUCTION

The binomial and Poisson distributions have interesting relationships with the beta and gamma
distributions, respectively, which involve their cumulative distribution functions and the use of conjugate priors in Bayesian statistics. We will briefly discuss these relationships and some properties
resulting from them in Sections 2 and 3 for the binomial and Poisson distributions, respectively. The
resulting properties play an important role in the construction of exact nested two-sided binomial
and Poisson confidence intervals, and the computation of exact two-tailed binomial and Poisson
P-values.
The purpose of this article is to show that such relationships also exist between the hypergeometric distribution and a special case of the Polya (or beta-binomial) distribution, and to derive
some properties of the hypergeometric distribution resulting from these relationships. We shall do
this in Section 4.
2.

RELATIONSHIPS AND PROPERTIES OF THE BINOMIAL DISTRIBUTION

Suppose that random variable X has a binomial distribution with parameters n and p, denoted
by X ∼ BIN(n, p), where n is a positive integer and 0 ≤ p ≤ 1. Then, for a given n and for 0 < p < 1,
the probability mass function (pmf) of X, denoted by fX (x | p), is
 
n x
fX (x | p) = P (X = x | p) =
p (1 − p)n−x , x = 0, 1, . . . , n,
x
= 0,

otherwise,
1

and fX (0 | 0) = fX (n | 1) = 1.
Suppose that random variable Y has a beta distribution with parameters α > 0 and β > 0,
denoted by Y ∼ BETA(α, β). Then the probability density function (pdf) of Y , denoted by
fY (y | α, β), is
Γ(α + β) α−1
y
(1 − y)β−1 , 0 ≤ y ≤ 1,
Γ(α)Γ(β)
= 0, otherwise,
R∞
where the gamma function Γ(κ) = 0 tκ−1 e−t dt for all κ > 0.
Successive integration by parts leads to a relationship between the cumulative distribution functions (cdf’s) of the binomial and beta distributions. If X ∼ BIN(n, p) and Y ∼ BETA(i + 1, n − i)
for integer i, 0 ≤ i ≤ n − 1, then
Z p
i  
X
n!
n x
p (1 − p)n−x = 1 −
ti (1 − t)n−i−1 dt.
(1)
i!(n
−
i
−
1)!
x
0
x=0
fY (y | α, β) =

That is, FX (i | p) = P (X ≤ i | p) = 1 − P (Y ≤ p | i + 1, n − i) = 1 − FY (p | i + 1, n − i). For fixed
integer i, 0 ≤ i ≤ n − 1, it follows from equation (1) that the function P (X ≤ i | p) is continuous
and decreasing in p; for fixed integer j, 1 ≤ j ≤ n, P (X ≥ j | p) = 1 − P (X ≤ j − 1 | p) is
continuous and increasing in p; and for fixed integers i and j, 1 ≤ i ≤ j ≤ n − 1, P (i ≤ X ≤ j | p)
is continuous, and increasing for 0 ≤ p < pn (i, j) and decreasing for pn (i, j) ≤ p ≤ 1 with maximum
at p = pn (i, j) = {1 + [(n − i) · · · (n − j)/j · · · i]1/(j−i+1) }−1 . Also, pn (0, j) = 0 for 0 ≤ j ≤ n − 1 and
pn (i, n) = 1 for 1 ≤ i ≤ n.
Suppose that the binomial parameter p is unknown and we wish to estimate it. In Bayesian
statistics, information obtained from the data x, a realization of X ∼ BIN(n, p), is combined with
prior information about p that is specified in a “prior distribution” with pdf g(p) and summarized in
a “posterior distribution” with pdf h(p | x) which is derived from the joint distribution fX (x | p)g(p),
and according to Bayes formula is
h(p | x) = R 1
0

fX (x | p)g(p)
fX (x | p)g(p) dp

.

(2)

Because h(p | x) is generally not available in closed form, the favoured types of priors until the
introduction of Markov chain Monte Carlo methods have been those allowing explicit computations,
namely “conjugate priors.” These are prior distributions for which the corresponding posterior
distributions are themselves members of the original prior family, the Bayesian updating being
accomplished through updating of parameters. For a realization x of X ∼ BIN(n, p), a family of
conjugate priors is the family of beta distributions BETA(α, β) where we note from equation (2)
that for x = 0, 1, . . . , n,

n x
n−x Γ(α+β) α−1
(1 − p)β−1
Γ(α)Γ(β) p
x p (1 − p)
h(p | x) = R 1 n
x
n−x Γ(α+β) pα−1 (1 − p)β−1 dp
0 x p (1 − p)
Γ(α)Γ(β)
Γ(α + β + n)
pα+x−1 (1 − p)β+n−x−1 ,
Γ(α + x)Γ(β + n − x)
= 0, otherwise.
=

2

0 ≤ p ≤ 1,

That is, the posterior distribution is also beta with updated parameters α + x and β + n − x.
3.

RELATIONSHIPS AND PROPERTIES OF THE POISSON DISTRIBUTION

Suppose that random variable X has a Poisson distribution with parameter λ ≥ 0, denoted by
X ∼ POI(λ). Then, for λ > 0, the pmf of X, denoted by fX (x | λ), is
e−λ λx
, x = 0, 1, 2, . . . ,
x!
= 0, otherwise,

fX (x | λ) = P (X = x | λ) =

and fX (0 | 0) = 1.
Suppose random variable Y has a gamma distribution with parameters α > 0 and β > 0, denoted
by Y ∼ GAM(α, β). Then the pdf of Y , denoted by fY (y | α, β), is
1
y α−1 e−y/β ,
β α Γ(α)
= 0, otherwise.

fY (y | α, β) =

y > 0,

Successive integration by parts leads to a relationship between the cdf’s of the Poisson and
gamma distributions. If X ∼ POI(λ) and Y ∼ GAM(i + 1, 2) for nonnegative integer i, then
i
X
e−λ λx

x=0

x!

=1−

1
2i+1 i!

Z

2λ

ti e−t/2 dt.

(3)

0

That is, FX (i | λ) = P (X ≤ i | λ) = 1 − P (Y ≤ 2λ | i + 1, 2) = 1 − FY (2λ | i + 1, 2). For fixed
nonnegative integer i, it follows from equation (3) that the function P (X ≤ i | λ) is continuous and
decreasing in λ; for positive integer j, P (X ≥ j | λ) = 1 − P (X ≤ j − 1 | λ) is continuous and
increasing in λ; and for 1 ≤ i ≤ j, P (i ≤ X ≤ j | λ) is continuous, and increasing for 0 ≤ λ < λ(i, j)
and decreasing for λ ≥ λ(i, j) with maximum at λ = λ(i, j) = (i · · · j)1/(j−i+1) . Also, λ(0, j) = 0 for
j ≥ 0.
Suppose that the Poisson parameter λ is unknown and we wish to estimate it using Bayesian
methods. For a realization x of X ∼ POI(λ), a family of conjugate priors is the family of gamma
distributions GAM(α, β) where for x = 0, 1, 2, · · · , the pdf h(λ | x) of the posterior distribution is
given by
h(λ | x) =

1
e−λ λx
α−1 −λ/β
e
x!
β α Γ(α) λ
R ∞ e−λ λx 1
α−1 e−λ/β
x!
β α Γ(α) λ
0

dλ

1
λα+x−1 e−λ/[β/(1+β)] ,
[β/(1 + β)]α+x Γ(α + x)
= 0, otherwise.
=

λ > 0,

That is, the posterior distribution is also gamma with updated parameters α + x and β/(1 + β).

3

4.

RELATIONSHIPS AND PROPERTIES OF THE HYPERGEOMETRIC
DISTRIBUTION

Suppose that integer-valued random variable X has a hypergeometric distribution with parameters n, M , and N , denoted by X ∼ HYP(n, M, N ), where n, M , and N are integers with 1 ≤ n ≤ N
and 0 ≤ M ≤ N . Then, for given n and N , and for 0 < M < N , the pmf of X, denoted by
fX (x | M ), is


M N −M
fX (x | M ) = P (X = x | M ) =

x

= 0,

n−x

N
n

,

max(0, n − N + M ) ≤ x ≤ min(n, M ),

otherwise,

(4)

and fX (0 | 0) = fX (n | N ) = 1.
Suppose that random variable Y has a specially defined discrete distribution with parameters a,
b, and c, denoted by Y ∼ ABC(a, b, c), where a, b, and c are nonnegative integers. Then, for c > 0,
the pmf of Y , denoted by fY (y | a, b, c), is


a+y b+c−y
fY (y | a, b, c) = P (Y = y | a, b, c) =

= 0,

a
b

a+b+c+1
a+b+1

,

y = 0, 1, . . . , c,

otherwise,

and fY (0 | a, b, 0) = 1. We note that formula (12.16) of Feller (1968, p.65) can be used to prove that


c 
X
a+y
b+c−y
y=0

a

b

=



a+b+c+1
.
a+b+1

We also note that the ABC distribution is just a special case of the Polya (or beta-binomial)
distribution (Dyer and Pierce, 1993, p.2130). From equation (4), it easily follows that P (X ≤ n |
M ) = 1 for 0 ≤ M ≤ N . For 0 ≤ i < n ≤ N and 0 ≤ M ≤ N , we have from equation (4) that
 


i 
X
N
M
N −M
P (X ≤ i | M ) =
n
x
n−x
x=0



 

i
X
M
N −M −1
N −M −1
+
=
x
n−x−1
n−x
x=0




i
i
X M N − M − 1
X M
N −M −1
+
=
x
n−x
x
n−x−1
x=0
x=0



 X
i 
i+1 
X
M
N −M −1
M
N −M −1
+
=
x
n−x
x−1
n−x
x=0
x=1

4

 
  

M
N −M −1
M
N −M −1
=
−
i
n−i−1
−1
n






i
X
M
M
N −M −1
+
+
x−1
x
n−x
x=0


 
 X
i 
M +1 N −M −1
M
N −M −1
=
+
x
n−x
i
n−i−1
x=0
 
  
M
N −M −1
N
=
+
P (X ≤ i | M + 1),
(5)
i
n−i−1
n



M
−M−1
where by definition −1
= 0, Mi = 0 if M < i, and Nn−i−1
= 0 if M > N − n + i. Furthermore,
from the recursion relationship in equation (5), it follows that
NX
−n+i 


 
k
N −k−1
N
i
n−i−1
n
k=M


 
N
−n
X
i+k
n−i−1+N −n−k
N
=
i
n−i−1
n

P (X ≤ i | M ) =

k=M−i

=1−

M−i−1
X 
k=0

i+k
i


 
n−i−1+N −n−k
N
.
n−i−1
n

(6)

That is, if X ∼ HYP(n, M, N ) and Y ∼ ABC(i, n − i − 1, N − n) for integer i, 0 ≤ i < n ≤ N , then
FX (i | M ) = P (X ≤ i | M ) = 1 − P (Y ≤ M − i − 1 | i, n − i − 1, N − n) = 1 − FY (M − i − 1 |
i, n − i − 1, N − n) where, in particular,
P (X ≤ i | M ) = 1,
= 0,

if 0 ≤ M ≤ i,
if N − n + i < M ≤ N.

For 0 < i ≤ j < n ≤ N and 0 ≤ M ≤ N , we have from equation (5) that
 
 
 
N
N
N
P (i ≤ X ≤ j | M ) =
P (X ≤ j | M ) −
P (X ≤ i − 1 | M )
n
n
n
 
  
M
N −M −1
N
=
+
P (X ≤ j | M + 1)
j
n−j−1
n


  
M
N −M −1
N
−
−
P (X ≤ i − 1 | M + 1)
i−1
n−i
n
 
 


M
N −M −1
M
N −M −1
=
−
j
n−j−1
i−1
n−i
 
N
+
P (i ≤ X ≤ j | M + 1).
n

5

(7)

(8)

Similar to the determination of equation (6), it follows from the recursion relationship in equation
(8) that
NX
−n+j

 
  N −n+i−1
X  l N − l − 1N 
k
N −k−1
N
P (i ≤ X ≤ j | M ) =
−
j
n−j−1
n
i−1
n−i
n
k=M
l=M




N
−n
X
j+k
n−j−1+N −n−k
N
=
j
n−j−1
n
k=M−j

N
−n
X

−

l=M−i+1



 
i−1+l n−i+N −n−l
N
i−1
n−i
n

M−i
X


 
i−1+l n−i+N −n−l
N
=
i−1
n−i
n
l=0


 
M−j−1
X
j+k
n−j −1+N −n−k
N
−
j
n−j −1
n

(9)

k=0

where, in particular,
P (i ≤ X ≤ j | M ) = 0,

if either

0≤M <i

or N − n + j < M ≤ N.

We note in equation (8) that the difference
 
 




M
N −M −1
M
N −M −1
N −i
−
=−
< 0, if M = i − 1,
j
n−j−1
i−1
n−i
n−i


N −n+j
=
> 0, if M = N − n + j,
j

(10)

(11)

and for i ≤ M < N − n + j, the same difference
 
 


M
N −M −1
M
N −M −1
−
j
n−j −1
i−1
n−i
(N − M − 1)!
(N − M − 1)!
M!
M!
−
=
j!(M − j)! (n − j − 1)!(N − M − n + j)! (i − 1)!(M − i + 1)! (n − i)!(N − M − n + i − 1)!
M !(N − M − 1)!
=
(i − 1)!(M − j)!(n − j − 1)!(N − M − n + i − 1)!

1
1
×
(j · · · i) (N − M − n + j) · · · (N − M − n + i)

1
1
−
(12)
(M − i + 1) · · · (M − j + 1) (n − i) · · · (n − j)
where as M increases, the term 1/(N − M − n + j) · · · (N − M − n + i) increases and the term
1/(M − i + 1) · · · (M − j + 1) decreases
 N −M−1so that as M increases between i − 1 and N − n + j, the
N −M−1
M
difference M
−
goes from being negative to being positive and staying
j
n−j−1
i−1
n−i
positive.
6

In summary, P (X ≤ n | M ) equals 1 for 0 ≤ M ≤ N , and for fixed integer i, 0 ≤ i < n ≤ N ,
we see from equations (6) and (7) that P (X ≤ i | M ) equals 1 for 0 ≤ M ≤ i, is decreasing for
i < M ≤ N − n + i, and equals 0 for N − n + i < M ≤ N ; P (X ≥ n + 1 | M ) equals 0 for
0 ≤ M ≤ N , and for fixed integer j, 1 ≤ j ≤ n ≤ N , P (X ≥ j | M ) = 1 − P (X ≤ j − 1 | M ) equals 0
for 0 ≤ M ≤ j −1, is increasing for j −1 < M ≤ N −n+j −1, and equals 1 for N −n+j −1 < M ≤ N ;
and we see from equations (8) to (12) that for fixed integers i and j, 0 < i ≤ j < n ≤ N where we
define
 N −M−1
 N −M−1
M
Mn,N (i, j) = min{M | i ≤ M ≤ N − n + j and M
≥ i−1
},
j
n−j−1
n−i
P (i ≤ X ≤ j | M ) equals 0 for 0 ≤ M < i, is increasing for i ≤ M < Mn,N (i, j), is decreasing
for Mn,N (i, j) + 1 < M ≤ N − n + j, and
 Nequals
0 for N − n + j < M ≤ N with maximum at
M N −M−1
M
−M−1
either Mn,N (i, j) if j
> i−1
for M = Mn,N (i, j) so that P (i ≤ X ≤ j |
n−j−1
n−i
Mn,N
(i,
j))
>
P
(i
≤
X
≤
j
|
M
(i,
j)
+
1)
or
maximum
at both Mn,N (i, j) and Mn,N (i, j) + 1 if
n,N


 N −M−1
M N −M−1
M
=
for
M
=
M
(i,
j)
so
that
P (i ≤ X ≤ j | Mn,N (i, j)) = P (i ≤ X ≤
n,N
j
n−j−1
i−1
n−i
j | Mn,N (i, j) + 1).
Suppose that the hypergeometric parameters n and N are known but M is not and we wish to
estimate it using Bayesian methods. For a realization x of X ∼ HYP(n, M, N ), a family of conjugate
priors for M − x is the family of discrete distributions ABC(a, b, N ) where for x = 0, 1, . . . , n, the
pmf h(M | x) of the posterior distribution for M is given by
b+N −M
−M
)
(Mx )(Nn−x
) (a+M
a )(
b
N
a+b+N +1
(n)
( a+b+1 )
h(M | x) = P
b+N −M
a+M
N −M
M
)
N −n+x ( x )( n−x ) ( a )(
b
N
a+b+N +1
M=x
)
(n
( a+b+1 )


a+M b+N −M

=

a+x
b+n−x

a+b+N +1
a+b+n+1

= 0,

,

x ≤ M ≤ N − n + x,

otherwise,

(13)

from which it easily follows that the pmf h(M − x | x) of the posterior distribution for M − x is
given by


a+x+M−x b+n−x+N −n−M+x
h(M − x | x) =

= 0,

a+x
b+n−x

a+x+b+n−x+N −n+1
a+x+b+n−x+1

otherwise.

,

0 ≤ M − x ≤ N − n,

(14)

That is, the posterior distribution for M − x is also ABC with updated parameters a + x, b + n − x,
and N − n.
Finally, we note that as a family of conjugate priors for the hypergeometric distribution
HYP(n, M, N ), the family of discrete distributions ABC(a, b, N ) has, in addition to unimodal members, strictly increasing members ABC(a, 0, N ), strictly decreasing members ABC(0, b, N ), and the
discrete uniform distribution ABC(0, 0, N ).

7

REFERENCES
Dyer, D. and Pierce, R. L. (1993), ”On the choice of the prior distribution in hypergeometric
sampling,” Communications in Statistics - Theory and Methods, 22(8), 2125-2146.
Feller, W. (1968), An Introduction to Probability Theory and Its Applications, Vol.1, (3rd ed.),
John Wiley & Sons, Inc.

8

