4-6. Hypergeometric Distribution

1. Hypergeometric Distribution

Hypergeometric distribution, in statisticsarrow-up-right, distribution functionarrow-up-right in which selections are made from two groups without replacing members of the groups. The hypergeometric distribution differs from the binomial distributionarrow-up-right in the lack of replacements. Thus, it often is employed in random samplingarrow-up-right for statistical quality controlarrow-up-right. A simple everyday example would be the random selection of members for a team from a populationarrow-up-right of girls and boys.

In symbols, let the size of the population selected from be NN , with rr elements of the population belonging to one group (for convenience, called successes) and (Nr)(N − r ) belonging to the other group (called failures). Further, let the number of samples drawn from the population be nn , such that 0nN0 ≤ n ≤ N . Then the probability ( PP ) that the number ( XX ) of elements drawn from the successful group is equal to some number ( xx ) is given by

P(X=x)=(rx)(Nrnx)(Nn)P(X=x) = \frac { \binom{r}{x}\binom{N-r}{n-x} }{ \binom{N}{n}} :XHG(n,N,r): X \sim HG(n, N, r)

using the notation of binomial coefficientsarrow-up-right, or, using factorialarrow-up-right notation,

P(X=x)=n!r!(Nn)!(Nr)!N!x!(rx)!(nx)!(Nrn+x)!P(X=x) = \frac{n!r!(N-n)!(N-r)!}{N!x!(r-x)!(n-x)!(N-r-n+x)!} (hypergeometric factorial formula)

2. Mean and Variance

The meanarrow-up-right of the hypergeometric distribution is μ=nP(success)=nrN\mu = n * P(success) = n \frac{r}{N} ,

and the variancearrow-up-right (square of the standard deviationarrow-up-right) is σ=nr(Nr)(Nn)N2(N1)\sigma = \frac{nr(N − r)(N − n)}{N^2(N − 1)} .

Var(X)=np(1p)NnN1Var(X) = np(1-p) \frac{N-n}{N-1} , if p=rnp = \frac{r}{n}

EXAMPLE 15. A batch of 100 piston rings is known to contain 10 defective rings. If two piston rings are drawn from the batch, write down the probabilities that:

  1. the first ring is defective;

  2. the second ring is defective given that the first one is defective.

[ Solution ]

  1. 10/ 100 = 1/10

  2. 9/99 = 1/11

EAXMPLE 16. A batch of 10 rocker cover gaskets contains 4 defective gaskets. If we draw samples of size 3 without replacement, from the batch of 10, find the probability that a sample contains 2 defective gaskets. And Find the expectation and variance of samples.

[ Solution ]

  • P(X=x)=(rx)(Nrnx)(Nn)P(X=x) = \frac { \binom{r}{x}\binom{N-r}{n-x} }{ \binom{N}{n}}, N=10,n=3,r=4 and x=2N =10, n =3, r=4 \space and \space x=2 => P(X=2)=4C26C110C3=66120=0.3P(X=2) = \frac {_4C_2 * _6C_1} {_{10}C_3} = \frac {6*6}{120} = 0.3

EXAMPLE 17. In the manufacture of car tyres, a particular production process is know to yield 10 tyres with defective walls in every batch of 100 tyres produced. From a production batch of 100 tyres, a sample of 4 is selected for testing to destruction. Find:

  1. the probability that the sample contains 1 defective tyre

  2. the expectation of the number of defectives in samples of size 4

  3. the variance of the number of defectives in samples of size 4.

[ Solution ]

  • P(X=x)=(rx)(Nrnx)(Nn)P(X=x) = \frac { \binom{r}{x}\binom{N-r}{n-x} }{ \binom{N}{n}}, N=100,n=4,r=10 and x=1N =100, n =4, r=10 \space and \space x=1

  1. P(X=1)=10C1(10010)C(41)100C4=1011748039212250.3P(X=1) = \frac { _{10}C_1 * _{(100-10)}C_{(4-1)} } {_{100}C_4} = \frac {10 * 117480 }{3921225} ≈ 0.3

  2. E(X)=np=40.1=0.4E(X) = np = 4 * 0.1 = 0.4

  3. V(X)=np(1p)NMN1=0.40.990990.33V(X) = np(1-p)\frac {N-M}{N-1} = 0.4 * 0.9 * \frac {90}{99} ≈0.33

3. Using R

초기하분포의 밀도 함수, 누적분포 함수, 분위수 함수, 난수 발생을 위한 R 함수 및 모수는 아래와 같습니다.

구분

초기하분포 R 함수 / 모수

밀도 함수

d

dhyper(x, m, n, k)

누적분포 함수

p

phyper(q, m, n, k, lower.tail = TRUE/FALSE)

분위수 함수

q

qhyper(p, m, n, k, lower.tail = TRUE/FALSE)

난수 발생

r

rhyper(nn, m, n, k)

참고 : 모집단이 m과 n의 개체로 구성되어 있는데 k개의 표본을 추출. lower.tail = TRUE 이면 확률변수 x를 기준으로 왼쪽 꼬리를 의미

3-1. Random Number Generation & Plotting

  • Random Number Generation : rhyper(nn, m, n, k)

  • Plotting : dhyper(x, m, n, k)

m=5, n=20 인 초기하분포에서 비복원으로 4개를 추출하는 것을 1000번 모의실험한 후에 도수분포표를 구해보겠습니다.

3-2. Probability Computation

1) P(X=4)P(X = 4) 확률 계산 : dhyper(x, m, n, k)

EXAMPLE 18. 어떤 바리스타가 아메리카노 향 냄새를 맡아보기만 하면 "콜롬비아 원두"로 만든 것인지 아닌지를 맞출 수 있다고 주장하였다고 합니다. 그래서 그 바리스타를 데려다가 실험을 해보았습니다. "콜롬비아 원두"로 만든 아메리카노 5잔 (m=5), 콜롬비아 원두 말고 다른 지역 원두로 만든 아메리카노 20잔 (n=20) 을 만들어 놓고 그 바리스타에게 "콜롬비아 원두"로 만든 아메리카노 5잔(k)을 골라내 보라고 시켰습니다. 이때 "콜롬비아 원두"로 만든 아메리카노를 4잔(x) 골라낼 확률은?

[ Solution ]

  • m : "콜롬비아 원두"로 만든 아메리카노 5잔 (원하는 결과 대상)

  • n : 다른 지역 원두로 만든 아메리카노 20잔 (원하지 않는 결과 대상)

  • k : 골라내는 커피 5잔 (시행횟수)

  • x : 원하는 결과의 횟수 (4잔)

=> P(X=4)=dhyper(x=4,m=5,n=20,k=5)P(X=4) = dhyper(x=4, m=5, n=20, k=5)

EXAMPLE 19. TV를 생산하는 제조회사에서 생산한 TV 100 대 중에서 품질이 양호한 TV가 95대, 불량품이 5대가 재고창고에 들어있다고 합니다. 이 재고 창고에서 TV 10개를 비복원추출한다고 했을 때 불량품이 3개가 포함되어 있을 확률은?

[Solution]

  • m : 불량품의 대수 5대

  • n : 양호한 TV 대수 95대

  • k : 10대 비복원추출

  • x : 불량품이 3대

=> dhyper(3,m=5,n=95,k=10)dhyper(3, m=5, n=95, k=10)

2) P(X<=4)P(X<=4)

  • phyper(x, m, n, k, lower.tail=TRUE) : lower.tail=TRUE 사용

EXAMPLE 20. EXAMPLE 18.에서 4잔 이하일 확률을 구하라.

[ Solution ]

=> phyper(4,m=5,n=20,k=5,lower.tail=TRUE)phyper(4, m=5, n=20, k=5, lower.tail=TRUE)

  • 또는 P(X<=4)=P(X=1)+P(X=2)+P(X=3)+P(X=4)P(X<=4) = P(X=1) + P(X=2) +P(X=3) + P(X=4)

3-3. 특정 확률에 해당하는 분위수 구하기

qhyper(p, m, n, k, lower.tail = TRUE/FALSE)

EXAMPLE 21. EXAMPLE 18. 에서 확률이 0.03576134가 되는 시행횟수를 구하라.

[ Solution ]

EXAMPLE 22. 누적확률이 0.998099가 되는 시행횟수를 구하라.

[ Solution ]

EXAMPLE 23. 총 50개의 개체로 구성되며, 각각 10개, 20개, 40개의 성공개체가 잇는 세 종류의 유한모집단에서 10개의 표본을 취하였을 때, 성공개수의 확률분포를 구하여 비교하라.

[ Solution ]

EXAMPLE 24. 불량률이 5%이고 1,000개의 제품으로 구성된 Lot에서 30개의 표본을 추출하였을 때 나오는 불량품의 갯수를 XX 라 할 때, 다음을 구하시오.

  1. X의 확률분포함수

  2. E(X)E(X)Var(X)Var(X)

  3. P(X=3)P(X=3)

  4. P(X3)P(X\le 3)

[ Solution ]

4. Binomial Distribution and Hypergeometric Distribution

4.1 Hypergeometric Distribution from Binomial Distribution

이항 분포의 조건부 분포가 바로 초기하 분포가 되는 것을 알 수 있습니다.

두 확률변수 X와 Y가 서로 독립이고, 이항분포를 따를 때, 확률변수 X+Y에 대한 X의 조건부 분포는 '초기하 분포'를 따른다.

4.2 Binomial Distribution from Hypergeometric Distribution

이와 반대로 초기하 분포에 극한 (N → ∞)을 취하면 이항분포가 됩니다.

초기하 분포의 성공확률을 p=rNp= \frac{r}{N} 이라 할 때, 초기하 분포의 확률질량함수

P(X=x)=(rx)(Nrnx)(Nn)=rCx×(Nr)C(nx)NCn=nCx×(Nn)C(rx)NCrP(X=x) = \frac { \binom{r}{x}\binom{N-r}{n-x} }{ \binom{N}{n}} = \frac { _{r}C_x \times _{(N-r)}C_{(n-x)} } {_{N}C_n} = \frac { _{n}C_x \times _{(N-n)}C_{(r-x)} } {_{N}C_r} =nCx(Nn)!(rx)!((Nr)n+x)!N!r!(Nr)!=nCxr!(Nr)!(Nn)!N!(rx)!((Nr)n+x)!= {_{n}C_x} \frac{ \frac{(N-n)!}{(r-x)!((N-r)-n+x)!}}{ \frac{N!}{r!(N-r)!} } = {_nC_x} \frac{r!(N-r)!(N-n)! }{N!(r-x)!((N-r)-n+x)! } =nCxr(r1)(rx+1)(Nr)(Nr1)(Nrn+x+1)N(N1)(N2)(Nn+1)= {_nC_x} \frac{r(r-1) \cdots (r-x+1)(N-r)(N-r-1)\cdots (N-r-n+x+1) }{N(N-1)(N-2)\cdots (N-n+1)}

분모, 분자를 NnN^n 으로 나누면,

=nCx×rN(rN1N)(rNx1N)(1rN)(1rN1N)(1rNnx1N)(11N)(12N)(1n1N)= {_nC_x} \times \frac{ \frac{r}{N}(\frac{r}{N}-\frac{1}{N}) \cdots (\frac{r}{N} - \frac{x-1}{N})(1- \frac{r}{N})(1-\frac{r}{N} -\frac{1}{N})\cdots (1- \frac{r}{N}-\frac{n-x-1}{N}) }{(1-\frac{1}{N})(1-\frac{2}{N})\cdots (1-\frac{n-1}{N})}

p=rNp= \frac{r}{N}이고, 1p=q1-p = q 이므로,

=nCx×p(p1N)(px1N)q(q1N)(qnx1N)(11N)(12N)(1n1N)= {_nC_x} \times \frac{ p(p-\frac{1}{N}) \cdots (p - \frac{x-1}{N})q(q -\frac{1}{N})\cdots (q-\frac{n-x-1}{N}) }{(1-\frac{1}{N})(1-\frac{2}{N})\cdots (1-\frac{n-1}{N})}

AsNN \rightarrow \infty , P(X=x)nCxpxqnxP(X=x) \rightarrow {_nC_x}p^xq^{n-x} \Rightarrow BinomialDistribution Binomial Distribution

이렇게 초기하 분포에 극한을 취했을 경우 이항 분포가 됨을 보였습니다.

4.3 Binomial Distribution and Hypergeometric Distribution

따라서 이항 분포와 초기하 분포는 다음과 같은 관계를 가집니다.

그리고 한 가지 더 알아두셔야 할 사항은 이항 분포는 '복원 추출'을 전제로, 초기하 분포는 '비복원 추출'을 전제로 한다는 것 입니다.

Last updated