class: title-slide, center, middle, inverse # .fat[.fancy[Module 02: Probability & Distributions]] ## .fat[.fancy[MPA 6010]] ## .fat[.fancy[Ani Ruhil]] --- <script type="text/x-mathjax-config"> MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{ cancel: ["Extension","cancel"], bcancel: ["Extension","cancel"], xcancel: ["Extension","cancel"], cancelto: ["Extension","cancel"] }); }); </script> # .fat[.fancy[Agenda]] 1. Basic probability theory 2. Probability distributions 3. The Bionomial distribution 4. The Poisson distribution 5. The Normal and Standard Normal distributions --- class: inverse, center, middle # .heat[.fancy[Probability]] --- `Probability` -- a numerical measure of the likelihood that an event will occur. It is, essentially, the proportion of times the event would occur if we repeated the `random trial under identical conditions an infinite number of times`. By definition, `\(0 \le P(Event) \le 1\)` * What is the probability that a song selected at random from your mp3 device will be your favorite song? * What proportion of the products in a production lot will be defective? * What is the probability of drawing an Ace of `\(\spadesuit\)` from a single deck of cards? * What is the probability that an individual exposed to a health information campaign changes his/her behavior? * What is the probability that a randomly selected Gliding Snake undulates at 1.38 Hz? * What is the probability a Freshman at Ohio University, chosen at random, has green eyes? What is the probability that this individual is a male? * A child tests positive for some disease; what is the probability that the child does indeed have the disease? * What is the probability that the next non-White driver pulled over on I95 will have their vehicle searched? --- ## Experiments (Random Trials) An `experiment` is defined as a process that generates well-defined `experimental outcomes` Each experimental outcome is a `sample point` The `sample space` for an experiment is the set of all experimental outcomes (i.e., all the sample points) Outcomes are assumed to be `mutually exhaustive` <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Some Experiments and their Outcomes</caption> <thead> <tr> <th style="text-align:left;"> Experiment </th> <th style="text-align:left;"> Outcomes </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Coin Toss </td> <td style="text-align:left;"> (Head, Tail) </td> </tr> <tr> <td style="text-align:left;"> Sales Call </td> <td style="text-align:left;"> (Sale, No Sale) </td> </tr> <tr> <td style="text-align:left;"> Roll a Die </td> <td style="text-align:left;"> (1,2,3,4,5,6) </td> </tr> <tr> <td style="text-align:left;"> Product Test </td> <td style="text-align:left;"> (Defective, Not defective) </td> </tr> <tr> <td style="text-align:left;"> Health Campaign </td> <td style="text-align:left;"> (Behavior modified, Not modified) </td> </tr> <tr> <td style="text-align:left;"> Green Eyes </td> <td style="text-align:left;"> (Yes, No) </td> </tr> </tbody> </table> --- Probability is the proportion of times the event would occur `if we repeated the random trial under identical conditions an infinite number of times` <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/coinflips-1.svg" alt="Simulated Coin Flips" width="45%" /> <p class="caption">Simulated Coin Flips</p> </div> .fancy[.large[[Flip a coin online here](http://flipacoin.fun/flip-a-coin-10-times)]] --- ## Counting Rules #### Multiple-step Experiments Consider tossing two coins and note that each time you do so you would get one of the following outcomes: `$$S=\{H,H\},\{H,T\},\{T,H\},\{T,T\}$$` Generally, in a multi-step experiment with `\(k\)` sequential steps with `\(n_{1}\)` outcomes in Step 1, `\(n_{2}\)` outcomes in Step 2, `\(n_{3}\)` outcomes in Step 3, ... and `\(n_{k}\)` outcomes in Step `\(k\)`, the total number of experimental outcomes is given by `$$(n_{1})(n_{2})(n_{3})\cdots(n_{k})$$` For e.g., tossing two coins yields `\((n_{1})(n_{2})=(2)(2)=4 \text{ outcomes}\)` Likewise, tossing six coins yields `\((n_{1})(n_{2})(n_{3})(n_{4})(n_{5})(n_{6})=(2)(2)(2)(2)(2)(2)=64 \text{ outcomes}\)` --- Another counting rule allows us to calculate the number of experimental outcomes when the experiment involves `drawing` **n** `objects from a finite set of` **N** `objects` `$$C^{N}_{n} = \left(^{N}_{n}\right) = \dfrac{N!}{n!(N-n)!}$$` where `$$N! = N(N-1)(N-2)\cdots(2)(1) \text{, and}$$` `$$n! = n(n-1)(n-2)\cdots(2)(1)$$` Note that `\(!\)` stands for `factorial`, as in ... `\(0! = 1\)` `\(3! = 3 \times 2 \times 1 = 6\)` `\(5! = 5 \times 4 \times 3 \times 2 \times 1 = 120\)` --- ## Example of Counting Rules in Action (a) Assume a quality control inspector at Apple's iPhone facility in Taiwan selects 2 iPhone 11 units for inspection out of a batch of 5 phones. In how many combinations can these 2 be selected? Applying the counting rule, `$$C^{5}_{2} = \left(^{5}_{2}\right) = \dfrac{5!}{2!(5-2)!}$$` `$$= \dfrac{(5)(4)(3)(2)(1)}{(2)(1)(3)(2)(1)} = \dfrac{(5)(4)\cancel{(3)}\cancel{(2)}\cancel{(1)}}{(2)(1)\cancel{(3)}\cancel{(2)}\cancel{(1)}} = \dfrac{(5)(4)}{(2)(1)} = (5)(2) = 10$$` Seen another way, let the iPhones be labeled A, B, C, D, and E. Then, the selections can be ... AB, AC, AD, AE, BC, BD, BE, CD, CE, DE ... This is the .heatinline[.fancy[.large[ Sample Space ]]] --- (b) The Ohio lottery randomly draws 6 integers from a group of 47 to draw the winner. How many winning combinations are possible? `$$C^{47}_{6} = \left(^{47}_{6}\right) = \dfrac{47!}{6!(47-6)!}$$` `$$= \dfrac{(47)(46)(45)(44)(43)(42)\cancel{(41)}\cancel{(40)}\cancel{(\ldots)}\cancel{(1)}}{(6)(5)(4)(3)(2)(1)\cancel{(41)}\cancel{(40)}\cancel{(\ldots)}\cancel{(1)}} = 10,737,573$$` If only one winner is possible and you can only buy one ticket each, what is the probability you have the winning ticket? `$$\dfrac{1}{10737573} = 9.313092e-08 = 0.00000009313092$$` --- A third counting rule is the counting rule for `permutations` that allows us to calculate the number of experimental outcomes when `\(n\)` objects are to be selected from a total of `\(N\)` objects in a particular order: `$$P_{n}^{N} = n!\left(^{N}_{n}\right) = \dfrac{N!}{(N-n)!}$$` Let us assume 2 iPhone 6 units are to be drawn from 5 for quality control tests. In how many ways can we do this `if the order matters?` `$$P^{5}_{2} = \dfrac{5!}{(5-2)!} = \dfrac{5!}{3!} = \dfrac{(5)(4)(3)(2)(1)}{(3)(2)(1)} = \dfrac{(5)(4)\cancel{(3)}\cancel{(2)}\cancel{(1)}}{\cancel{(3)}\cancel{(2)}\cancel{(1)}} = 20$$` The 20 permutations are `\(\ldots\)` AB, BA, AC, CA, AD, DA, AE, EA, BC, CB, BD, DB, BE, EB, CD, DC, CE, EC, DE, and ED . .. This is the .heatinline[.fancy[.large[ Sample Space ]]] --- # Permutations and Combination + `\(n\)` is the total sample space we are drawing from + `\(r\)` is the number of objects drawn + `\(x! = x \times x-1 \times x-2 \times \ldots \times 1 \times 0\)` #### Keep an eye on order matters or not and if repeats are allowed or not | | Repeats are allowed | Repeats are disallowed | | :- | :-: | :-: | | Permutations (order matters) | `\(n^r\)` | `\(\dfrac{n!}{\left(n-r\right)!}\)` | | Combinations (order does not matter) | `\(\dfrac{\left(r + n - 1\right)!}{r!\left(n-1\right)!}\)` | `\(\dfrac{n!}{r!\left(n-r\right)!}\)` | --- class: inverse, center, middle # .fat[.fancy[ Assigning Probabilities ]] --- ### (a) The Classical Method Thus far we've seen how to use counting rules to establish the Sample Space. Now let us think about the probabilities associated with each outcome. We can assign probabilities to outcomes so long as we use `two rules` (1) For an event `\(E_{i}\)`, the probability must lie in the `\([0,1]\)` range; `\(0\leq P(E_{i})\leq 1\)` (2) Given `\(n\)` outcomes, the sum of the probabilities of these outcomes must be `\(1\)`, i.e., `$$P(E_{1})+P(E_{2})+P(E_{3})+\cdots + P(E_{n}) = 1$$` For e.g., in tossing a fair coin, `\(P(H) = 0.5; P(T) = 0.5; \therefore P(H)+P(T)=1\)` Likewise, in rolling a fair dice, `\(P(1) = \dfrac{1}{6}; P(2) = \dfrac{1}{6}; \cdots P(6) = \dfrac{1}{6}\)`. Therefore, `\(P(1)+P(2)+\cdots+P(6)=1\)` This method of assigning probabilities is known as the .heatinline[.fancy[.large[ classical method ... i.e., all outcomes are equally likely ]]] --- ### (b) The Relative Frequency Method Assume a clerk in the Obleness Hospital's X-ray unit tracks how many patients are on the waiting list at 9:00AM on 20 successive days. These data are given below ... <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">The Relative Frequency Method</caption> <thead> <tr> <th style="text-align:left;"> No. Waiting </th> <th style="text-align:right;"> No. of Days </th> <th style="text-align:left;"> Proportion </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> 0 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:left;"> 2/20 = 0.10 </td> </tr> <tr> <td style="text-align:left;"> 1 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:left;"> 5/20 = 0.25 </td> </tr> <tr> <td style="text-align:left;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 2 </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 6 </td> <td style="text-align:left;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 6/20 = 0.30 </td> </tr> <tr> <td style="text-align:left;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:left;"> 4/20 = 0.20 </td> </tr> <tr> <td style="text-align:left;"> 4 </td> <td style="text-align:right;"> 3 </td> <td style="text-align:left;"> 3/20 = 0.15 </td> </tr> <tr> <td style="text-align:left;"> Total </td> <td style="text-align:right;"> 20 </td> <td style="text-align:left;"> 20/20 = 1.00 </td> </tr> </tbody> </table> .heatinline[.fancy[.medium[ When the technician walked in this morning, how many people should they have expected waiting? ]]] -- It seems, based on past data, that on any given day the technician should expect 2 patients on the waiting list since this outcome has the highest relative frequency of `\(0.30\)` (aka 30%). --- #### Another example ... <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Bridge-building and Relative Frequencies</caption> <thead> <tr> <th style="text-align:center;"> Design </th> <th style="text-align:center;"> Construction </th> <th style="text-align:center;"> Time/Phase </th> <th style="text-align:right;"> Total Time </th> <th style="text-align:center;"> Frequency </th> <th style="text-align:right;"> P(Time) </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 6 </td> <td style="text-align:center;"> (2,6) </td> <td style="text-align:right;"> 8 </td> <td style="text-align:center;"> 6 </td> <td style="text-align:right;"> 6/40 = 0.15 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 7 </td> <td style="text-align:center;"> (2,7) </td> <td style="text-align:right;"> 9 </td> <td style="text-align:center;"> 6 </td> <td style="text-align:right;"> 6/40 = 0.15 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> (2,8) </td> <td style="text-align:right;"> 10 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:right;"> 2/20 = 0.05 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 6 </td> <td style="text-align:center;"> (3,6) </td> <td style="text-align:right;"> 9 </td> <td style="text-align:center;"> 4 </td> <td style="text-align:right;"> 4/40 = 0.10 </td> </tr> <tr> <td style="text-align:center;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 3 </td> <td style="text-align:center;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 7 </td> <td style="text-align:center;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> (3,7) </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 10 </td> <td style="text-align:center;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 8 </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 8/40 = 0.20 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> (3,8) </td> <td style="text-align:right;"> 11 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:right;"> 2/40 = 0.05 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 6 </td> <td style="text-align:center;"> (4,6) </td> <td style="text-align:right;"> 10 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:right;"> 2/40 = 0.05 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 7 </td> <td style="text-align:center;"> (4,7) </td> <td style="text-align:right;"> 11 </td> <td style="text-align:center;"> 4 </td> <td style="text-align:right;"> 4/40 = 0.10 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> (4,8) </td> <td style="text-align:right;"> 12 </td> <td style="text-align:center;"> 6 </td> <td style="text-align:right;"> 6/40 = 0.15 </td> </tr> </tbody> </table> Note that most projects seem to have taken `three months for design and seven months for construction` Hence the company feels the most likely time to completion will be `3 + 7 = 10 months` --- ### (c) The Subjective method In most situations where hard data are lacking, we rely on theories or then on our `subjective beliefs` to assign probabilities to likely outcomes. Assume, for example, that a couple makes an offer on a house but each holds different probabilities of their bid being accepted versus being rejected <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Subjective Probabilities</caption> <thead> <tr> <th style="text-align:left;"> Person </th> <th style="text-align:right;"> P(Acceptance) </th> <th style="text-align:right;"> P(Rejection) </th> <th style="text-align:right;"> Sum </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Pat </td> <td style="text-align:right;"> 0.8 </td> <td style="text-align:right;"> 0.2 </td> <td style="text-align:right;"> 1 </td> </tr> <tr> <td style="text-align:left;"> Chris </td> <td style="text-align:right;"> 0.6 </td> <td style="text-align:right;"> 0.4 </td> <td style="text-align:right;"> 1 </td> </tr> </tbody> </table> --- ### Example 1: Venture Capital Funding Of 2,374 venture capital awards disbursed nationwide in 2016, 1,434 went to CA, 390 to MA, 217 to NY, and 112 to CO. Some 22% went to companies in early stages and 55% to expanding companies. .pull-left[ | State | Companies | | :-- | --: | | CA | 1,434 | | CO | 112 | | MA | 390 | | NY | 217 | | Other States | 221 | | Total | 2,374 | ] .pull-right[ * `\(P(\text{California})=\dfrac{1434}{2374}=0.60\)` * P(Company from other state) `\(=\dfrac{221}{2374} = 0.09\)`. * P(Company not in early stage)? ... P(Not in early stage) `\(=1-0.22 = 0.78\)` * P(How many MA companies were in early stages, assuming early stage companies were evenly distributed across states)? `\(=(0.22)(390) \approx 86\)` * If the total amount was $32.4 million, how much went to CO? ... If fund distributed in proportion to the relative distribution of awards, then, `$$=\dfrac{112}{2374} \times (32.4 \text{ billion}) = 1.53 \text{ billion}$$` ] --- ### Example 2: Rolling Two Dice Two dice are rolled and we are interested in the `sum of face values showing on the 2 dice` Possible outcomes are (1,1), (1,2), (1,3), (1,4), (1,5), (1,6) ... (6,1), (6,2), (6,3), (6,4), (6,5), (6,6). In other words, `\(C^{6}_{1} \times C^{6}_{1} =(6)(6)=36\)` outcomes .left-column[ <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Sum of Two Dice</caption> <thead> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> </th> <th style="text-align:right;"> </th> <th style="text-align:right;"> </th> <th style="text-align:right;"> </th> <th style="text-align:right;"> </th> <th style="text-align:right;"> </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> </tr> <tr> <td style="text-align:left;"> 1 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> </tr> <tr> <td style="text-align:left;"> 2 </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> </tr> <tr> <td style="text-align:left;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 9 </td> </tr> <tr> <td style="text-align:left;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 10 </td> </tr> <tr> <td style="text-align:left;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 11 </td> </tr> <tr> <td style="text-align:left;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 11 </td> <td style="text-align:right;"> 12 </td> </tr> </tbody> </table> ] .right-column[ * What is P(value of 7)? `\(P(7)=\dfrac{\{(1,6), (6,1), (2,5), (5,2), (3,4), (4,3)\}}{36} = \dfrac{6}{36}=\dfrac{1}{6}\)` * What is P(value `\(\geq 9\)`)? `\(P(\geq 9)=\dfrac{10}{36}=\dfrac{5}{18}\)` * Will the sum of the two dice show even values more often than odd values? No because P(Odd) = P(Even) = `\(\dfrac{18}{36} = \dfrac{1}{2}\)` ] --- ### Example 3: Fortune 500 Companies The table below shows the registration of Fortune 500 companies in some states. <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Headquarters of Fortune 500 Companies</caption> <thead> <tr> <th style="text-align:left;"> State Headquartered </th> <th style="text-align:right;"> No. of Fortune 500 Cos. </th> <th style="text-align:right;"> Proportion </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> New York </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 56 </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 0.112 </td> </tr> <tr> <td style="text-align:left;"> California </td> <td style="text-align:right;"> 53 </td> <td style="text-align:right;"> 0.106 </td> </tr> <tr> <td style="text-align:left;"> Texas </td> <td style="text-align:right;"> 43 </td> <td style="text-align:right;"> 0.086 </td> </tr> <tr> <td style="text-align:left;"> Illinois </td> <td style="text-align:right;"> 37 </td> <td style="text-align:right;"> 0.074 </td> </tr> <tr> <td style="text-align:left;"> Ohio </td> <td style="text-align:right;"> 28 </td> <td style="text-align:right;"> 0.056 </td> </tr> <tr> <td style="text-align:left;"> Pennsylvania </td> <td style="text-align:right;"> 28 </td> <td style="text-align:right;"> 0.056 </td> </tr> </tbody> </table> If I pick a company at random, * What is P(NY)? `\(=\dfrac{56}{500}=0.112\)` ... What is P(TX)? `\(=\dfrac{43}{500}=0.086\)` * What is P(in any of these six states)? `\(=\dfrac{(56+53+43+37+28+28)}{500}=\dfrac{245}{500}=0.49\)` --- class: inverse, center, middle # .fat[.fancy[More Rules]] --- ## The Complement of an Event Given an event A, its `complement` is defined as the event consisting of all sample points that do not belong to (i.e., are not in) event A, and is denoted as `\(A^c\)`. `$$P(A) + P(A^c) = 1 \\ \therefore P(A) = 1 - P(A^c) \\ \therefore P(A^c) = 1 - P(A)$$` Toss a coin once: `\(P(H) = 0.5; P(H^c) = 1- P(H) = 1-0.5 = 0.5\)` Roll two dice: `\(P(\text{value } \geq 9) = \dfrac{5}{18}\)` `\(P(\text{value } < 9) = 1 - P(\text{value } \geq 9) = 1 - \dfrac{5}{18} = \dfrac{13}{18}\)` --- ## Mutually Exclusive Events Two events are `mutually exclusive` if both cannot occur simultaneously. That is, if event A occurs then event B cannot occur, and vice-versa. Say I toss a coin once. It can only come up Heads or Tails. Let, for example, `$$P(A) = Heads; P(B) = Tails \\ P(A \text{ and } B) = 0 \\ \ldots \text{ because there is no overlap ... A and B are mutually exclusive}$$` Similarly, say I roll a dice once. Let, for example, `$$P(A) = \{1, 3, 5\}; P(B) = \{2, 4, 6\} \\ P(A \text{ and } B) = 0 \\ \ldots \text{ because there is no overlap ... A and B are mutually exclusive}$$` What if I again roll a dice once and this time `$$P(A) = \{2, 4, 6\}; P(B) = \{1, 4\} \\ P(A \text{ and } B) \neq 0 \\ \ldots \text{ because there is an overlap ... A and B are not mutually exclusive}$$` --- ## Addition Rule for Non-Mutually Exclusive Events For `non-mutually exclusive events` we calculate the probability that event A or B occurs as `$$P(A \text{ or } B) = P(A) + P(B) - P(A \text{ and } B)$$` Assume on a typical day in a plant, of 50 workers 5 complete the work late, 6 assemble a defective product, and 2 both complete the work late and produce a defective product Let L = Late completion. Then, `\(P(L)=\dfrac{5}{50} =0.10\)` Let D = Defective product. Then, `\(P(D)=\dfrac{6}{50} =0.12\)` `\(P(L \text{ and } D) = \dfrac{2}{50}=0.04\)` What is the probability that a randomly selected worker either is late or produces a defective product? `$$P(L \text{ or } D)=P(L)+P(D)-P(L \text{ and } D) = 0.10 + 0.12 - 0.04 = 0.18$$` --- ## Independent Events and the Multiplication Rule If two events A and B are independent, then the probability that both A and B occur is given by `$$P(A \text{ and } B) = P(A) \times P(B)$$` For example, assume we are told that for a randomly chosen adult, `$$P(\text{smoking})=0.17 \text{ and } P(\text{high blood pressure}) = 0.22$$` If smoking and high blood pressure are independent, what is `\(P(\text{smoking and high blood pressure})\)`? This would be `\(P(A \text{ and } B) = P(A) \times P(B) = 0.17 \times 0.22 = 0.037\)`. > **Note:** If you ran a survey and asked folks whether they smoke AND have high blood pressure, AND found that the proportion of respondents who smoked and had high blood pressure was way different from 0.037, that would suggest that perhaps smoking and high blood pressure are not independent. --- ### Example: Powerball Powerball played twice per week in 23 states, VI, and DC. Player must buy $1 ticket and pick five numbers from `\(1 \ldots 53\)` and one Powerball number from `\(1 \ldots 42\)`. Lottery officials draw (i) 5 White balls out of drum with 53 White balls, and (ii) 1 Red ball from drum with 42 Red balls. The winner must match 5 numbers on White balls (any order) and the number on the Red Powerball.<sup>1</sup> Minor prizes of $100,000 given if 5 White ball numbers matched. In how many ways can five numbers be selected? `$$C^{53}_{5}=\dfrac{53!}{5!(53-5)!}=\dfrac{53!}{5!(48)!} = \dfrac{(53)(52)(51)(50)(49)}{(5)(4)(3)(2)(1)}=2,869,685$$` What is P(winning $100,000)? `\(=\dfrac{1}{2,869,685}\)` Odds of picking the Red Powerball? `\(C^{42}_{1}=\dfrac{42!}{1!(42-1)!}=\dfrac{42!}{41!} = 42; \therefore \mbox {Odds of picking Red ball} = \dfrac{1}{42}\)` Odds of winning Powerball jackpot? `\(P(A) \mbox{ and } P(B) = P(A) \times P(B) = \left(\dfrac{1}{2869685}\right)\times\left(\dfrac{1}{42}\right)=\dfrac{1}{120,526,770}\)` .footnote[[1] In Augusts 2001, 4 winners shared USD 295 million by matching `\(8, 17, 22, 42, 47\)` plus Powerball number `\(21\)`.] --- ### Two Boys or Two Girls or One of Each? .pull-left[ In any singleton birth the in the US there is a 0.512 chance the baby will be a boy (A) and 0.488 chance the baby will be a girl (B). What is the probability of a family that ends up having 2 children having 2 boys? 2 girls? 1 Boy and 1 Girl? + 2 Boys: `\(P(A) \times P(A) = (0.512 \times 0.512)\)` + 2 Girls: `\(P(B) \times P(B) = (0.488 \times 0.488)\)` + 1 Boy & 1 Girl: `\([P(A) \times P(B)] + [P(B) \times P(A)] \\ = (0.512 \times 0.488) + (0.488 \times 0.512)\)` + Both same gender: `\([P(A) \times P(A)] + [P(B) \times P(B)] \\ = (0.512 \times 0.512) + (0.488 \times 0.488)\)` + At least 1 Girl: `\(1 - \text{P(2 Boys)} = 0.737856\)` + At least 1 Boy: `\(1 - \text{P(2 Girls)} = 0.761856\)` ] .pull-right[ `The sex of the first child has no bearing on the sex of the second child`
] --- ## Conditional Probability ... the probability of some event occurring given that a condition is met (i.e., another event is known to have occurred) Conditional probabilities are denoted as `\(P(A | B)\)` (i.e., the probability of A `given that B has occurred`) and `\(P(A | B) = \dfrac{P(A \text{ and } B)}{P(B)}\)` Similarly, we have `\(P(B | A) = \dfrac{P(A \text{ and } B)}{P(A)}\)`, (i.e., the probability of B `given that A has occurred`). For example, let B be an event of getting a perfect square when a dice is rolled. Let A be the event that the number on the dice is an odd number. What is `\(P(B|A)\)`? The Sample Space is `\(S=\{1,2,3,4,5,6\}\)`; `\(A =\{1,3,5\}\)`; `\(B=\{1,4\}\)`. Then, `\(P(A \text{ and } B)=\dfrac{1}{6}; P(A)=\dfrac{1}{2}; P(B)=\dfrac{1}{3}\)` and hence `\(P(B|A)=\dfrac{P(A \text{ and } B)}{P(A)}=\dfrac{\dfrac{1}{6}}{\dfrac{1}{2}}=\dfrac{1}{6} \times \dfrac{2}{1}=\dfrac{2}{6}=\dfrac{1}{3}\)` For dependent events, the `multiplication rule` that determines the probability that `both A and B occur` becomes: `$$\begin{array}{l} P(A \text{ and } B) = P(A) \times P(B | A), \text{ and } P(A \text{ and } B) = P(B) \times P(A | B) \end{array}$$` --- ### The Gender-bias Example Say we have a city police department and there have been claims that men and women are not promoted at the same rate. Let us assume that when candidates are eligible for promotion they are equally qualified, regardless of sex. You are hired to investigate whether this claim of a gender bias has any merit to it. You ask for data on all officers currently serving in the city and for each officer whether they were promoted or not. The data are shown below. <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">An Example of Conditional Probability</caption> <thead> <tr> <th style="text-align:left;"> Action </th> <th style="text-align:right;"> Men </th> <th style="text-align:right;"> Women </th> <th style="text-align:right;"> Total </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Promoted </td> <td style="text-align:right;"> 288 </td> <td style="text-align:right;"> 36 </td> <td style="text-align:right;"> 324 </td> </tr> <tr> <td style="text-align:left;"> Denied Promotion </td> <td style="text-align:right;"> 672 </td> <td style="text-align:right;"> 204 </td> <td style="text-align:right;"> 876 </td> </tr> <tr> <td style="text-align:left;"> Total </td> <td style="text-align:right;"> 960 </td> <td style="text-align:right;"> 240 </td> <td style="text-align:right;"> 1200 </td> </tr> </tbody> </table> If Men and Women had the same probability of being promoted each group should have `\(P(A)=\dfrac{324}{1200}= 0.27\)` ... `this should occur if the officer's gender has nothing to do with being promoted or not` If true, then we have `\(P(A \text{ and } M) = P(A \text{ and } W) = 0.27\)` Of course, the point is to see if the evidence supports this presumed equality --- We can now ask: What is the probability that an officer is promoted `given that the officer is a man`? `$$P(A|M) = \dfrac{P(A \text{ and } M)}{P(M)} = \dfrac{288/1200}{960/1200} = \dfrac{288}{960} = 0.30$$` Similarly, we might ask: What is the probability of being denied a promotion `given that the officer is a woman`? `$$P(A^{c}|W) = \dfrac{P(A^{c} \text{ and } W)}{P(W)} = \dfrac{204/1200}{240/1200} = \dfrac{204}{240} = 0.85$$` <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Probabilities for the preceding table</caption> <thead> <tr> <th style="text-align:left;"> Action </th> <th style="text-align:left;"> Men </th> <th style="text-align:left;"> Women </th> <th style="text-align:left;"> Total </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Promoted </td> <td style="text-align:left;"> P(.) = 0.24 </td> <td style="text-align:left;"> P(.) = 0.03 </td> <td style="text-align:left;"> P(.) = 0.27 </td> </tr> <tr> <td style="text-align:left;"> Denied Promotion </td> <td style="text-align:left;"> P(.) = 0.56 </td> <td style="text-align:left;"> P(.) = 0.17 </td> <td style="text-align:left;"> P(.) = 0.73 </td> </tr> <tr> <td style="text-align:left;"> Total </td> <td style="text-align:left;"> P(.) = 0.80 </td> <td style="text-align:left;"> P(.) = 0.20 </td> <td style="text-align:left;"> P(.) = 1.00 </td> </tr> </tbody> </table> What would you conclude and report back to the city? Unfortunately, that female officers do not seem to be promoted at the same rate as are male officers Notice how `conditional probability` and `independent events` allowed you to tackle this question! --- ### Example: Serengeti Lions and Cape Buffalo In the first hour of a hunting trip, the probability that a pride of Serengeti lions will encounter a Cape buffalo is 0.035. If it encounters a buffalo, the probability that the pride successfully captures the buffalo is 0.40. `What is the probability that the next one-hour of a hunt the pride will successfully capture a Cape buffalo?` Let `\(A =\)` the probability of encountering a Cape Buffalo and `\(B =\)` the probability of capture if the pride finds a buffalo. We are given `\(P(A)=0.035\)` and `\(P(B|A) = 0.40\)`. `\(P(B|A)\)` is the conditional probability that the pride `both sees a Cape Buffalo AND kills it.` We are dealing with dependent events (the pride cannot kill without encountering a Cape Buffalo) and are being asked to find the probability of both events occurring. For two dependent events, we know that `\(P(A \text{ and } B) =\)` `\(P(A) \times P(B|A)\)` Using the respective values given to us for `\(P(A)\)` and `\(P(B|A)\)`, we have `$$P(A \text{ and } B) = P(A) \times P(B|A) = 0.035 \times 0.40 = 0.014$$` The probability the pride will be successful is 0.014 or 1.4%. --- ## Dependent Events Many events are not independent of one another; the `odds of event A change if event B has occurred (and vice versa)`. Take the Nasonia's fascinating behavior, for example. The jewel wasp *Nasonia vitripennis* is a parasite laying its eggs on the pupae of flies. The larval Nasonia hatch inside the pupal case, feed on the live host, and grow until they emerge as adults from the now dead, emaciated host. Emerging males and females, possibly brother and sister, mate on the spot. Nasonia females have a remarkable ability to manipulate the sex of the eggs that they lay; if they fertilize the egg with stored sperm the offspring will be a female. When a female finds a fresh host (i.e., not parasitized), she lays mainly female eggs and a few sons needed to fertilize all her daughters. If the female finds the host to be parasitized she produces a higher proportion of sons. Thus the state of the host (parasitized or not) and the sex of an egg are dependent events. Let the probability a host already has eggs be = 0.20. If it is a fresh host, the female lays a male egg with a probability of 0.05 and a female egg with a probability of 0.95. If the host already has eggs the female lays a male egg with a probability of 0.90 and a female egg with a probability of 0.10. `What is the probability that an egg, chosen at random, is male?` --- <img src="nasonia.png" width="70%" style="display: block; margin: auto;" /> What is `\(P(\text{egg is male})\)`? ... `\(0.18 + 0.04 = 0.22\)` What is `\(P(\text{egg is female})\)`? ... `\(0.02 + 0.76 = 0.78\)` --- `The Law of Total Probability` stipulates that the total probability of an event `\(A\)` is given by `$$P(A) = \left[P(A|B) \times P(B)\right] + \left[ P(A|B^c) \times P(B^c)\right]$$` `The Multiplication Rule:` probability of both of two events occurring is `\(P(A \text{ and } B) = P(A) \times P(B | A)\)`. If the two events are independent then we know that `\(P(A \text{ and } B) = P(A) \times P(B)\)` What is `\(P(\text{egg is male})\)`? We don't know if the host is parasitized so ... `\(P(\text{egg is male}) = \\ P(\text{host parasitized}) \times P(\text{egg is male } | \text{ host parasitized}) + \\ P(\text{host not parasitized}) \times P(\text{egg is male } | \text{ host is not parasitized})\)` `\(\therefore P(\text{egg is male}) = (0.20 \times 0.90) + (0.80 \times 0.05) = 0.22\)` What is `\(P(\text{egg is female})\)`? We don't know if the host is parasitized so ... `\(P(\text{egg is female}) = \\ P(\text{host parasitized}) \times P(\text{egg is female } | \text{ host parasitized}) + \\ P(\text{host not parasitized}) \times P(\text{egg is female } | \text{ host is not parasitized})\)` `\(\therefore P(\text{egg is female}) = (0.20 \times 0.10) + (0.80 \times 0.95) = 0.78\)` --- ### Another Example: Washrooms and Washing Hands You are the health inspector for your city and tasked with improving airport washroom hygiene in the city's lone airport You know that the probability of a man washing his hands after using the washroom is 0.74 and that of a woman is 0.83 Assume there are 40 men and 60 women waiting to use the washroom. `What is the probability that the next person to use the washroom will wash his/her hands?` Total Probability is being asked for, i.e., it could be a man who washes his hands or a woman who washes her hand We know `\(P(Man)=0.40\)` and `\(P(Woman)=0.60\)`. We are also given `\(P(Washes|Man)=0.74\)` and `\(P(Washes|Woman)=0.83\)` `$$P(Washes) = P(Washes|Man) \times P(Man) + P(Washes|Woman) \times P(Woman)$$` `$$= (0.74 \times 0.40) + (0.83 \times 0.60) = 0.296 + 0.498 = 0.794$$` --- class: inverse, center, middle # .fat[.fancy[ Bayes' Theorem ]] --- ## Bayes' Theorem Say I present you with the following information: > 1% of women at age forty who participate in routine screening have breast cancer. 80% of women with breast cancer will get positive mammographies. 9.6% of women without breast cancer will also get positive mammographies. A 40-year old woman had a positive mammography in a routine screening. >`What is the probability that she actually has breast cancer?` <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Breast Cancer and Bayes Theorem</caption> <thead> <tr> <th style="text-align:left;"> Test result </th> <th style="text-align:left;"> Has cancer </th> <th style="text-align:left;"> Does not have cancer </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Tests Positive </td> <td style="text-align:left;"> 0.800 </td> <td style="text-align:left;"> 0.096 </td> </tr> <tr> <td style="text-align:left;"> Tests Negative </td> <td style="text-align:left;"> ? </td> <td style="text-align:left;"> ? </td> </tr> </tbody> </table> --- Start by assuming a certain population size of 40-year old women who are tested, say, `\(N = 100,000\)`. We know that 1% of these will have breast cancer, which amounts to `\(1,000\)` women Some 80% of women with breast cancer will get a positive test result, i.e, `\(0.80 \times 1000 = 800\)`, which implies that the other `\(200\)` women who `have breast cancer will test negative` We are also told that 9.6% of women without breast cancer will still get a positive test result. This amounts to `\(0.096 \times 99000 = 9,504\)`. This means that `\(89,496\)` women will have a `negative test and have no breast cancer` Entering these values into the table we can calculate `the probability that a woman with a positive test result actually has breast cancer` to be `\(\dfrac{800}{10304} = 0.0776\)` or 7.76% What about `the probability that the woman has a negative test result and yet has breast cancer?` This would be `\(\dfrac{200}{89696} = 0.0022\)` or 0.22% <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Breast Cancer and Bayes Theorem (Part 3)</caption> <thead> <tr> <th style="text-align:left;"> Test Result </th> <th style="text-align:right;"> Will have cancer </th> <th style="text-align:right;"> Will not have cancer </th> <th style="text-align:right;"> Row Total </th> <th style="text-align:left;"> Probability </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Positive </td> <td style="text-align:right;"> 800 </td> <td style="text-align:right;"> 9504 </td> <td style="text-align:right;"> 10304 </td> <td style="text-align:left;"> 800/10304 = 0.0776 </td> </tr> <tr> <td style="text-align:left;"> Negative </td> <td style="text-align:right;"> 200 </td> <td style="text-align:right;"> 89496 </td> <td style="text-align:right;"> 89696 </td> <td style="text-align:left;"> 200/89696 = 0.0022 </td> </tr> <tr> <td style="text-align:left;"> Total </td> <td style="text-align:right;"> 1000 </td> <td style="text-align:right;"> 99000 </td> <td style="text-align:right;"> 100000 </td> <td style="text-align:left;"> </td> </tr> </tbody> </table> --- Once could arrive at the same conclusion via applying Bayes' Theorem, as shown below. `$$P(B | A) = \dfrac{P(A | B) \times P(B)}{\left[ P(A | B) \times P(B) \right] + \left[ P(A | B^c) \times P(B^c) \right]} \\ = \dfrac{0.800 \times 0.01}{\left[ 0.800 \times 0.01 \right] + \left[0.096 \times 0.990 \right]} = \dfrac{0.008}{\left[0.008 + 0.09504 \right]} = \dfrac{0.008}{0.10304} = 0.0776$$` `\(P(B|A) = \dfrac{P(A|B) \times P(B)}{P(A)}\)` What is `\(P(A|B)\)` ... the probability that a woman has Breast Cancer and gets a positive mammography? `\(= 0.80\)`? What is `\(P(B)\)`? ... this is 0.01 What is `\(P(A)\)`? ... This is the probability of getting a positive mammography, which can happen as follows: (1) when she has Breast Cancer ... `\((0.80 \times 0.01)\)`, or (2) when she doesn't have Breast Cancer ... `\((0.096 \times 0.99)\)` `$$P(A) = (0.80 \times 0.01) + (0.096 \times 0.99) = 0.10304 \\ P(B|A) = \dfrac{P(A|B) \times P(B)}{P(A)} = \dfrac{0.80 \times 0.01}{0.10304} = \dfrac{0.008}{0.10304} = 0.07763975$$` --- ## Another Example Suppose a patient exhibits symptoms that make her physician concerned that she may have a particular disease. The disease is relatively rare in this population, with a prevalence of 0.2% (meaning it affects 2 out of every 1,000 persons). The physician recommends a screening test that costs $250 and requires a blood sample. Before agreeing to the screening test, the patient wants to know what will be learned from the test, specifically she wants to know the probability of disease, given a positive test result, i.e., P(Disease | Screen Positive). The physician reports that the screening test is widely used and has a reported sensitivity of 85%. In addition, the test comes back positive 8% of the time and negative 92% of the time. [Source](http://sphweb.bumc.bu.edu/otlt/mph-modules/bs/bs704_probability/bs704_probability_print.html) <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Testing Positive and Bayes Theorem</caption> <thead> <tr> <th style="text-align:left;"> Test Result </th> <th style="text-align:right;"> Sick </th> <th style="text-align:right;"> Healthy </th> <th style="text-align:right;"> Total </th> <th style="text-align:left;"> Probability </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Positive </td> <td style="text-align:right;"> 170 </td> <td style="text-align:right;"> 7830 </td> <td style="text-align:right;"> 8000 </td> <td style="text-align:left;"> 170/8000 = 0.02125 </td> </tr> <tr> <td style="text-align:left;"> Negative </td> <td style="text-align:right;"> 30 </td> <td style="text-align:right;"> 91970 </td> <td style="text-align:right;"> 92000 </td> <td style="text-align:left;"> 30/92000 = 0.000326087 </td> </tr> <tr> <td style="text-align:left;"> Total </td> <td style="text-align:right;"> 200 </td> <td style="text-align:right;"> 99800 </td> <td style="text-align:right;"> 100000 </td> <td style="text-align:left;"> </td> </tr> </tbody> </table> --- What is `\(P(Sick | +Test)\)`? We know that `\(P(Sick | +Test) = \dfrac{P(+{Test} | S) \times P(Sick)}{P(+{Test})}\)` We know that `\(P(+{Test} | Sick) = 0.85\)`, that `\(P(Sick) = 0.002\)`, and that `\(P(+{Test}) = 0.08\)` Therefore, `\(P(Sick | +Test) = \dfrac{0.85 \times 0.002}{0.08} = 0.021\)` ... There is a 2.1% chance the patient is actually sick if the test comes back positive. What if the test comes back as a false positive ... i.e., What is the chance the patient is actually healthy but the test is positive? This requires calculating `$$P(+Test | \text{ Not Sick }) = \dfrac{P(\text{Healthy } | +{Test}) \times P(+Test)}{P(Healthy)} \\ = \dfrac{1 - 0.021 \times (0.08)}{1 - 0.002} = 0.078$$` or 7.8%; a healthy patient can still test positive for the disease 7.8% of the time. --- ## Key Things to Remember (a) The Addition Rule + Non-Mutually Exclusive Events: `\(P(\text{A or B}) = P(A) + P(B) - P(\text{A and B})\)` + Mutually Exclusive Events: `\(P(\text{A or B}) = P(A) + P(B)\)` (b) Multiplication Rule + Independent Events: `\(P(\text{A and B}) = P(A) \times P(B)\)` + Dependent Events: `\(P(\text{A and B}) = P(A) \times P(B | A)\)` and `\(P(\text{B and A}) = P(B) \times P(A | B)\)` (c) A and B are mutually exclusive if `\(P(\text{A and B}) = 0\)` (d) A and B are independent if `\(P(A|B) = P(A)\)`; `\(P(B|A) = P(B)\)` (e) Total Probability: `\(P(B) = P(A) \times P(B|A) + P(A^c) \times P(B|A^c)\)` (f) Bayes' Rule: `\(P(A|B) = \dfrac{P(A)\times P(B|A)}{P(B)}\)`; and `\(P(B|A) = \dfrac{P(B)\times P(A|B)}{P(A)}\)` --- class: inverse, center, middle # .fancy[.fat[Probability Distributions]] --- ## Understanding random variables A `random variable` is a numerical description of the outcome of an experiment. * a discrete random variable assumes discrete values * a continuous random variable may assume any value in an interval or collection of intervals .pull-left[ | **Discrete Random Variable (x)** | **Possible values** | | -:- | -:- | | No. of defective iPhones | `\(0,1,2,3,\cdots,49\)` | | Sex of car buyer | Male; Female | | No. of Mountain Lions seen | `\(0,1,2,3,\cdots,419\)` | | Gene Length (number of nucleotides) | `\(60 \leq x \leq 100000\)` | ] .pull-right[ | **Continuous Random Variable (x)** | **Possible Values** | | -:- | -:- | | Spending per week | `\(0 \leq x \leq +\infty\)` | | Travel times to CMH (minutes) | `\(55.3 \leq x \leq 118.5\)` | | Undulation rates of Gliding Snakes | `\(0 \leq x \leq 1.9\)` | | Petal Length of the virginica Iris (in cm) | `\(1 \leq x \leq 6.7\)` | ] --- ## Discrete Probability Distributions A .heatinline[.fancy[ probability distribution ]] is a list of the probabilities of all mutually exclusive events (aka outcomes) of a random trial. A probability distribution of a discrete random variable `\((Y)\)` describes how probabilities are distributed over the values of the random variable, and is denoted by `\(f(Y)\)`. .pull-left[ .heatinline[.fancy[ Discrete probability functions ]] must meet two conditions ... (1) `\(f(Y) \geq 0 \cdots\)` every outcome must have some probability of occurring (2) `\(\sum f(Y) = 1 \cdots\)` the sum of the probabilities of all outcomes must be `\(=1\)` ] .pull-right[ | Red Fox Sightings `\((Y)\)` | Days | `\(f(Y)\)` | | :--: | --: | --: | | 0 | 54 | `\(f(0)=0.18\)` | | 1 | 117 | `\(f(1)=0.39\)` | | 2 | 72 | `\(f(2)=0.24\)` | | 3 | 42 | `\(f(3)=0.14\)` | | 4 | 12 | `\(f(4)=0.04\)` | | 5 | 3 | `\(f(5)=0.01\)` | | Total | 300 | `\(\sum f(Y)=1.00\)` | ] --- .pull-left[ The frequencies <img src="module02_files/figure-html/unnamed-chunk-5-1.svg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ The relative frequencies as a percentage <img src="module02_files/figure-html/unnamed-chunk-6-1.svg" width="100%" style="display: block; margin: auto;" /> ] --- ## Rolling two dice <img src="module02_files/figure-html/dice-1.svg" width="70%" style="display: block; margin: auto;" /> --- .pull-left[ The frequencies of the sum of the numbers on the 2 dice <img src="module02_files/figure-html/sumdice-1.svg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ The table of possible outcomes; one dice is in rows and the other in columns <table class="table table-striped" style="font-size: 20px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Sum of Two Dice</caption> <thead> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> </th> <th style="text-align:right;"> </th> <th style="text-align:right;"> </th> <th style="text-align:right;"> </th> <th style="text-align:right;"> </th> <th style="text-align:right;"> </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> </tr> <tr> <td style="text-align:left;"> 1 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> </tr> <tr> <td style="text-align:left;"> 2 </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> </tr> <tr> <td style="text-align:left;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 9 </td> </tr> <tr> <td style="text-align:left;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 10 </td> </tr> <tr> <td style="text-align:left;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 11 </td> </tr> <tr> <td style="text-align:left;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 11 </td> <td style="text-align:right;"> 12 </td> </tr> </tbody> </table> ] --- ## The Binomial Distribution 1. The number of trials `\((n)\)` is fixed 2. Each trial is independent of all other trials 3. Only two mutually exclusive and mutually exhaustive outcomes likely to occur in any given trial, with one outcome defined as `success` and the other defined as `failure` 4. The probability of observing a success `\((p)\)` does not vary across trials. Because there are only two outcomes, this means the probability of observing a failure `\((q)\)` also does not vary across trials. Further, `\(p = 1 - q\)` and `\(q = 1 - p\)` Mathematically, `the probability of observing` `\(x\)` `successes in` `\(n\)` `trials of a binomial process is given by` `$$P\left[x \text{ successes}\right] = \binom{n}{x}p^{x}\left(1 - p\right)^{n-x} \\ \text{where } \binom{n}{x} = \dfrac{n!}{x!(n-x)!} \text{ and } n! = n \times (n-1) \times (n-2) \times \cdots \times 2 \times 1$$` --- I toss a coin 2 times, what is the probability of getting exactly 1 head? success `\(= x\)`; `\(x=1\)`, and `\(n=2\)` independent trials How many outcomes are likely in our 2 independent trials? We know this to be `\((2)^{2} = 4\)` and these outcomes will be `\(\left[HH,HT,TH,TT\right]\)` In how many ways can we get 1 head out of 2 tosses? ... `\(\left[HT,TH\right]\)` and hence probability of getting exactly 1 head in 2 tosses is `\(\dfrac{2}{4} = 0.5\)` `$$P\left[x \text{ Successes}\right] = \binom{n}{x}p^{x}\left(1 - p\right)^{n-x} \\ \therefore P\left[1 \text{ Success}\right] = \binom{2}{1}(0.50)^{1}\left(1 - 0.50\right)^{2-1} = \binom{2}{1}(0.50)^{1}\left(0.50\right)^{1} \\ \binom{2}{1} = \dfrac{2\times 1}{\left(1\right) \left(1 \right)} = 2 \\ \therefore, P\left[1 \text{ Success}\right] = (2) \times (0.5) \times (0.5) = 0.50$$` --- If I toss a coin 3 times, what is the probability of getting exactly 1 head? How many outcomes are likely in 3 independent trials? We know this to be `\((2)^{3} = 8\)` ... `\(\left[HHH, HHT, HTH, HTT, TTT, TTH, THT, THH \right]\)` In how many ways can we get 1 Head out of 3 tosses? ... `\(\left[HTT, THT, TTH \right]\)` and hence probability of getting exactly 1 Head in 3 tosses is `\(\dfrac{3}{8} = 0.375\)` `$$P\left[x \text{ Successes}\right] = \binom{n}{x}p^{x}\left(1 - p\right)^{n-x} \\ \therefore P\left[1 \text{ Success}\right] = \binom{3}{1}(0.50)^{1}\left(1 - 0.50\right)^{3-1} = \binom{3}{1}(0.50)^{1}\left(0.50\right)^{2} \\ \binom{3}{1} = \dfrac{3 \times 2\times 1}{\left(1\right) \left(2 \times 1 \right)} = 3 \\ \therefore, P\left[1 \text{ Success}\right] = (3) \times (0.5) \times (0.25) = 0.375$$` --- What would the distribution of heads look like if I flipped a coin 10 times? `\(x = 0\)` heads? `$$P\left[x \text{ Successes}\right] = \binom{n}{x}p^{x}\left(1 - p\right)^{n-x} \\ \therefore P\left[0 \text{ Success}\right] = \binom{10}{0}(0.50)^{0}\left(1 - 0.50\right)^{10-0} = \binom{10}{0}(0.50)^{0}\left(0.50\right)^{10} \\ \binom{10}{0} = \dfrac{10 \times 9 \times 8 \times \ldots\times 2\times 1}{\left(0\right) \left(10 \times 9 \times 8 \times \ldots \times 2 \times 1 \right)} = 1 \\ \therefore, P\left[0 \text{ Successes}\right] = (1) \times (0.5) \times (0.0009765625) = 0.0009765625$$` `\(x = 1\)` head? `$$P\left[1 \text{ Success}\right] = \binom{10}{1}(0.50)^{1}\left(1 - 0.50\right)^{10-1} = \binom{10}{1}(0.50)^{1}\left(0.50\right)^{9} \\ \binom{10}{1} = \dfrac{10 \times 9 \times 8 \times \ldots\times 2\times 1}{\left(1\right) \left(9 \times 8 \times \ldots \times 2 \times 1 \right)} = 10 \\ \therefore, P\left[1 \text{ Success}\right] = (10) \times (0.5) \times (0.001953125) = 0.009765625$$` --- ### Probability of `\([0,10]\)` heads .... .pull-left[ <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Number of Heads in 10 Coin Flips</caption> <thead> <tr> <th style="text-align:right;"> No. of Heads (x) </th> <th style="text-align:right;"> Relative Frequency f(x) </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 0.0010 </td> </tr> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 0.0098 </td> </tr> <tr> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 0.0439 </td> </tr> <tr> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 0.1172 </td> </tr> <tr> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 0.2051 </td> </tr> <tr> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 5 </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 0.2461 </td> </tr> <tr> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 0.2051 </td> </tr> <tr> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 0.1172 </td> </tr> <tr> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 0.0439 </td> </tr> <tr> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 0.0098 </td> </tr> <tr> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 0.0010 </td> </tr> </tbody> </table> ] .pull-right[ <img src="module02_files/figure-html/flips-1.svg" width="100%" style="display: block; margin: auto;" /> ] --- If you flip a coin 10 times, how many heads should you expect to see, on average? We speak of probabilistic outcomes in terms of `expected value` where the expected value of a random variable is a measure of the `central tendency` of the random variable, and is given by `\(E(x) = \mu = \Sigma xf(x)\)` For our 10 flips, the expected value would be ... <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Number of Heads in 10 Coin Flips</caption> <thead> <tr> <th style="text-align:right;"> No. of Heads (x) </th> <th style="text-align:right;"> Relative Frequency f(x) </th> <th style="text-align:right;"> Expected Value x * f(x) </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 0.0010 </td> <td style="text-align:right;"> 0.0000000 </td> </tr> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 0.0098 </td> <td style="text-align:right;"> 0.0097656 </td> </tr> <tr> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 0.0439 </td> <td style="text-align:right;"> 0.0878906 </td> </tr> <tr> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 0.1172 </td> <td style="text-align:right;"> 0.3515625 </td> </tr> <tr> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 0.2051 </td> <td style="text-align:right;"> 0.8203125 </td> </tr> <tr> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 5 </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 0.2461 </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 1.2304688 </td> </tr> <tr> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 0.2051 </td> <td style="text-align:right;"> 1.2304687 </td> </tr> <tr> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 0.1172 </td> <td style="text-align:right;"> 0.8203125 </td> </tr> <tr> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 0.0439 </td> <td style="text-align:right;"> 0.3515625 </td> </tr> <tr> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 0.0098 </td> <td style="text-align:right;"> 0.0878906 </td> </tr> <tr> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 0.0010 </td> <td style="text-align:right;"> 0.0097656 </td> </tr> </tbody> </table> --- ## Gender bias? Your city council has been charged with sex discrimination in hiring. In the last fiscal year your city council hired only 3 women out of a candidate pool numbering 12 qualified applicants. On average, some 40% of women tend to make up the qualified applicant pool for these positions. If the city council was not discriminating based on the applicant's sex, what is the .heatinline[probability of the city hiring three or fewer women?] We have `\(n=12\)`, `\(x=3\)`, and `\(p=0.40\)` `$$P\left[x \text{ Successes}\right] = \binom{n}{x}p^{x}\left(1 - p\right)^{n-x} \\ \therefore P\left[0 \text{ Successes}\right] = \binom{12}{0}(0.40)^{0}\left(1 - 0.40\right)^{12-0} = \binom{12}{0}(0.40)^{0}\left(0.60\right)^{12} \\ \binom{12}{0} = \dfrac{12 \times 10 \times 9 \times \ldots\times 2\times 1}{\left(0\right) \left(12 \times 10 \times 9 \times \ldots \times 2 \times 1 \right)} = 1 \\ \therefore P\left[0 \text{ Successes}\right] = (1) \times (1) \times (0.002176782) = 0.002176782$$` Similarly, calculating probability of 1, 2 and 3 successes yields 0.01741426, 0.06385228 and 0.141894, respectively `\(\therefore P(x \leq 3) = 0.002176782 + 0.01741426 + 0.06385228 + 0.141894 = 0.2253373\)` --- .fancy[.large[ Online [**binomial calculator**](http://stattrek.com/m/online-calculator/binomial.aspx) ]] Visually comprehend the problem by seeing the distribution of hiring assuming no discrimination .pull-left[ <img src="module02_files/figure-html/unnamed-chunk-9-1.svg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:right;"> Hired? (x) </th> <th style="text-align:right;"> p(x <=) </th> <th style="text-align:right;"> p(x >=) </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 0.002177 </td> <td style="text-align:right;"> 0.997823 </td> </tr> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 0.019591 </td> <td style="text-align:right;"> 0.980409 </td> </tr> <tr> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 0.083443 </td> <td style="text-align:right;"> 0.916557 </td> </tr> <tr> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 0.225337 </td> <td style="text-align:right;"> 0.774663 </td> </tr> <tr> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 0.438178 </td> <td style="text-align:right;"> 0.561822 </td> </tr> <tr> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 5 </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 0.665209 </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 0.334791 </td> </tr> <tr> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 0.841788 </td> <td style="text-align:right;"> 0.158212 </td> </tr> <tr> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 0.942690 </td> <td style="text-align:right;"> 0.057310 </td> </tr> <tr> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 0.984733 </td> <td style="text-align:right;"> 0.015267 </td> </tr> <tr> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 0.997190 </td> <td style="text-align:right;"> 0.002810 </td> </tr> <tr> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 0.999681 </td> <td style="text-align:right;"> 0.000319 </td> </tr> <tr> <td style="text-align:right;"> 11 </td> <td style="text-align:right;"> 0.999983 </td> <td style="text-align:right;"> 0.000017 </td> </tr> <tr> <td style="text-align:right;"> 12 </td> <td style="text-align:right;"> 1.000000 </td> <td style="text-align:right;"> 0.000000 </td> </tr> </tbody> </table> ] --- ### A Titanic Disaster .pull-left[ <img src="images/titanic.jpeg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ On April 15, 1912, the largest passenger liner ever made collided with an iceberg during her maiden voyage. When the Titanic sank it killed 1,502 out of 2,224 passengers and crew. This sensational tragedy shocked the international community and led to better safety regulations for ships. One of the reasons that the shipwreck resulted in such loss of life was that there were not enough lifeboats for the passengers and crew. You can [**download the data here**](https://aniruhil.org/courses/mpa1/data/titanic.xls) ] --- ### Radiologists and Sons .pull-left[ <img src="images/radiologists.jpg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ The purpose of this study was to determine if male radiologists predominantly father daughters and, if so, to investigate the association between this skewed sex ratio of offspring and radiation exposure. Questionnaires completed by 586 male radiologists in Japan provided data regarding the radiologist's age, length of employment in radiology, if he had ever received radiation doses higher than that recommended by the International Commission on Radiological Protection, the sex of each child fathered, and the birth date of each child. [**Download the data here**](http://whitlockschluter.zoology.ubc.ca/wp-content/data/chapter07/chap07e3RadiologistOffspringSex.csv) ] --- ### Holiday Seasons and Death .pull-left[ <img src="images/depression.jpg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ A common perception is that people suffering from chronic illness may be able to delay their deaths until after a special upcoming event, like Christmas. Out of 12,028 deaths from cancer in either the week before or after Christmas, 6052 happened in the week before. [**Download the data here**](http://whitlockschluter.zoology.ubc.ca/wp-content/data/chapter07/chap07q14WaitingForChristmas.csv) ] --- ### John Wayne and The Conqueror .pull-left[ <img src="images/the-conqueror.jpg" width="65%" style="display: block; margin: auto;" /> ] .pull-right[ In 1955, John Wayne played Genghis Khan in The Conqueror. The movie was filmed downwind from a site where 11 overground nuclear bomb tests had been conducted. Of the 220 crew on the movie, 91 ended up being diagnosed with cancer by the early 1980s. Population data record that only about 14% of people in the same age-group as the movie crew should, on average, have been diagnosed with cancer within the same time frame of exposure. Is it likely that radiation exposure led to so many of the crew to experience cancer-related deaths? ] --- class: center, middle, inverse # .fancy[.fat[ The Poisson Distribution ]] --- ## Shark Attacks as a Poisson Distribution <img src="module02_files/figure-html/unnamed-chunk-15-1.svg" width="70%" style="display: block; margin: auto;" /> --- The number of shark incidents per country per year -- is a discrete variable that can never drop below 0 but can assume any non-negative value `\(x = 0, 1, 2, 3, 4, 5, \ldots, n\)` Variables such as this are `count variables` and belong to a specific distribution: The `Poisson distribution` Mathematically, the Poisson probability distribution is expressed as: `$$f(x) = \dfrac{e^{-x}\lambda^{x}}{x!}$$` where `\(x = 0, 1, 2, 3, \ldots\)` `\(\lambda > 0\)` is `the mean and variance of the distribution`, and `\(e=2.71828\)` --- On average 15 complaints are filed per year with the City Clerk. If you pick a month at random, what would be the probability of seeing no complaint?; 1 complaint?; 2 complaints; `\(\ldots\)` 20 complaints? These turn out to be: .pull-left[ <table class="table table-striped" style="font-size: 14px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Probability of Complaints</caption> <thead> <tr> <th style="text-align:right;"> No. of Complaints </th> <th style="text-align:right;"> Probability </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 0.28650480 </td> </tr> <tr> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 1 </td> <td style="text-align:right;font-weight: bold;color: white !important;background-color: rgba(215, 38, 30, 255) !important;"> 0.35813100 </td> </tr> <tr> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 0.22383187 </td> </tr> <tr> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 0.09326328 </td> </tr> <tr> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 0.02914478 </td> </tr> <tr> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 0.00728619 </td> </tr> <tr> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 0.00151796 </td> </tr> <tr> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 0.00027106 </td> </tr> <tr> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 0.00004235 </td> </tr> <tr> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 0.00000588 </td> </tr> <tr> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 0.00000074 </td> </tr> <tr> <td style="text-align:right;"> 11 </td> <td style="text-align:right;"> 0.00000008 </td> </tr> <tr> <td style="text-align:right;"> 12 </td> <td style="text-align:right;"> 0.00000001 </td> </tr> <tr> <td style="text-align:right;"> 13 </td> <td style="text-align:right;"> 0.00000000 </td> </tr> <tr> <td style="text-align:right;"> 14 </td> <td style="text-align:right;"> 0.00000000 </td> </tr> <tr> <td style="text-align:right;"> 15 </td> <td style="text-align:right;"> 0.00000000 </td> </tr> </tbody> </table> ] .pull-right[ <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/complaints-1.svg" alt="Probability Distribution of Complaints" width="100%" /> <p class="caption">Probability Distribution of Complaints</p> </div> ] --- ### Criminal Incidents Mean number of crime reports filed per hour during Halloween by the Athens City Police Department is 0.833. (a) What is the probability that in a 24 hour period the ACPD will see 10 or fewer crime reports filed? `$$f(x) = \dfrac{e^{-x}\lambda^{x}}{x!} = \dfrac{e^{-10}0.833^{10}}{10!}$$` Use the .fancy[.large[ [**online calculator for the poisson distribution**](http://stattrek.com/m/online-calculator/poisson.aspx) ]] `\(\lambda=19.992\)` since the mean for a 24-hour period would be `\(= 0.833 \times 24 = 19.992\)`, and are given `\(x = 10\)` Calculator yields `\(P(x \leq 10) = 0.0108583424514613 \approx 0.0108 =\)` 1.08% chance of seeing 10 or fewer reports filed within a 24-hour period. Note other probabilities: `\(P(x = 10) = 0.0058396136640344\)` `\(P(x < 10) = 0.0050187287874269\)` `\(P(x > 10) = 0.989141657548539\)` `\(P(x \geq 10) = 0.9949812712125\)` (b) Probability of 20 or more crime reports being filed in the 24 hour period? ... `\(P(x \geq 20) = 0.529031908826421\)` --- ### Hurricanes [**Ready.gov**](https://www.ready.gov/hurricanes) informs us that hurricanes are massive storm systems that form over warm ocean waters and move toward land. Potential threats from hurricanes include powerful winds, heavy rainfall, storm surges, coastal and inland flooding, rip currents, tornadoes, and landslides. The Atlantic hurricane season runs from June 1 to November 30. The Pacific hurricane season runs May 15 to November 30. Hurricanes: - Can happen along any U.S. coast or in any territory in the Atlantic or Pacific oceans. - Can affect areas more than 100 miles inland. - Are most active in September. - [**The Saffir-Simpson Hurricane Wind Scale**](https://www.nhc.noaa.gov/aboutsshws.php) is a 1 to 5 rating based on a hurricane's sustained wind speed. This scale estimates potential property damage. Hurricanes reaching Category 3 and higher are considered major hurricanes because of their potential for significant loss of life and damage. Category 1 and 2 storms are still dangerous, however, and require preventative measures. In the western North Pacific, the term "super typhoon" is used for tropical cyclones with sustained winds exceeding 150 mph. Hurricane data gathered by various sources can be [**downloaded from here**](https://aniruhil.org/courses/mpa1/data/hurricanes.xlsx) Pre-1945 data may be plagued by underestimates --- ### [Shark Attacks](https://www.sharkattackfile.net/whystudy.htm) A very small percentage of shark species, about two dozen, are considered potentially dangerous to humans because of their size and dentition. Yet each year, for every human killed by a shark, our species slaughters millions of sharks - about 73 million sharks last year. We are stripping the world's oceans of one of its most valuable predators - animals that play a critical role in maintaining the health of the world's oceans. An unreasonable fear of sharks has been implanted in our minds by the hype that surrounds the rare shark attack and by movies that exploit our primal fears. It is the mission of the Global Shark Attack File to present facts about these events, thus enabling them to be put in perspective. The Global Shark Attack File was created to provide medical personnel, shark behaviorists, lifesavers, and the media with meaningful information resulting from the scientific forensic examination of shark accidents. Whenever possible, our investigators conduct personal interviews with victims and witnesses, medical personnel and other professionals, and conduct examinations of the incident site. Weather and sea conditions and environmental data are evaluated in an attempt to identify factors that contributed to the incident. The raw [**online database can be accessed here**](https://docs.google.com/spreadsheets/d/1rH3O8JQ1v6tt7swPNbE5B5-AtVr9OtjhhmwpEuBQFbc/edit#gid=1632639634) - [Number of encounters per year per country](https://aniruhil.org/teaching/mpa1/data/sharks.csv) - [Number of encounters per year in the USA](https://aniruhil.org/teaching/mpa1/data/sharks_usa.csv) --- <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/pois2-1.svg" alt="Some Poisson Distributions" width="70%" /> <p class="caption">Some Poisson Distributions</p> </div> --- When `\(n \rightarrow \infty\)` and `\(p \rightarrow 0\)`, the Poisson distribution approximates the Binomial distribution. <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/pois3-1.svg" alt="Some Poisson Distributions tending to the Binomial" width="65%" /> <p class="caption">Some Poisson Distributions tending to the Binomial</p> </div> --- As `\(\lambda \rightarrow \infty\)`, the Poisson distribution approximates the Normal distribution <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/pois4-1.svg" alt="Some Poisson Distributions tending to the Normal" width="65%" /> <p class="caption">Some Poisson Distributions tending to the Normal</p> </div> --- class: inverse, center, middle # .fat[.fancy[ Continuous Probability Distributions ]] --- ### Continuous Probability Distributions A .heatinline[.fancy[.large[ continuous random variable ]]] takes on an infinite number of values Unlike in the case of discrete random variables, where we could calculate `\(P(X = x)\)`, now we calculate the probability of a value of `\(x\)` falling in an interval, i.e., `\(P(a \leq x \leq b)\)` Why? because `\(P(X = x) = \dfrac{x}{\infty} = 0\)` A widely used continuous probability distribution is .heatinline[.fancy[.large[ the Normal distribution ]]] a continuous random variable `\(X\)` follows a normal distribution if its probability density function is defined as: `$$f(X) =\dfrac{1}{\sigma{\sqrt{2\pi}}}e^{-(X-\mu)^{2}/2\sigma^{2}}$$` where `\(\mu\)` is the mean of `\(X\)`, `\(\sigma\)` is the standard deviation of `\(X\)`, `\(\pi=3.14159\)`, and `\(e=2.71828\)` --- Two parameters describe a Normal distribution -- the `mean` and the `standard deviation` <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/norm1-1.svg" alt="Three Normal Distributions: Different Means, Equal Standard Deviations" width="60%" /> <p class="caption">Three Normal Distributions: Different Means, Equal Standard Deviations</p> </div> --- <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/norm2-1.svg" alt="Three Normal Distributions: Different Means, Different Standard Deviations" width="60%" /> <p class="caption">Three Normal Distributions: Different Means, Different Standard Deviations</p> </div> --- ## The Standard Normal Distribution Given this multitude of Normal distributions it would be impossible to know which Normal distribution our sample came from and hence we rely on the .heatinline[.fancy[.large[ Standard Normal Distribution ]]], also known as the .heatinline[.fancy[.large[ z-score Distribution ]]] where `$$z = \dfrac{x - \mu}{\sigma}$$` z-scores guaranteed to have `\(\mu = 0\)` and `\(\sigma = 1\)` `\(+z\)` thus means that score lies .heatinline[.fancy[above the mean]] `\(-z\)` thus means that score lies .heatinline[.fancy[below the mean]] Usefulness? see below ... <table class="table table-striped" style="font-size: 16px; color: black; width: auto !important; margin-left: auto; margin-right: auto;"> <caption style="font-size: initial !important;">Comparing Snowfall in Disparate Locations</caption> <thead> <tr> <th style="text-align:left;"> Place </th> <th style="text-align:right;"> Mean </th> <th style="text-align:right;"> Std.Dev. </th> <th style="text-align:right;"> December.2016 </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Caribou (ME) </td> <td style="text-align:right;"> 110 </td> <td style="text-align:right;"> 30 </td> <td style="text-align:right;"> 125 </td> </tr> <tr> <td style="text-align:left;"> Boston (MA) </td> <td style="text-align:right;"> 24 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 39 </td> </tr> </tbody> </table> --- One of the additional strengths of the Standard Normal Distribution is the fact that we can safely assume: * about 68% of the data values fall within `\(\pm\)` 1 standard deviation <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/1sd-1.svg" alt="Area of the Standard Normal Distribution within 1 Standard Deviation" width="55%" /> <p class="caption">Area of the Standard Normal Distribution within 1 Standard Deviation</p> </div> --- * about 95% of the data values fall within `\(\pm\)` 2 standard deviation <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/2sd-1.svg" alt="Area of the Standard Normal Distribution within 2 Standard Deviations" width="55%" /> <p class="caption">Area of the Standard Normal Distribution within 2 Standard Deviations</p> </div> --- * about 99% of the data values fall within `\(\pm\)` 3 standard deviation * z-scores greater/smaller than `\(\pm{3}\)` are indicative of .heatinline[.fancy[outliers]] <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/3sd-1.svg" alt="Area of the Standard Normal Distribution within 3 Standard Deviations" width="55%" /> <p class="caption">Area of the Standard Normal Distribution within 3 Standard Deviations</p> </div> --- [This standard normal table](http://sphweb.bumc.bu.edu/otlt/mph-modules/bs/bs704_probability/standardnormaltable.pdf) shows you the .heatinline[.fancy[area below a specific z-score]] For example, area below `\(z = -3.40\)` is 0.0003369, denoted as `\(P(z \leq -3.40) = 0.0003369\)` <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/area1-1.svg" alt="Areas Under the Standard Normal Curve" width="55%" /> <p class="caption">Areas Under the Standard Normal Curve</p> </div> --- `\(P(-0.52 \leq z \leq +1.26)=\)`? <div class="figure" style="text-align: center"> <img src="module02_files/figure-html/area2-1.svg" alt="Areas Under the Standard Normal Curve" width="55%" /> <p class="caption">Areas Under the Standard Normal Curve</p> </div> Online tables/calculators are available: Use [**surfstat**](https://sites.csn.edu/mgreenwich/stat/normal.htm) but also see [**David M. Lane**](http://davidmlane.com/hyperstat/z_table.html) --- Assume that for all traditional public schools in your state, the mean dropout rate in 2017 was `\(\mu = 5\)`, and the standard deviation was `\(\sigma = 1.25\)` Given these parameters, if a school had a dropout rate of 7%, what percent of schools in the state did as badly or worse? The answer could be obtained as follows: `$$\left.\begin{aligned} z = \dfrac{x - \mu}{\sigma} \\ \\ z = \dfrac{7 - 5}{1.25} = 1.6 \\ \\ \text{What is } P(z \geq 1.6)? \\ \\ P(z \geq 1.6) = 0.05480 \end{aligned}\right.$$` and thus some 5.48% of schools in the state had dropout rates of 7% or worse (i.e., higher dropout rates). --- What if the school had a dropout rate of 9%? `$$\left.\begin{aligned} z = \dfrac{x - \mu}{\sigma} \\ \\ z = \dfrac{9 - 5}{1.25} = 3.2 \\ \\ \text{What is } P(z \geq 3.2)? \\ \\ P(z \geq 3.2) = 0.00069 \end{aligned}\right.$$` i.e., 0.069% of schools in the states had dropout rates of 9% or worse --- What dropout rates demarcate the top 10 and the bottom 10 percent of schools, respectively? `$$\left.\begin{aligned} z = \dfrac{x - \mu}{\sigma} \\ \\ x = \left(z \times \sigma \right) + \mu \\ \\ x = \mu + \left(z \times \sigma \right) \\ \\ x_{top} = 5 + \left(1.28 \times 1.25 \right) = 5 + 1.6 = 6.6 \\ \\ x_{bottom} = 5 + \left(-1.28 \times 1.25 \right) = 5 - 1.6 = 3.4 \end{aligned}\right.$$` i.e., dropout rates of 6.6% and 3.4% separate the top 10% and bottom 10% of schools from all schools in the state