Hypergeometric distribution

0/1
?
Intros
Lessons
  1. What is Hypergeometric Distribution?
0/3
?
Examples
Lessons
  1. Identifying Hypergeometric Distributions
    Identify which of the following experiments below are Hypergeometric distributions?

    i.
    Negative Binomial – A 12 sided die (dodecahedra) is rolled until a 10 comes up two times. What is the probability that this will take 6 rolls?
    ii.
    Binomial – An urn contains 5 white balls and 10 black balls. If 2 balls are drawn with replacement what is the probability that one of them will be white?
    iii. Hypergeometric - A bag contains 8 coins, 6 of which are gold galleons and the other 2 are silver sickles. If 3 coins are drawn without replacement what is the probability that 2 of them will be gold galleons?
    1. Determining the Hypergeometric Distribution
      A bag contains 8 coins, 6 of which are gold galleons and the other 2 are silver sickles. If 3 coins are drawn without replacement what is the probability that 2 of them will be gold galleons?
      1. Determining the Cumulative Hypergeometric Distribution
        Ben is a sommelier who purchases wine for a restaurant. He purchases fine wines in batches of 15 bottles. Ben has devised a method of testing the bottles to see whether they are bad or not, but this method takes some time, so he will only test 5 bottles of wine. If Ben receives a specific batch that contains 2 bad bottles of wine, what is the probability that Ben will find at least one of them?
        Topic Notes
        ?

        Hypergeometric distribution



        Hypergeometric distribution definition


        The hypergeometric distribution is a discrete probability distribution that looks to study the probability of finding a particular number of successes for a certain amount of trials done during a statistical experiment. While the rest of the discrete probability distributions we have seen so far operate on probability with replacement, the hypergeometric distribution does not follow that same behavior.
        Due its name, you may think the hypergeometric distribution is easily comparable with the geometric distribution; funny enough, it is actually much more easy to compare it with the binomial distribution!

        At this point you may have already noticed the similarities between the binomial and the hypergeometric distribution definition, they are ALMOST the same, there is just one bit part that differs from one to the other: one uses sampling with replacement and the other one without replacement, which changes the probability of success in each attempt from constant (when replacement is used) to a changing value (without replacement).

        Hypergeometric distribution
        Figure 1: Binomial distribution vs hypergeometric distribution

        Given that there will be no replacement on the hypergeometric distribution, in order for a statistical experiment data to be following such kind of distribution it must meet the next requirements:

        1. Having a total population, a sample of fixed size is picked from it at random without replacement.

        2. In both the population and the sample, there are just two different kinds of outcomes: successes and/or failures. A success is the outcome you want to obtain, or are specifically studying.

        3. The probability of a success in each trial is not constant. Since items in the sample are randomly selected without replacement, the amount of successes left in the sample changes from one trial to the next and so the probability changes.

        And so, the hypergeometric distribution formula for the probability is defined as:

        P(x)=P(x) = (mCx)(NmCnx)NCn\large \frac{(_{m}C_{x})(_{N-m}C_{n-x}) } {_{N}C_{n}}
        Equation 1: Probability for a hypergeometric distribution

        Where:
        NN = population size
        mm = number of successes in the population
        nn = sample size
        xx = number of successes in the sample
        mCx=_{m}C_{x} = m!x!(mx)!\large \frac{m!}{x!(m-x)!} NmCnx= \qquad \quad _{N-m}C_{n-x} = (Nm)!(nx)!((Nm)(nx))!\large \frac{(N-m)!} {(n-x)! ((N-m)-(n-x))!}
        NCn=_{N}C_{n} = N!n!(Nn)!\large \frac{N!}{n!(N-n)!}
        P(x)P(x) = probability of getting x successes out of a sample of nn trials

        Notice that for this particular distribution, you should completely understand how to work with the binomial coefficient formula, or also called the combinations formula. In later lessons we will take a look into the details of combination examples, for now, we have been providing you with the already defined formulas throughout all of the definitions of the different discrete probability distributions.

        How to calculate hypergeometric distribution


        When calculating the probability without replacement as the hypergeometric distribution requires, we need to take into account the difference between the total population and the sample items.

        Example 1

        For our first hypergeometric distribution example, we will be determining the probability in the next case:
        A bag contains 8 coins, 6 of which are gold galleons and the other 2 are silver sickles. If 3 coins are drawn without replacement what is the probability that 2 of them will be gold galleons?

        For this case we have:
        N=8,m=6,n=3,x=2N = 8, m = 6, n = 3, x = 2. Therefore, we calculate the binomial coefficients for each of the combinations needed in the probability formula as shown in equation 1:

        mCx=_{m}C_{x} = m!x!(mx)!\large \frac{m!} {x!(m-x)!} \quad 6C2= \quad _{6}C_{2} = 6!2!(62)!=(6×5×4×3×2×1)(2×1)(4×3×2×1)\large \frac{6!} {2!(6-2)!} = \frac{(6 \, \times \, 5 \, \times \, 4 \, \times \, 3 \, \times \, 2 \, \times \, 1 )} {(2\, \times \,1) (4\, \times \,3\, \times \,2\, \times \,1)} =15 = 15

        NmCnx=_{N-m}C_{n-x} = (Nm)!(nx)!((Nm)(nx))!\large \frac{(N-m)!} {(n-x)! ((N-m)-(n-x))!} \quad 86C32=2C1= \quad _{8-6}C_{3-2} = \enspace _{2}C_{1} = 2!(1!)(1!)\large \frac{2!}{(1!)(1!)} =2= 2

        NCn=_{N}C_{n} = N!n!(Nn)!\large \frac{N!} {n!(N-n)!} \quad 8C3= \quad _{8}C_{3}= 8!3!(83)!=(8×7×6×5×4×3×2×1)(3×2×1)(5×4×3×2×1)\large \frac{8!} {3!(8-3)!} = \frac{(8 \, \times \, 7 \, \times \, 6 \, \times \, 5 \, \times \, 4 \, \times \, 3 \, \times \, 2 \, \times \, 1 )} {(3\, \times \,2 \, \times \, 1) (5\, \times \,4\, \times \,3\, \times \,2 \, \times \,1)} =56 = 56
        Equation 2: Binomial coefficients

        And using these results, we work through the probability for the hypergeometric distribution calculation:

        P(x)=P(x) = (mCx)(NmCnx)NCn\large \frac{(_{m}C_{x}) (_{N-m}C_{n-x})} {_{N}C_{n}} =(6C2)(2C1)8C3 \frac{(_{6}C_{2}) (_{2}C_{1})} {_{8}C_{3}} (15)(2)56=3056=0.5357 \frac{(15)(2)}{56} = \frac{30}{56} = 0.5357
        Equation 3: Probability of drawing 2 gold galleons


        Example 2

        On this example, we are to determine the cumulative hypergeometric probability of the next experiment:
        Ben is a sommelier who purchases wine for a restaurant. He purchases fine wines in batches of 15 bottles. Ben has devised a method of testing the bottles to see whether they are bad or not, but this method takes some time, so he will only test 5 bottles of wine. If Ben receives a specific batch that contains 2 bad bottles of wine, what is the probability that Ben will find at least one of them?
        Therefore, the probability that Ben finds at least one bad bottle of wine must be the addition of the probability of Ben finding one bad, plus the probability of Ben finding two bad bottles:

        P(x1)=P(1)+P(2)P(x \geq 1) = P(1) + P(2)
        Equation 4: Probability of finding at least one bad bottle of wine

        On this case, we have that the population size, the number of successes in the population and the sample size are constants, which have the following values: N=15,m=2N=15, m = 2 \, and n=5 \, n=5.
        We start by calculating the probability of finding one bad bottle, which means that the number of successes in the sample is equal to 1 or just x=1 x=1.

        P(1)=P(1) = (2C1)(152C51)15C5\large \frac{(_{2}C_{1} )(_{15-2}C_{5-1}) }{_{15}C_{5}}

        Where:

        2C1= _{2}C_{1} = 2!(1!)(1!)\large \frac{2!}{(1!)(1!)} =2= 2

        152C51=  13C4=_{15-2}C_{5-1} = \; _{13}C_{4} = 13×12×11×10×9×8×7×6×5×4×3×2×1(4×3×2×1)(9×8×7×6×5×4×3×2×1)\large \frac{13\, \times \, 12 \, \times \, 11 \, \times \, 10 \, \times \, 9 \, \times \, 8 \, \times \, 7 \, \times \, 6 \, \times \, 5 \, \times \, 4 \, \times \, 3 \, \times \, 2 \, \times \, 1} {(4\, \times \,3 \, \times \,2 \, \times \, 1) (9\, \times \, 8 \, \times \, 7 \, \times \,6\, \times \,5\, \times \,4\, \times \,3\, \times \,2\, \times \,1)} =715 = 715

        15C5=_{15}C_{5} = 15!5!(155)!=15×14×13×12×11×10×9×8×7×6×5×4×3×2×1(5×4×3×2×1)(10×9×8×7×6×5×4×3×2×1)\large \frac{15!} {5!(15-5)!} = \frac{15\, \times \,14\, \times \,13\, \times \,12\, \times \,11\, \times \,10\, \times \,9\, \times \,8\, \times \,7\, \times \,6\, \times \,5\, \times \,4\, \times \,3\, \times \,2\, \times \,1} {(5\, \times \,4\, \times \,3\, \times \,2\, \times \,1) (10\, \times \,9\, \times \,8\, \times \,7\, \times \,6\, \times \,5\, \times \,4\, \times \,3\, \times \,2\, \times \,1)} =3,003 = 3,003

        therefore:

        P(1)=P(1)= (2)(715)3,003\large \frac{(2)(715)}{3,003}=0.47619= 0.47619
        Equation 5: Probability of finding one bad bottle of wine

        Now calculating the probability of finding 2 bad bottles of wine, therefore x=2x=2:

        P(2)=P(2) = (2C2)(152C52)15C2\large \frac{(_{2}C_{2} )(_{15-2}C_{5-2}) }{_{15}C_{2}}

        Where:

        2C2= _{2}C_{2} = 2!(2!)(0!)\large \frac{2!}{(2!)(0!)} =1= 1

        152C52=  13C3=_{15-2}C_{5-2} = \; _{13}C_{3} = 13×12×11×10×9×8×7×6×5×4×3×2×1(3×2×1)(10×9×8×7×6×5×4×3×2×1)\large \frac{13\, \times \, 12 \, \times \, 11 \, \times \, 10 \, \times \, 9 \, \times \, 8 \, \times \, 7 \, \times \, 6 \, \times \, 5 \, \times \, 4 \, \times \, 3 \, \times \, 2 \, \times \, 1} {(3 \, \times \,2 \, \times \, 1) (10\, \times \,9\, \times \, 8 \, \times \, 7 \, \times \,6\, \times \,5\, \times \,4\, \times \,3\, \times \,2\, \times \,1)} =286 = 286

        15C5=_{15}C_{5} = 15!5!(155)!=15×14×13×12×11×10×9×8×7×6×5×4×3×2×1(5×4×3×2×1)(10×9×8×7×6×5×4×3×2×1)\large \frac{15!} {5!(15-5)!} = \frac{15\, \times \,14\, \times \,13\, \times \,12\, \times \,11\, \times \,10\, \times \,9\, \times \,8\, \times \,7\, \times \,6\, \times \,5\, \times \,4\, \times \,3\, \times \,2\, \times \,1} {(5\, \times \,4\, \times \,3\, \times \,2\, \times \,1) (10\, \times \,9\, \times \,8\, \times \,7\, \times \,6\, \times \,5\, \times \,4\, \times \,3\, \times \,2\, \times \,1)} =3,003 = 3,003

        therefore:

        P(2)=P(2)= (1)(286)3,003\large \frac{(1)(286)}{3,003}=0.09524= 0.09524
        Equation 6: Probability of finding two bad bottles of wine

        Therefore, the probability that Ben finds at least one bad bottle of wine is:

        P(x1)=P(1)+P(2)=0.47619+0.09524=0.57143P(x \geq 1) = P(1) + P(2) =0.47619+0.09524=0.57143
        Equation 7: Probability of finding at least one bad bottle of wine

        Hypergeometric test


        The hypergeometric test is the usage of the calculation of cumulative hypergeometric probabilities in order to see if a statistical process result is realistic or contains a certain kind of bias. In other words, when drawing a sample from a population, depending on the original conformation of the population (how many possible successes and failures it contains), we should have an idea of the quantities of successes we may draw within our sample because of the proportions in the population. But sometimes, the sample may not truthfully represent the original population and that is usually the sign of some kind of bias.

        Remember, bias means, the experiment is not done randomly, there is either a systematic error or a particular characteristic in the way how the sample was drawn that provides a sample uncharacteristic of the population we are using.

        Therefore, the hypergeometric test is a tool to decide if the sample we drew from a population is good or not. When the sample contains many more successes in proportion to the ones found in the original population, this is called over-representation, and we can obtain the probability of this happening by calculating the cumulative hypergeometric probability of us drawing the particular amount of successes drawn and more. If the sample contains much less successes in proportion to the ones found in the original population, then this is under-representation, and we obtain the probability of this happening by calculating the cumulative hypergeometric probability of us drawing the particular amount of successes drawn or less. If such probabilities are way too low, we can decide the sample we drew is biased and therefore, not representative of the population (if working on something like demographics) or just finding that our experiment is not random and has something going on that messes up with the probabilities.

        *****

        To finalize the lesson for today, let us provide you with some recommendations:
        This handout on the hypergeometric and negative binomial distributions provides a wide variety of examples for both types of distributions and well explained summarized introductions for each. Then, this other document presents a clear comparison between the binomial and the hypergeometric distribution on the first page, and the continues onto examples. Both of these links are great materials that can be helpful to continue your studies on this topic.

        This is it on all of the discrete probability distributions we will present on our statistics course, to finish, let us present you with a table where you can see all of them summarized:

        Table of Discrete Probability Distributions

        Distribution definition:

        Characteristics:

        Probability formula:

        Binomial distribution:

        Number of successes in a certain amount of trials (with replacement)

        Fixed number of trials.


        Each trial has only two possible outcomes: a success or a failure.


        The probability of success in each trial is constant.

        P(x)=nCxpx(1p)nx=P(x)= \, _{n}C_{x}p^{x} (1-p)^{n-x} = n!x!(nx)!\large \frac{n!}{x!(n-x)!} px(1p)nxp^{x}(1-p)^{n-x}


        Where:

        nn = number of trials

        xx = number of successes in n trials

        pp = probability of success in each trial

        nCx=_{n}C_{x} = n!x!(nx)!\large \frac{n!}{x!(n-x)!}= number of success outcomes

        P(x)P(x) = probability of getting x successes out of n trials

        Poisson distribution:

        Used as an approx. to the binomial distribution when the amount of trials in the experiment is very high in comparison with the amount of successes.

        Fixed number of trials.


        Each trial has only two possible outcomes: a success or a failure.


        The probability of success in each trial is constant.

        P(x)=enp P(x) = e^{-np} (np)xx!\large \frac{(np)^{x}}{x!} \enspace P(x)=eλ \enspace P(x) = e^{-\lambda} (λ)xx!\large \frac{(\lambda)^{x}}{x!}


        Where:

        nn = number of trials

        xx = number of successes in n trials

        pp = probability of success in each trial

        P(x)P(x) = probability of getting x successes out of nn trials

        μ=λ=np= \mu = \lambda = np = average number of events per time interval

        Geometric distribution:

        Number of trials until the first success.

        Fixed number of trials.


        Each trial has only two possible outcomes: a success or a failure.


        The probability of success in each trial is constant.

        P(n)=(1p)n1pP(n) = (1-p)^{n-1}p


        Where:

        nn = number of trials until the first success
        pp = probability of success in each trial

        P(n)P(n) = probability of getting your 1st success at nthn^{th} trial

        Negative binomial distribution:

        Number of trials needed for a certain amount of successes.

        Fixed number of trials.


        Each trial has only two possible outcomes: a success or a failure.


        The probability of success in each trial is constant.

        P(x)=nCxpx(1p)nx=P(x) = \,_{n}C_{x} p^{x}(1-p)^{n-x} = n!x!(nx)!\large \frac{n!}{x!(n-x)!} px(1p)nx p^{x}(1-p)^{n-x}


        Where:

        nn = number of trials

        xx = number of successes in n trials

        pp = probability of success in each trial

        nCx=_{n}C_{x} = n!x!(nx)!\large \frac{n!}{x!(n-x)!} = number of success outcomes

        P(x)P(x) = probability of getting xx successes out of nn trials

        Hypergeometric distribution:

        Number of successes in a certain amount of trials (without replacement)

        A randomly selected sample of fixed size is selected without replacement from a population.


        The population and the sample have only two possible outcomes: a success or a failure.


        The probability of success in each trial is not constant.

        P(x)=P(x) = (mCx)(NmCnx)NCn\large \frac{(_{m}C_{x})(_{N-m}C_{n-x})}{_{N}C_{n}}


        Where:

        NN = population size

        mm = number of successes in the population

        nn = sample size

        x x = number of successes in the sample

        mCx=_{m}C_{x} = m!x!(mx)!\large \frac{m!}{x!(m-x)!}

        NmCnx=_{N-m}C_{n-x} = (Nm)!(nx)!((Nm)(nx))!\large \frac{(N-m)!}{(n-x)!((N-m)-(n-x))!}

        NCn=_{N}C_{n} = N!n!(Nn)!\large \frac{N!}{n!(N-n)!}

        Figure 2: Table of discrete probability distributions
        N: population size
        m: number of successes in the population
        n: sample size
        x: number of successes in the sample

        P(x): probability of getting x successes (out of a sample of n)
        P(x)=(mcx)(NmCnx)NCnP(x)=\frac{(_mc_x)(_{N-m}C_{n-x})}{_NC_n}