Hypergeometric Distribution
edit
Hypergeometric
Probability mass function
Cumulative distribution function
Notation
h
(
k
)
=
(
m
k
)
(
N
−
m
n
−
k
)
(
N
n
)
{\displaystyle h(k)={{{m \choose k}{{N-m} \choose {n-k}}} \over {N \choose n}}}
Parameters
N
∈
{
0
,
1
,
2
,
…
}
m
∈
{
0
,
1
,
2
,
…
,
N
}
n
∈
{
0
,
1
,
2
,
…
,
N
}
{\displaystyle {\begin{aligned}N&\in \left\{0,1,2,\dots \right\}\\m&\in \left\{0,1,2,\dots ,N\right\}\\n&\in \left\{0,1,2,\dots ,N\right\}\end{aligned}}\,}
Support
k
∈
{
max
(
0
,
n
+
m
−
N
)
,
…
,
min
(
n
,
m
)
}
{\displaystyle \scriptstyle {k\,\in \,\left\{\max {(0,\,n+m-N)},\,\dots ,\,\min {(n,\,m)}\right\}}\,}
PMF
(
m
k
)
(
N
−
m
n
−
k
)
(
N
n
)
{\displaystyle {{{m \choose k}{{N-m} \choose {n-k}}} \over {N \choose n}}}
CDF
1
−
(
n
k
+
1
)
(
N
−
n
m
−
k
−
1
)
(
N
m
)
3
F
2
[
1
,
k
+
1
−
m
,
k
+
1
−
n
k
+
2
,
N
+
k
+
2
−
m
−
n
;
1
]
,
{\displaystyle 1-{{{n \choose {k+1}}{{N-n} \choose {m-k-1}}} \over {N \choose m}}\,_{3}F_{2}\!\!\left[{\begin{array}{c}1,\ k+1-m,\ k+1-n\\k+2,\ N+k+2-m-n\end{array}};1\right],}
where
p
F
q
{\displaystyle \,_{p}F_{q}}
is the generalized hypergeometric function
Mean
n
m
N
{\displaystyle {nm \over N}}
Median
mode =
⌈
(
n
+
1
)
(
m
+
1
)
N
+
2
⌉
−
1
,
⌊
(
n
+
1
)
(
m
+
1
)
N
+
2
⌋
{\displaystyle \left\lceil {\frac {(n+1)(m+1)}{N+2}}\right\rceil -1,\left\lfloor {\frac {(n+1)(m+1)}{N+2}}\right\rfloor }
Variance
n
m
N
(
1
−
n
N
)
(
1
−
m
−
1
N
−
1
)
{\displaystyle {nm \over N}\left(1-{n \over N}\right)\left(1-{m-1 \over N-1}\right)}
Skewness
(
N
−
2
m
)
(
N
−
1
)
1
2
(
N
−
2
n
)
[
n
m
(
N
−
m
)
(
N
−
n
)
]
1
2
(
N
−
2
)
{\displaystyle {\frac {(N-2m)(N-1)^{\frac {1}{2}}(N-2n)}{[nm(N-m)(N-n)]^{\frac {1}{2}}(N-2)}}}
Ex. kurtosis
1
n
m
(
N
−
m
)
(
N
−
n
)
(
N
−
2
)
(
N
−
3
)
⋅
{\displaystyle \left.{\frac {1}{nm(N-m)(N-n)(N-2)(N-3)}}\cdot \right.}
[
(
N
−
1
)
N
2
(
N
(
N
+
1
)
−
6
m
(
N
−
m
)
−
6
n
(
N
−
n
)
)
+
{\displaystyle {\Big [}(N-1)N^{2}{\Big (}N(N+1)-6m(N-m)-6n(N-n){\Big )}+{}}
+
6
n
m
(
N
−
m
)
(
N
−
n
)
(
5
N
−
6
)
]
{\displaystyle {}+6nm(N-m)(N-n)(5N-6){\Big ]}}
Entropy
???
MGF
(
N
−
m
n
)
2
F
1
(
−
n
,
−
m
;
N
−
m
−
n
+
1
;
e
t
)
(
N
n
)
{\displaystyle {\frac {{N-m \choose n}\scriptstyle {\,_{2}F_{1}(-n,-m;N-m-n+1;e^{t})}}{N \choose n}}\,\!}
CF
(
N
−
m
n
)
2
F
1
(
−
n
,
−
m
;
N
−
m
−
n
+
1
;
e
i
t
)
(
N
n
)
{\displaystyle {\frac {{N-m \choose n}\scriptstyle {\,_{2}F_{1}(-n,-m;N-m-n+1;e^{it})}}{N \choose n}}}
The hypergeometric distribution describes the number of successes in a sequence of n draws without replacement from a population of N that contained m total successes.
Its probability mass function is:
f
(
x
)
=
(
m
x
)
(
N
−
m
n
−
x
)
(
N
n
)
for all
x
∈
[
0
,
n
]
{\displaystyle f(x)={{{m \choose x}{{N-m} \choose {n-x}}} \over {N \choose n}}{\text{ for all }}x\in [0,n]}
Technically the support for the function is only where x∈[max(0, n+m-N), min(m, n)] . In situations where this range is not [0,n] , f(x)=0 since for k>0 ,
(
0
k
)
=
0
{\displaystyle {0 \choose k}=0}
.
Probability Density Function
edit
We first check to see that f(x) is a valid pmf. This requires that it is non-negative everywhere and that its total sum is equal to 1. The first condition is obvious. For the second condition we will start with Vandermonde's identity
∑
x
=
0
n
(
a
x
)
(
b
n
−
x
)
=
(
a
+
b
n
)
{\displaystyle \sum _{x=0}^{n}{a \choose x}{b \choose n-x}={a+b \choose n}}
∑
x
=
0
n
(
a
x
)
(
b
n
−
x
)
(
a
+
b
n
)
=
1
{\displaystyle \sum _{x=0}^{n}{{a \choose x}{b \choose n-x} \over {a+b \choose n}}=1}
We now see that if a=m and b=N-m that the condition is satisfied.
We derive the mean as follows:
E
[
X
]
=
∑
x
=
0
n
x
⋅
f
(
x
;
n
,
m
,
N
)
=
∑
x
=
0
n
x
⋅
(
m
x
)
(
N
−
m
n
−
x
)
(
N
n
)
{\displaystyle \operatorname {E} [X]=\sum _{x=0}^{n}x\cdot f(x;n,m,N)=\sum _{x=0}^{n}x\cdot {{{m \choose x}{{N-m} \choose {n-x}}} \over {N \choose n}}}
E
[
X
]
=
0
⋅
(
m
0
)
(
N
−
m
n
−
0
)
(
N
n
)
+
∑
x
=
1
n
x
⋅
(
m
x
)
(
N
−
m
n
−
x
)
(
N
n
)
{\displaystyle \operatorname {E} [X]=0\cdot {{{m \choose 0}{{N-m} \choose {n-0}}} \over {N \choose n}}+\sum _{x=1}^{n}x\cdot {{{m \choose x}{{N-m} \choose {n-x}}} \over {N \choose n}}}
We use the identity
(
a
b
)
=
a
b
(
a
−
1
b
−
1
)
{\displaystyle {\binom {a}{b}}={\frac {a}{b}}{\binom {a-1}{b-1}}}
in the denominator.
E
[
X
]
=
0
+
∑
x
=
1
n
x
⋅
(
m
x
)
(
N
−
m
n
−
x
)
N
n
(
N
−
1
n
−
1
)
{\displaystyle \operatorname {E} [X]=0+\sum _{x=1}^{n}x\cdot {{{m \choose x}{{N-m} \choose {n-x}}} \over {{N \over n}{{N-1} \choose {n-1}}}}}
E
[
X
]
=
n
N
∑
x
=
1
n
x
⋅
(
m
x
)
(
N
−
m
n
−
x
)
(
N
−
1
n
−
1
)
{\displaystyle \operatorname {E} [X]={n \over N}\sum _{x=1}^{n}x\cdot {{{m \choose x}{{N-m} \choose {n-x}}} \over {{N-1} \choose {n-1}}}}
Next we use the identity
b
(
a
b
)
=
a
(
a
−
1
b
−
1
)
{\displaystyle b{\binom {a}{b}}=a{\binom {a-1}{b-1}}}
in the first binomial of the numerator.
E
[
X
]
=
n
N
∑
x
=
1
n
m
(
m
−
1
x
−
1
)
(
N
−
m
n
−
x
)
(
N
−
1
n
−
1
)
{\displaystyle \operatorname {E} [X]={n \over N}\sum _{x=1}^{n}{m{{m-1 \choose x-1}{{N-m} \choose {n-x}}} \over {{N-1} \choose {n-1}}}}
Next, for the variables inside the sum we define corresponding prime variables that are one less. So N′=N−1 , m′=m−1 , x′=x−1 , n′=n-1 .
E
[
X
]
=
m
n
N
∑
x
′
=
0
n
′
(
m
′
x
′
)
(
N
′
−
m
′
n
′
−
x
′
)
(
N
′
n
′
)
{\displaystyle \operatorname {E} [X]={mn \over N}\sum _{x'=0}^{n'}{{{m' \choose x'}{{N'-m'} \choose {n'-x'}}} \over {{N'} \choose {n'}}}}
E
[
X
]
=
m
n
N
∑
x
′
=
0
n
′
f
(
x
′
;
n
′
,
m
′
,
N
′
)
{\displaystyle \operatorname {E} [X]={mn \over N}\sum _{x'=0}^{n'}f(x';n',m',N')}
Now we see that the sum is the total sum over a Hypergeometric pmf with modified parameters. This is equal to 1. Therefore
E
[
X
]
=
n
m
N
{\displaystyle \operatorname {E} [X]={nm \over N}}
We first determine E(X2 ).
E
[
X
2
]
=
∑
x
=
0
n
f
(
x
;
n
,
m
,
N
)
⋅
x
2
=
∑
x
=
0
n
(
m
x
)
(
N
−
m
n
−
x
)
(
N
n
)
⋅
x
2
{\displaystyle \operatorname {E} [X^{2}]=\sum _{x=0}^{n}f(x;n,m,N)\cdot x^{2}=\sum _{x=0}^{n}{{{m \choose x}{{N-m} \choose {n-x}}} \over {N \choose n}}\cdot x^{2}}
E
[
X
2
]
=
(
m
0
)
(
N
−
m
n
−
0
)
(
N
n
)
⋅
0
2
+
∑
x
=
1
n
(
m
x
)
(
N
−
m
n
−
x
)
(
N
n
)
⋅
x
2
{\displaystyle \operatorname {E} [X^{2}]={{{m \choose 0}{{N-m} \choose {n-0}}} \over {N \choose n}}\cdot 0^{2}+\sum _{x=1}^{n}{{{m \choose x}{{N-m} \choose {n-x}}} \over {N \choose n}}\cdot x^{2}}
E
[
X
2
]
=
0
+
∑
x
=
1
n
m
(
m
−
1
x
−
1
)
(
N
−
m
n
−
x
)
N
n
(
N
−
1
n
−
1
)
⋅
x
{\displaystyle \operatorname {E} [X^{2}]=0+\sum _{x=1}^{n}{{m{m-1 \choose x-1}{{N-m} \choose {n-x}}} \over {{N \over n}{{N-1} \choose {n-1}}}}\cdot x}
E
[
X
2
]
=
m
n
N
∑
x
=
1
n
(
m
−
1
x
−
1
)
(
N
−
m
n
−
x
)
(
N
−
1
n
−
1
)
⋅
x
{\displaystyle \operatorname {E} [X^{2}]={mn \over N}\sum _{x=1}^{n}{{{m-1 \choose x-1}{{N-m} \choose {n-x}}} \over {{N-1} \choose {n-1}}}\cdot x}
We use the same variable substitution as when deriving the mean.
E
[
X
2
]
=
m
n
N
∑
x
′
=
0
n
′
(
m
′
x
′
)
(
N
′
−
m
′
n
′
−
x
′
)
(
N
′
n
′
)
(
x
′
+
1
)
{\displaystyle \operatorname {E} [X^{2}]={mn \over N}\sum _{x'=0}^{n'}{{{m' \choose x'}{{N'-m'} \choose {n'-x'}}} \over {{N'} \choose {n'}}}(x'+1)}
E
[
X
2
]
=
m
n
N
[
∑
x
′
=
0
n
′
(
m
′
x
′
)
(
N
′
−
m
′
n
′
−
x
′
)
(
N
′
n
′
)
x
′
+
∑
x
′
=
0
n
′
(
m
′
x
′
)
(
N
′
−
m
′
n
′
−
x
′
)
(
N
′
n
′
)
]
{\displaystyle \operatorname {E} [X^{2}]={mn \over N}\left[\sum _{x'=0}^{n'}{{{m' \choose x'}{{N'-m'} \choose {n'-x'}}} \over {{N'} \choose {n'}}}x'+\sum _{x'=0}^{n'}{{{m' \choose x'}{{N'-m'} \choose {n'-x'}}} \over {{N'} \choose {n'}}}\right]}
The first sum is the expected value of a hypergeometric random variable with parameteres (n',m',N'). The second sum is the total sum that random variable's pmf.
E
[
X
2
]
=
m
n
N
[
n
′
m
′
N
′
+
1
]
{\displaystyle \operatorname {E} [X^{2}]={mn \over N}\left[{n'm' \over N'}+1\right]}
E
[
X
2
]
=
m
n
N
[
(
n
−
1
)
(
m
−
1
)
(
N
−
1
)
+
1
]
=
m
n
N
[
(
n
−
1
)
(
m
−
1
)
+
(
N
−
1
)
(
N
−
1
)
]
{\displaystyle \operatorname {E} [X^{2}]={mn \over N}\left[{(n-1)(m-1) \over (N-1)}+1\right]={mn \over N}\left[{{(n-1)(m-1)+(N-1)} \over (N-1)}\right]}
We then solve for the variance
Var
(
X
)
=
E
[
X
2
]
−
(
E
[
X
]
)
2
{\displaystyle \operatorname {Var} (X)=\operatorname {E} [X^{2}]-(\operatorname {E} [X])^{2}}
Var
(
X
)
=
m
n
N
[
(
n
−
1
)
(
m
−
1
)
+
(
N
−
1
)
(
N
−
1
)
]
−
(
m
n
N
)
2
{\displaystyle \operatorname {Var} (X)={mn \over N}\left[{{(n-1)(m-1)+(N-1)} \over (N-1)}\right]-\left({mn \over N}\right)^{2}}
Var
(
X
)
=
N
m
n
N
2
[
(
n
−
1
)
(
m
−
1
)
+
(
N
−
1
)
(
N
−
1
)
]
−
(
N
−
1
)
(
m
n
)
2
(
N
−
1
)
N
2
{\displaystyle \operatorname {Var} (X)={Nmn \over N^{2}}\left[{{(n-1)(m-1)+(N-1)} \over (N-1)}\right]-{(N-1)(mn)^{2} \over (N-1)N^{2}}}
Var
(
X
)
=
n
m
(
N
−
n
)
(
N
−
m
)
N
2
(
N
−
1
)
{\displaystyle \operatorname {Var} (X)={nm(N-n)(N-m) \over N^{2}(N-1)}}
or, equivalently,
Var
(
X
)
=
n
m
N
(
1
−
n
N
)
(
1
−
m
−
1
N
−
1
)
{\displaystyle \operatorname {Var} (X)={nm \over N}\left(1-{n \over N}\right)\left(1-{m-1 \over N-1}\right)}