You are on page 1of 15

3.

2 Hypergeometric Distribution
3.5, 3.9 Mean and Variance

Prof. Tesler

Math 186
Winter 2017

Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 1 / 15


30
Sampling from an urn

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
20

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
c()

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
10

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
0

An urn has 1000 balls: 700 green, 300 blue.


Pick a ball at random. The probability it’s green is
p = 700/1000 = 0.7.
0 10 20 30 40

Index
Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 2 / 15
30
Sampling from an urn

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
20

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
c()

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
10

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
0

An urn has 1000 balls: 700 green, 300 blue.


The urn needs to be well-mixed. Here, if you pick from the top, the
chance of blue is much higher than in the total population.
0 10 20 30 40

Index
Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 3 / 15
Sampling with and without replacement
A urn has 1000 balls: 700 green, 300 blue.
Sampling with replacement
Pick one of the 1000 balls. Record color (green or blue).
Put it back in the urn and shake it up.
Again pick one of the 1000 balls and record color.
Repeat n times.
On each draw, the probability of green is 700/1000.
700
The # green balls drawn has a binomial distribution, p = 1000 = .7
Sampling without replacement
Pick one of the 1000 balls, record color, and set it aside.
Pick one of the remaining 999 balls, record color, set it aside.
Pick one of the remaining 998 balls, record color, set it aside.
Repeat n times, never re-using the same ball.
Equivalently, take n balls all at once and count them by color.
The # green balls drawn has a hypergeometric distribution.
Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 4 / 15
Sampling with and without replacement
A urn has 1000 balls: 700 green, 300 blue.
A sample of 7 balls is drawn.
What is the probability that it has 3 green balls and 4 blue balls?

Sampling with replacement


700
Each draw has the same probability to be green: p = 1000 = 0.7
7 3 7
P(3 green & 4 blue) = 3 p (1 − p) = 3 (0.7)3 (0.3)4 = 0.0972405
4
 

Sampling without replacement


700 300
 
# samples with 3 green balls and 4 blue balls: 3 · 4
1000

# samples of size 7: 7
P(3 green and 4 blue) =
700 300
 
# samples with 3 green and 4 blue 3 4
= 1000
 ≈ 0.0969179
# samples of size 7 7

Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 5 / 15


Hypergeometric distribution
Exact distribution for sampling without replacement

Notation
Population (full urn) Sample
N balls n balls
K green k green
N − K blue n − k blue
p = K/N p̂ = k/n
Hypergeometric distribution (for sampling w/o replacement)
Draw n balls without replacement.
Let random variable X be the number of green balls drawn.
Its pdf is given by the hypergeometric
  distribution
. 
K N−K N
P(X = k) =
k n−k n
np(1−p)(N−n)
E(X) = np and Var(X) = (N−1) .

Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 6 / 15


Sampling without replacement (2nd method)
A urn has 1000 balls: 700 green (G), 300 blue (B).
What is the probability to draw 7 balls in the order GBBGBGB?
P(1st is G) = 700/1000
P(2nd is B|1st is G) = 300/999
P(3rd is B|first two are G,B) = 299/998
700 300 299 699 298 698 297
P(GBBGBGB) = · · · · · ·
1000 999 998 997 996 995 994
(700 · 699 · 698)(300 · 299 · 298 · 297)
=
1000 · 999 · 998 · 997 · 996 · 995 · 994
Probability a sample of size 7 has 3 green and 4 blue
Each sequence of 3 G’s and 4 B’s has that same probability;
numerator factors are in a different order, but the result is equal.
7

Adding probabilities of all 3 sequences of 3 G’s and 4 B’s gives
 
7 (700 · 699 · 698)(300 · 299 · 298 · 297)
P(3 G’s & 4 B’s) =
3 1000 · 999 · 998 · 997 · 996 · 995 · 994
Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 7 / 15
Sampling without replacement
Equivalence of both methods, and approximation by binomial distribution

A urn has 1000 balls: 700 green, 300 blue.


A sample of 7 balls is drawn, without replacement.
What is the probability that it has 3 green balls and 4 blue balls?

Probability with hypergeometric distribution (1st method)


700 300 700·699·698 300·299·298·297
 
3 4 3! · 4!
= 1000
 = 1000·999·998·997·996·995·994
7 7!

7! 700·699·698
= 3! 4! · 1000·999·998 · 300·299·298·297
997·996·995·994
nd
2 method to compute hypergeometric distribution
7
(700/1000)3 (300/1000)4

≈ 3
Probability with binomial distribution

If the numbers of green, blue, and total balls in the sample are much
smaller than in the urn, the hypergeometric pdf ≈ the binomial pdf.
Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 8 / 15
Hypergeometric distribution vs. Binomial distribution
p = 0.25, Population size N = 10000
# trials n = 100, p=0.25, # trials n=100, pop. size N=10000, n/N=1.00% n/N = 1% # trials n = 500, p=0.25, # trials n=500, pop. size N=10000, n/N=5.00% n/N = 5%

0.04
!
! !!!
!
!
!
!
! Binomial !!
!
!!!!
!!
! Binomial
!
Hypergeometric ! !
Hypergeometric
0.08

! ! !
! !
! ! !
!
! !
!
!
! !
!
!
!

0.03
! !
Probability density

Probability density
!
!
!
0.06

!
!
!
!
!
! !

!
!
!

0.02
!
!
! !
0.04

!
! !
!

! !
! !
!
!
! !
! !
! !

0.01
! !
!
0.02

!
! !
! !
! !
! !
! ! !
! !
!
! !
! !
! ! !
! ! !
! !
!
! ! !
! !
! !! !
0.00

0.00
!!
! !! !!
! ! !!!! !!!
! !!
!
! ! ! !!!
!! !!
! ! ! ! ! ! ! ! ! ! !!!!!!!!!! !!!!!!!!!

10 15 20 25 30 35 40 100 120 140 160


k k

# trials n = 1000, p=0.25, # trials n=1000, pop. size N=10000, n/N=10.00% n/N = 10% # trials n = 5000, p=0.25, # trials n=5000, pop. size N=10000, n/N=50.00% n/N = 50%
0.030

! !!
!
!! !! !! !
!
!
! !
!!! !
! Binomial !
!
!
! !
!
!
!
! Binomial
! !! ! ! !
!!
!
!!
!
!
! Hypergeometric !
!
!
!
! Hypergeometric

0.015
! ! !
!!
!! ! !
!! !!
! !
! ! !
! ! ! !
! !
! ! !

Probability density
Probability density

!
! ! ! !
0.020

!
! ! !
!!
!!
!!
!! !
! ! !!
! !!
! !! !! !
! ! !
! !
!
!
! ! ! ! !
!
! ! ! !
! !
! ! ! !

0.010
! ! !
! !! ! !
! !
! !
!
! !! !!
! ! !
!! !!
! ! !
! ! !
! !
!
! !
! !
! !
! !
! ! ! !
! ! !!
! !
! !!
! ! ! !!
! !
! !! !!
!
0.010

! !
! ! !! !!
!
! ! ! ! !!!
!
0.005

! ! ! !
! ! ! ! !
! ! ! !
! ! !
! ! ! ! ! ! !
! ! ! ! ! !
! ! ! !
! ! ! !
! ! ! !
!! !! ! !
! ! ! !
!! !! ! !
! ! ! !
!! !! ! ! ! !
! !
! ! ! !
!! !! !! ! ! !
!
!! !! !! ! ! !
!
! ! ! !
!! !! !
! ! ! !!
!! !! !
! ! ! !!
! ! ! !
!! !! !! !
! !! !
!
!!! ! !
0.000
0.000

! ! ! ! !
!! !! !! !! !
!
!
!!
!!! !!! !!
!!
!! !
! !!
!!
!!
!!!! !!
!! !!! !!
!!
!!
!!
!! !
!!
!
!!
!!
!!
!!! !! !!
!!
!! !!
!! !
!!
! !!
!!
!
!
!!!! !!!!!
!!!!!!!!!!! !
!!
!!
!! !
!!
!! !
!!
!! !
!!
!!
!!
!
!!!!!!!!!!!!!!!! !!!!! !
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!
!!
!
!
!!
!
!
!!
!
!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
! !!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!
!
!!
!
!
!!
!
!
!!
!
!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!
!!

200 220 240 260 280 300 1150 1200 1250 1300 1350
k k

Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 9 / 15


Multihypergeometric distribution

30
Sampling without replacement from an urn with multiple colors
Illustrated for 3 colors, but works for any number of colors

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

20
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
c()

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
10

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
0

An urn has 1000 balls: 500 red, 300 blue, 200 green.
Draw a sample of 10 balls without replacement.
What is the probability
0
it has 2 red,
10 20
3 blue,
30
and 540green balls?
Index
500 300 200
  
# samples with 2 red, 3 blue, 5 green
= 2 1000 3
 5 ≈ 0.00535
# samples of size 10 10

Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 10 / 15


30
Election polls
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

20
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
c()

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
10

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
0

A poll is taken before an election to estimate the fraction voting for


each option.
0 10 20 30 40
Should sample w/o replacementIndex
(hypergeometric distribution), to
avoid polling the same person twice.

If the sample size is much smaller than the population size, can
approximate by binomial distribution.

Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 11 / 15


30
Election polls
● A ● B ● Non−voter

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

20
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
c()

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
10

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
0

Complications in using balls in an urn to model a poll include:


Sample may have non-voters (light color above).
Sample may not 0 be representative.
10 20 30 40

Polling based on geography, landlines,


Index cellphones, etc. may give
different proportions in sample than in population.
Above: more B’s than A’s at the top, but more A’s than B’s overall.
Respondents may not reply, may not tell the truth, may change
their minds by the time of the election, . . .
Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 12 / 15
3.5 Expected value of hypergeometric distribution
Let p = K/N be the fraction of balls in the urn that are green.
Draw a sample of n balls without replacement.

1 if the ith ball is green;
For i = 1, . . . , n, let Xi =
0 otherwise.
The total number of green balls in the sample is X = X1 + · · · + Xn .
The Xi ’s are identically distributed, but dependent. For each ball:
P(Xi = 1) = K/N = p
P(Xi = 0) = 1 − p E(Xi ) = 1 · P(Xi = 1) + 0 · P(Xi = 0) = p
This does not use info about the other balls.
It is not a conditional probability, such as P(X3 = 1|X1 = a, X2 = b).
E(X) = E(X1 ) + · · · + E(Xn ) = p + p + · · · + p = np = nK/N.
| {z }
n

We calculated E(X) this way for the binomial distribution too!


Dependence between Xi ’s isn’t an issue for E(X), but is for Var(X).
Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 13 / 15
3.9 Variance of hypergeometric distribution
Xi ’s are dependent, so variance isn’t additive. Instead, use:
X
n X
Var(X) = Var(X1 + · · · + Xn ) = Var(Xi ) + 2 Cov(Xi , Xj ) .
i=1 16i<j6n

(Generalizing Var(U + V) = Var(U) + Var(V) + 2 Cov(U, V).)

Var(Xi ) = E(Xi 2 ) − (E(Xi ))2 :


Since Xi = 0 or 1, we have Xi 2 = Xi . Thus, E(Xi 2 ) = E(Xi ), so

2 K K2 K(N − K)
2
Var(Xi ) = E(Xi ) − (E(Xi )) = p − p = − 2 = 2
.
N N N

For i < j, Cov(X


 i j
, X ) = E(Xi Xj ) − E(Xi )E(Xj ):
1 if Xi = Xj = 1; K(K−1)
Xi Xj = so P(Xi Xj =1) = P(Xi =Xj =1) = N(N−1) .
0 otherwise.
K(K−1)
E(Xi Xj ) = 1P(Xi Xj = 1) + 0P(Xi Xj = 0) = P(Xi Xj = 1) = N(N−1) .
K(K−1) K(K−N)
Cov(Xi , Xj ) = N(N−1) − (K/N)2 = N 2 (N−1) .

Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 14 / 15


Variance of hypergeometric distribution

Var(X) = Var(X1 + · · · + Xn )
X n X
= Var(X ) + 2 Cov(Xi , Xj )
| {z i} | {z }
i=1 16i<j6n
|{z} = K(N−K)
2 | {z } =
K(K−N)
N N 2 (N−1)
n terms  n
terms
2

n K(N − K) 2n(n − 1) K(K − N)


= 2
+
N 2 N 2 (N − 1)
 
n K(N − K) n−1 n K(N − K)(N − n)
= 1− =
N 2 N−1 N2 (N − 1)

Using p = K/N, substitute K = Np to rewrite this as

N−n
Var(X) = np(1 − p)
N−1

Prof. Tesler 3.2 Hypergeometric Distribution Math 186 / Winter 2017 15 / 15

You might also like