‘Picking without replacement is the key phrase to understanding hypergeometric probability distribution. Here is another example, 30 names, 10 girls and 20 boys, are put in a sorting hat, and the top five are randomly selected for top prizes. What is the probability that four girls and one boy will win the honours?
Needless to say: it is a game without replacement. We know how to do such problems, as we have done a few earlier using combinations formula. Multiply combinations of picking 4 boys from 10 with 1 girl from 20 and divide by the total combinations – of 5 from 30.
(10!/(4!6!)) x (20!/(1!19!)) /(30!/(5!25!))
= (10 x 9 x 8 x 7 / 4 x 3 x 2) x (20) / (30 x 29 x 28 x 27 x 26 / 5 x 4 x 3 x 1)
= (5 x 4 x 3 x 2 x 20 x 10 x 9 x 8 x 7) / (4 x 3 x 2 x 30 x 29 x 28 x 27 x 26)
= (5 x 10 x 2 x 7) / (3 x 29 x 7 x 3 x 13)
choose(10,4)*choose(20,1) / choose(30,5)
Or simply,
dhyper(4, 10, 20, 5, log = FALSE)
There is a 2.95 % (0.02947244) chance that it can happen this way!