#set document(title: "5.5 Hypergeometric Distribution", author: "Rachel Webb") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 5.5#h(0.6em)Hypergeometric Distribution The hypergeometric distribution is a discrete probability distribution used to find the probability of success when there are two outcomes to each trial, and there are a set number of dependent trials. A hypergeometric probability distribution results from a random experiment that meets all of the following requirements. #sub[1]2 + The procedure has a fixed sample size #emph[n] taken from a population #emph[N]. + The trials are taken without replacement (dependent). + Each trial has exactly two outcomes, the number of successes = a and the number of failures = #emph[b]. Note #emph[a] + #emph[b] = #emph[N]. If a random experiment satisfies all of the above, the distribution of the random variable X, where X counts the number of successes, is called a hypergeometric distribution, we write X ~ #emph[H(n, a, N]). #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ The hypergeometric distribution is P(X = x) = #math.equation(block: false, alt: "the fraction a C sub x times b C sub n minus x over N C sub n")[$frac(a C_(x) · b C_(n − x), N C_(n))$], #emph[x] = 0, 1, 2, … , #emph[n] or #emph[a], whichever is smaller. Where n is the sample size taken without replacement from the population size N, x is the number of successes out of n that you are trying to find the probability for, a is the number of a successes and #emph[b] = #emph[N] – #emph[a] is the number of failures out of the population #emph[N]. ] #examplebox("Example 1")[][ A committee of 5 people is to be formed from 15 volunteers and 6 appointed positions. Compute the probability that the committee will consist of 4 randomly selected volunteers. \# The calculator has no hypergeometric key, so the section sends you to an \# outside applet. Here it is built in - and, more usefully, you can DRAW the \# committees and watch sampling without replacement produce the same number. \# Committee: N = 21 (m = 15 volunteers, n = 6 appointed), sample k = 5. dhyper(4, m = 15, n = 6, k = 5) \# P(X = 4) -\> book's 0.4025 set.seed(5) people \<- rep(c('volunteer', 'appointed'), c(15, 6)) draws \<- replicate(20000, sum(sample(people, 5) == 'volunteer')) mean(draws == 4) \# simulated, converging on 0.4025 \# The section's other three answers, exactly: dhyper(5, m = 40, n = 30, k = 12) \# jury, 5 with a degree -\> 0.1259 dhyper(2, m = 3, n = 5, k = 4) \# wallet, two \$100 bills -\> 0.4286 1 - phyper(1, m = 4, n = 21, k = 5) \# lot returned, X \>= 2 -\> 0.1664 #solutionbox[ There are a total of #emph[N]= 15 + 6 = 21 people. A sample of #emph[n] = 5 people are selected without replacement. The success is choosing a volunteer, so #emph[a] = 15. Of the 15 volunteers, we are asked to find the probability of selecting #emph[x] = 4. Substitute in each value: P(X = 4) = #math.equation(block: false, alt: "the fraction 15 C sub 4 times 6 C sub 1 over 21 C sub 5 equals 0.4025")[$frac(15 C_(4) · 6 C_(1), 21 C_(5)) = 0.4025$]. ] ] #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ There is a pattern to the numbers in the formula. The top two numbers on the left of the C’s add up to the bottom number on the left of C, and the top two numbers on the right of the C’s add up to the bottom number on the right of C. ] #examplebox("Example 2")[][ The waiting room for jury selection has 40 people with a college degree and 30 people without. A jury of 12 is selected from this waiting room. What is the probability that exactly 5 of the jury members will have a college degree? #solutionbox[ There are a total of #emph[N] = 40 + 30 = 70 people. A sample of #emph[n] = 12 people are selected without replacement. The success is choosing someone with a college degree, so #emph[a] = 40. Of the 12 jurors we are asked to find the probability of selecting #emph[x]= 5. Substitute in each value: P(X = 5) = #math.equation(block: false, alt: "the fraction 40 C sub 5 times 30 C sub 7 over 70 C sub 12 equals 0.1259")[$frac(40 C_(5) · 30 C_(7), 70 C_(12)) = 0.1259$]. ] ] #examplebox("Example 3")[][ A wallet contains three \$100 bills and five \$1 bills. You randomly choose four bills. What is the probability that you will choose exactly two \$100 bills? #solutionbox[ There are a total of #emph[N] = 3 + 5 = 8 bills. A sample of #emph[n]= 4 bills are selected without replacement. The success is choosing a \$100 bill, so #emph[a] = 3. Of the 3 \$100 bills we are asked to find the probability of selecting #emph[x] = 2. Substitute in each value: P(X = 2) = #math.equation(block: false, alt: "the fraction 3 C sub 2 times 5 C sub 2 over 8 C sub 4 equals 0.4286")[$frac(3 C_(2) · 5 C_(2), 8 C_(4)) = 0.4286$]. ] ] Note: the calculator does not have the hypergeometric distribution shortcut. The following online calculator will calculate the probability: https://homepage.divms.uiowa.edu/~mbognar/applets/hg.html. The M = #emph[a]is the number of successes #emph[a]from our example, or use Excel. Figure 5-7 may help you decide when to use the “True” for cumulative in Excel. Figure 5-7 A bookstore owner examines 5 books from each lot of 25 to check for missing pages. If they find at least 2 books with missing pages, the entire lot is returned. If, indeed, there are 4 books with missing pages, find the probability that the lot will be returned. Solution Sometimes the hardest part is determining which of the numbers goes in the right place in the formula. The population size is always the largest number, #emph[N] = 25. A success is what you are trying to find the probability for, which is getting a book with a missing page. The number of successes out of the population is #emph[a] = 4 (the 4 books with the missing pages). This means #emph[b] = 25 – 4 = 21 (the number of books without missing pages). Note#emph[a] + #emph[b] = #emph[N]. The sample size is the n = 5 is the number of books the owner examines. The owner will send the lot back if #emph[X] is at least 2 missing pages. We can stop at #emph[X] = 4 since there are only 4 books with missing pages. Your stopping point will be the smaller of n or a. P(#emph[X] ≥ 2) = P(#emph[X] = 2) + P#emph[(]X = 3) + P(#emph[X] = 4) = #math.equation(block: false, alt: "the fraction 4 C sub 2 times 21 C sub 3 over 25 C sub 5 plus the fraction 4 C sub 3 times 21 C sub 2 over 25 C sub 5 plus the fraction 4 C sub 4 times 21 C sub 1 over 25 C sub 5 equals 0.1502 plus 0.0158 plus 0.0004 equals 0.1664")[$frac(4 C_(2) · 21 C_(3), 25 C_(5)) + frac(4 C_(3) · 21 C_(2), 25 C_(5)) + frac(4 C_(4) · 21 C_(1), 25 C_(5)) = 0.1502 + 0.0158 + 0.0004 = 0.1664$]. In Excel use the formula: =1- HYPGEOM.DIST(1,5,4,25,TRUE). Figure 5-8 shows the online calculator at https://homepage.divms.uiowa.edu/~mbognar/applets/hg.html. Figure 5-8