#set document(title: "4.2 Three Types of Probability", 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")) == 4.2#h(0.6em)Three Types of Probability === Classical Approach to Probability (Theoretical Probability) #math.equation(block: true, alt: "P open parenthesis A close parenthesis equals the fraction Number of ways A can occur over Number of different outcomes in S")[$P ( A ) = frac("Number of ways A can occur", "Number of different outcomes in S")$] The classical approach can only be used if each outcome has equal probability. #examplebox("Example 1")[][ If an experiment consists of flipping a coin twice, compute the probability of getting exactly two heads. #solutionbox[ The event of getting exactly two heads is A = {HH}. The number of ways A can occur is 1. The number of different outcomes in S = {HH, HT, TH, TT} is 4. Thus P(#emph[A]) = ¼. ] ] #examplebox("Example 2")[][ If a random experiment consists of rolling a six-sided die, compute the probability of rolling a 4. #solutionbox[ The sample space is S = {1, 2, 3, 4, 5, 6}. The event A is that you want is to get a 4, and the event space is A = {4}. Thus, in theory the probability of rolling a 4 would be P(A) = 1/6 = 0.1667. ] ] #examplebox("Example 3")[][ Suppose you have an iPhone with the following songs on it: 5 Rolling Stones songs, 7 Beatles songs, 9 Bob Dylan songs, 4 Johnny Cash songs, 2 Carrie Underwood songs, 7 U2 songs, 4 Mariah Carey songs, 7 Bob Marley songs, 6 Bunny Wailer songs, 7 Elton John songs, 5 Led Zeppelin songs, and 4 Dave Matthews Band songs. The different genre that you have are rock from the ‘60s which includes Rolling Stones, Beatles, and Bob Dylan; country includes Johnny Cash and Carrie Underwood; rock of the ‘90s includes U2 and Mariah Carey; Reggae includes Bob Marley and Bunny Wailer; rock of the ‘70s includes Elton John and Led Zeppelin; and bluegrass/rock includes Dave Matthews Band. #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Every song probability from one seeded list] Opens the Stats panel with the twelve song counts in L1. Run 1-Var Stats and read the total number of songs, Sigma-x = 67 - every answer in this example is a count over 67, e.g. P(Johnny Cash) = 4/67 = 0.0597 and P(Reggae) = (7 + 6)/67 = 0.1940. Edit a count and recalculate to see every probability shift with the new total. - 1-Var Stats on L1: total songs = 67 ] + What is the probability that you will hear a Johnny Cash song? + What is the probability that you will hear a Bunny Wailer song? + What is the probability that you will hear a song from the ‘60s? + What is the probability that you will hear a Reggae song? + What is the probability that you will hear a song from the ‘90s or a bluegrass/rock song? + What is the probability that you will hear an Elton John or a Carrie Underwood song? + What is the probability that you will hear a country song or a U2 song? #solutionbox[ a) The way an iPhone works, it randomly picks the next song so you have no idea what the next song will be. Now you would like to calculate the probability that you will hear the type of music or the artist that you are interested in. The sample set is too difficult to write out, but you can figure it from looking at the number in each set and the total number. The total number of songs you have is 67. There are 4 Johnny Cash songs out of the 67 songs. P(Johnny Cash song) = 4/67 = 0.0597 b) There are 6 Bunny Wailer songs. P(Bunny Wailer) = 6/67 = 0.0896. c) There are 5, 7, and 9 songs that are classified as rock from the ‘60s, which is a total of 21. P(rock from the ‘60s) = 21/67 = 0.3134. d) There are total of 13 songs that are classified as Reggae. P(Reggae) = 13/67 = 0.1940 e) There are 7 and 4 songs that are songs from the ‘90s and 4 songs that are bluegrass/rock, for a total of 15. P(rock from the ‘90s or bluegrass/rock) = 15/67 = 0.2239. f) There are 7 Elton John songs and 2 Carrie Underwood songs, for a total of 9. P(Elton John or Carrie Underwood song) = 9/67 = 0.1343. g) There are 6 country songs and 7 U2 songs, for a total of 13. P(country or U2 song) = 13/67 = 0.1940. ] ] === #strong[Empirical Probability] (Experimental or Relative Frequency Probability) The experiment is performed many times and the number of times that event A occurs is recorded. Then the probability is approximated by finding the relative frequency. #math.equation(block: true, alt: "P open parenthesis A close parenthesis equals the fraction Number of ways A occurred over Number of times the experiment was repeated")[$P ( A ) = frac("Number of ways A occurred", "Number of times the experiment was repeated")$] #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ Important: The probability of any event A satisfies 0 ≤ P(A) ≤ 1, keep this in mind if the question is asking for a probability, and make sure your answer is a number between 0 and 1. A probability, relative frequency, percentage, and proportion are all different words for the same concept. Probability answers can be given as percentages, decimals, or reduced fractions. ] #examplebox("Example 4")[][ Suppose that the experiment is rolling a die. Compute the probability of rolling a 4. #solutionbox[ The sample space is S = {1, 2, 3, 4, 5, 6}. The event A is that you want is to get a 4, and the event space is A = {4}. To do this, roll a die 10 times. When you do that, you get 4 two times. Based on this experiment, the probability of getting a 4 is 2 out of 10 or 1/5 = 0.2. To get more accuracy, repeat the experiment more times. It is easiest to put this information in a table, where n represents the number of times the experiment is repeated. When you put the number of 4s found divisible by the number of times you repeat the experiment, this is the relative frequency. See the last column in Figure 4-3. Figure 4-3: Trials for Die Experiment n Number of 4s Relative Frequency 10 2 0.2 50 6 0.12 100 18 0.18 500 81 0.162 1,000 163 0.163 ] ] Notice that as n increased, the relative frequency seems to approach a number; it looks like it is approaching 0.163. You can say that the probability of getting a 4 is approximately 0.163. If you want more accuracy, then increase n even more by rolling the die more times. #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Plot the Law of Large Numbers] Opens the Plots panel with Figure 4-3's trial sizes in L1 and the observed relative frequencies in L2. Pick the Scatter Plot tab (X = L1, Y = L2) and watch the points settle toward the theoretical probability 1/6 = 0.1667 as n grows. - Figure 4-3 data: relative frequency vs n, approaching 1/6 = 0.1667 ] These probabilities are called #strong[experimental probabilities] since they are found by actually doing the experiment or simulation. They come about from the relative frequencies and give an approximation of the true probability. The approximate probability of an event #math.equation(block: false, alt: "A")[$A$], notated as #math.equation(block: false, alt: "P open parenthesis A close parenthesis")[$P ( A )$], is #math.equation(block: true, alt: "P open parenthesis A close parenthesis equals the fraction Number of ways A occurred over Number of times the experiment was repeated")[$P ( A ) = frac("Number of ways A occurred", "Number of times the experiment was repeated")$] For the event of getting a 4, the probability would be P(Roll a 4) = #math.equation(block: false, alt: "the fraction Number of times A occurred over Number of times the experiment was repeated")[$frac("Number of times A occurred", "Number of times the experiment was repeated")$] = 0.163 “‘What was that voice?’ shouted Arthur. ‘I don't know,’ yelled Ford, ‘I don't know. It sounded like a measurement of probability.’ ‘Probability? What do you mean?’ ‘Probability. You know, like two to one, three to one, five to four against. It said two to the power of one hundred thousand to one against. That's pretty improbable you know.’” (Adams, 2002) #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #strong[Law of Large Numbers:] as n increases, the relative frequency tends towards the theoretical probability ] Figure 4-4 shows a graph of experimental probabilities as n gets larger and larger. The dashed yellow line is the theoretical probability of rolling a four of 1/6 #math.equation(block: false, alt: "not equal to")[$≠$] 0.1667. Note the x-axis is in a log scale. \# Roll a die 1,000 times and track the running relative frequency of a 4 set.seed(1) rolls \<- sample(1:6, 1000, replace = TRUE) relfreq \<- cumsum(rolls == 4) / seq\_along(rolls) relfreq\[c(10, 50, 100, 500, 1000)\] \# the book's own rolls (Figure 4-3) gave 0.2, 0.12, 0.18, 0.162, 0.163 plot(relfreq, type = "l", log = "x", xlab = "n (log scale)", ylab = "Relative frequency of a 4") abline(h = 1/6, lty = 2, col = "red") \# theoretical probability 1/6 = 0.1667 \# Change the seed or the number of rolls -- every run drifts toward 1/6 Note that the more times you roll the die, the closer the experimental probability gets to the theoretical probability. #figure(figph[Line graph of the probability of rolling a 4 versus the number of rolls on a log-scale axis from 10 to 10,000; the curve starts near 0.20, dips to about 0.12 at 50 rolls, rises to about 0.18 at 100, then settles onto the dashed yellow line at the theoretical probability 0.167.], alt: "Line graph of the probability of rolling a 4 versus the number of rolls on a log-scale axis from 10 to 10,000; the curve starts near 0.20, dips to about 0.12 at 50 rolls, rises to about 0.18 at 100, then settles onto the dashed yellow line at the theoretical probability 0.167.", caption: none) Figure 4-4 You can compute experimental probabilities whenever it is not possible to calculate probabilities using other means. An example is if you want to find the probability that a family has 5 children, you would have to actually look at many families, and count how many have 5 children. Then you could calculate the probability. Another example is if you want to figure out if a die is fair. You would have to roll the die many times and count how often each side comes up. Make sure you repeat an experiment many times, because otherwise you will not be able to estimate the true probability of 5 children. This is due to the law of large numbers, since the more times we repeat the experiment, the closer the experimental probabilities will get to the theoretical probabilities. For difficult theoretical probabilities, we can run computer simulations that can run an experiment repeatedly many times very quickly and come up with accurate estimates of the theoretical probability. #examplebox("Example 5")[][ A fitness center coach kept track of members over the last year. They recorded if the person stretched before they exercised, and whether they sustained an injury. The following contingency table shows their results. Select one member at random and find the following probabilities. Injury No Injury Stretched 52 270 Did Not Stretch 21 57 + Compute the probability that a member sustained an injury. + Compute the probability that a member did not stretch. + Compute the probability that a member sustained an injury and did not stretch. #solutionbox[ a) Find the totals for each row, column, and grand total. #figure(table( columns: 4, align: left, inset: 6pt, table.header([], [#strong[Injury]], [#strong[No Injury]], [#strong[Total]]), [#strong[Stretched]], [52], [270], [322], [#strong[Did Not Stretch]], [21], [57], [78], [#strong[Total]], [73], [327], [400], )) Next, find the relative frequencies by dividing each number by the total of 400. #figure(table( columns: 4, align: left, inset: 6pt, table.header([], [#strong[Injury]], [#strong[No Injury]], [#strong[Total]]), [#strong[Stretched]], [0.13], [0.675], [0.805], [#strong[Did Not Stretch]], [0.0525], [0.1425], [0.195], [#strong[Total]], [0.1825], [0.8175], [1], )) Using the definition of a probability we get P(Injury) = #math.equation(block: false, alt: "the fraction Number of injuries over Total number of people")[$frac("Number of injuries", "Total number of people")$] = #math.equation(block: false, alt: "the fraction 73 over 400")[$frac(73, 400)$] = 0.1825. #figure(table( columns: 4, align: left, inset: 6pt, table.header([], [#strong[Injury]], [#strong[No Injury]], [#strong[Total]]), [#strong[Stretched]], [0.13], [0.675], [0.805], [#strong[Did Not Stretch]], [0.0525], [0.1425], [0.195], [#strong[Total]], [0.1825], [0.8175], [1], )) Using the table, we can get the same answer very quickly by just taking the column total under Injury to get 0.1825. As we get more complicated probability questions, these contingency tables will help organize your data. b) Using the relative frequency contingency table, take the total of the row for all the members that did not stretch and we get the P(Did Not Stretch) = 0.195. #figure(table( columns: 4, align: left, inset: 6pt, table.header([], [#strong[Injury]], [#strong[No Injury]], [#strong[Total]]), [#strong[Stretched]], [0.13], [0.675], [0.805], [#strong[Did Not Stretch]], [0.0525], [0.1425], [0.195], [#strong[Total]], [0.1825], [0.8175], [1], )) c) Using the relative frequency contingency table, take the intersection of the injury column with the did not stretch row and we get P(Injury and Did Not Stretch) = 0.0525. #figure(table( columns: 4, align: left, inset: 6pt, table.header([], [#strong[Injury]], [#strong[No Injury]], [#strong[Total]]), [#strong[Stretched]], [0.13], [0.675], [0.805], [#strong[Did Not Stretch]], [0.0525], [0.1425], [0.195], [#strong[Total]], [0.1825], [0.8175], [1], )) ] ] #strong[3. Subjective Probability] The probability of event A is estimated using previous knowledge and is someone’s opinion. #examplebox("Example 6")[][ Compute the probability of meeting Dolly Parton. #solutionbox[ I estimate the probability of meeting Dolly Parton to be 1.2E-9 #math.equation(block: false, alt: "¬")[$¬$] 0.0000000012 (i.e. very, very small). ] ] #examplebox("Example 7")[][ What is the probability it will rain tomorrow? #solutionbox[ A weather reporter looks at several forecasts, uses their expert knowledge of the region, and reports the probability that it will rain in Portland, OR, is 80%. #figure(figph[Cartoon of a blue rain cloud labeled 80% with raindrops falling from it, representing an 80% chance of rain.], alt: "Cartoon of a blue rain cloud labeled 80% with raindrops falling from it, representing an 80% chance of rain.", caption: none) ] ]