class: center, middle, inverse, title-slide # Module 02 ## MPA 6010 ### Ani Ruhil ### (updated: 2018-10-12) ---  # 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 # 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? --- ## Experiments (Random Trials) An `experiment` is defined as a process that generates well-defined 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`

Some Experiments and their Outcomes

  Experiment 	  Outcomes

  Coin Toss 	  (Head, Tail)

  Sales Call 	  (Sale, No Sale)

  Roll a Die 	  (1,2,3,4,5,6)

  Product Test 	  (Defective, Not defective)

  Health Campaign 	  (Behavior modified, Not modified)

  Green Eyes 	  (Yes, No)

 --- Probability is the proportion of times the event would occur `if we repeated the random trial under identical conditions an infinite number of times`

Simulated Coin Flips

 --- ## 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\)` 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\)` 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 6 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 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 Sample Space --- ## 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\)`; `\(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 tossing 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 `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 ...

The Relative Frequency Method

  No. Waiting 	  No. of Days 	  Proportion

  0 	  2 	  2/20 = 0.10

  1 	  5 	  5/20 = 0.25

  2 	  6 	  6/20 = 0.30

  3 	  4 	  4/20 = 0.20

  4 	  3 	  3/20 = 0.15

  Total 	  20 	  20/20 = 1.00

 It seems, based on his observations, that on any given day he should expect 2 patients on the waiting list since this outcome has the highest relative frequency of `\(0.30\)`. --- #### Another example ...

Bridge-building and Relative Frequencies

  Design 	  Construction 	  Time/Phase 	  Total Time 	  Frequency 	  P(Time)

  2 	  6 	  (2,6) 	  8 	  6 	  6/40 = 0.15

  2 	  7 	  (2,7) 	  9 	  6 	  6/40 = 0.15

  2 	  8 	  (2,8) 	  10 	  2 	  2/20 = 0.05

  3 	  6 	  (3,6) 	  9 	  4 	  4/40 = 0.10

  3 	  7 	  (3,7) 	  10 	  8 	  8/40 = 0.20

  3 	  8 	  (3,8) 	  11 	  2 	  2/40 = 0.05

  4 	  6 	  (4,6) 	  10 	  2 	  2/40 = 0.05

  4 	  7 	  (4,7) 	  11 	  4 	  4/40 = 0.10

  4 	  8 	  (4,8) 	  12 	  6 	  6/40 = 0.15

 Note that most projects seem to have taken three months for design and seven months for construction; hence the company feels this is the most likely outcome for its own project. --- ### (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 bid acceptance and rejection

Subjective Probabilities

  Person 	  P(Acceptance) 	  P(Rejection) 	  Sum

  Pat 	  0.8 	  0.2 	  1

  Chris 	  0.6 	  0.4 	  1

 --- ### Example 1 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. What is P(Company from CA)? ... `\(P(California)=\dfrac{1434}{2374}=0.60\)` What is P(Company from other state)? ... Number that went to other than these 4 states `\(=2374 - \{1434++390+217+112)=221\)`. So, P(Other states) `\(=\dfrac{221}{2374} = 0.09\)`. What is 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)? ... Approximate number of MA companies in early stages `\(=(0.22)(390) \approx 86\)` If the total amount was $32.4 million, how much went to CO? ... Assume fund amounts were distributed in proportion to the relative distribution of awards. Then, `\(=\dfrac{112}{2374}(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

Sum of Two Dice

  	  1 	  2 	  3 	  4 	  5 	  6

  1 	  2 	  3 	  4 	  5 	  6 	  7

  2 	  3 	  4 	  5 	  6 	  7 	  8

  3 	  4 	  5 	  6 	  7 	  8 	  9

  4 	  5 	  6 	  7 	  8 	  9 	  10

  5 	  6 	  7 	  8 	  9 	  10 	  11

  6 	  7 	  8 	  9 	  10 	  11 	  12

 * 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.

Headquarters of Fortune 500 Companies

  State Headquartered 	  No. of Fortune 500 Cos. 	  Proportion

  New York 	  56 	  0.112

  California 	  53 	  0.106

  Texas 	  43 	  0.086

  Illinois 	  37 	  0.074

  Ohio 	  28 	  0.056

  Pennsylvania 	  28 	  0.056

 If I pick a company at random, * What is P(NY)? `\(P(NY)=\dfrac{56}{500}=0.112\)` * What is P(TX)? `\(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\)` --- ## 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\)`. `If you ran a survey and asked folks whether they smoke and if they have high blood pressure, and then found that the proportion of respondents who smoked and had high blood pressure was much higher, that would suggest that perhaps smoking and high blood pressure are not independent.` --- ### Example 1: 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.1 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\)`.] --- ### Example 2: 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\)` be the probability of capturing it if the pride encounters 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%. --- ## Conditional Probability The conditional probability of an event is the probability of that event occurring given that a condition is met (i.e., some other 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.

An Example of Conditional Probability

  Action 	  Men 	  Women 	  Total

  Promoted 	  288 	  36 	  324

  Denied Promotion 	  672 	  204 	  876

  Total 	  960 	  240 	  1200

 If Men and Women had the same probability of being promoted each group should have `\(P(A)=\dfrac{324}{1200}= 0.27\)` This means we should 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 quality --- 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$$`

Probabilities for the preceding table

  Action 	  Men 	  Women 	  Total

  Promoted 	  P(.) = 0.24 	  P(.) = 0.56 	  P(.) = 0.80

  Denied Promotion 	  P(.) = 0.03 	  P(.) = 0.17 	  P(.) = 0.20

  Total 	  P(.) = 0.27 	  P(.) = 0.73 	  P(.) = 1.00

 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! --- ## 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? ---  * 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$$` --- ## 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?`

Breast Cancer and Bayes Theorem

  Test result 	  Has cancer 	  Does not have cancer

  Tests Positive 	  0.800 	  0.096

  Tests Negative 	  ? 	  ?

 --- Start by assuming a certain population size of 40-year old women who are tested, say, `\(N = 100,000\)`.  This amounts to `\(0.096 \times 99000 = 9,504\)`. This means that `\(86,696\)` 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%

Breast Cancer and Bayes Theorem (Part 3)

  Test Result 	  Will have cancer 	  Will not have cancer 	  Probability

  Positive 	  800 	  200 	  800/10304 = 0.0776

  Negative 	  9504 	  89496 	  200/89696 = 0.0022

  Total 	  10304 	  89696

 --- 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)

Testing Positive and Bayes Theorem

  Test Result 	  Sick 	  Healthy 	  Total 	  Probability

  Positive 	  170 	  7830 	  8000 	  170/8000 = 0.02125

  Negative 	  30 	  91970 	  92000 	  30/92000 = 0.000326087

  Total 	  200 	  99800 	  100000

 --- 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, middle, center # 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 | **Discrete Random Variable (x)** | **Possible values** | | -:- | -:- | | No. of defective iPhones | `\(0,1,2,3,\cdots,49\)` | | Sex of car buyer | 0 (Male); 1 (Female) | | No. of Mountain Lions seen | `\(0,1,2,3,\cdots,419\)` | | Gene Length (number of nucleotides) | `\(60 \leq x \leq 100000\)` | | **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\)` | --- ## Probability Distributions A 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)\)`. Discrete probability functions must meet two conditions ... .pull-left[ (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  ] .pull-right[ The relative frequencies as a percentage  ] --- ## Rolling two dice  --- .pull-left[ The frequencies of the sum of the numbers on the 2 dice  ] .pull-right[ The table of possible outcomes; one dice is in rows and the other in columns

Sum of Two Dice

  	  1 	  2 	  3 	  4 	  5 	  6

  1 	  2 	  3 	  4 	  5 	  6 	  7

  2 	  3 	  4 	  5 	  6 	  7 	  8

  3 	  4 	  5 	  6 	  7 	  8 	  9

  4 	  5 	  6 	  7 	  8 	  9 	  10

  5 	  6 	  7 	  8 	  9 	  10 	  11

  6 	  7 	  8 	  9 	  10 	  11 	  12

 ] --- ## 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? 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$$` 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$$` --- .pull-left[

Number of Heads in 10 Coin Flips

  No. of Heads (x) 	  Relative Frequency (f(x))

  0 	  0.0010

  1 	  0.0098

  2 	  0.0439

  3 	  0.1172

  4 	  0.2051

  5 	  0.2461

  6 	  0.2051

  7 	  0.1172

  8 	  0.0439

  9 	  0.0098

  10 	  0.0010

 ] .pull-right[  ] --- 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 ...

Number of Heads in 10 Coin Flips

  No. of Heads (x) 	  Relative Frequency (f(x)) 	  Expected Value (x * fx())

  0 	  0.0010 	  0.0000000

  1 	  0.0098 	  0.0097656

  2 	  0.0439 	  0.0878906

  3 	  0.1172 	  0.3515625

  4 	  0.2051 	  0.8203125

  5 	  0.2461 	  1.2304688

  6 	  0.2051 	  1.2304687

  7 	  0.1172 	  0.8203125

  8 	  0.0439 	  0.3515625

  9 	  0.0098 	  0.0878906

  10 	  0.0010 	  0.0097656

 --- ## Gender bias?  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 `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\)` --- 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[  ] .pull-right[

  Hired? (x) 	  p(x <=) 	  p(x >=)

  0 	  0.002177 	  0.997823

  1 	  0.019591 	  0.980409

  2 	  0.083443 	  0.916557

  3 	  0.225337 	  0.774663

  4 	  0.438178 	  0.561822

  5 	  0.665209 	  0.334791

  6 	  0.841788 	  0.158212

  7 	  0.942690 	  0.057310

  8 	  0.984733 	  0.015267

  9 	  0.997190 	  0.002810

  10 	  0.999681 	  0.000319

  11 	  0.999983 	  0.000017

  12 	  1.000000 	  0.000000

 ] --- ### A Titanic Disaster 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/teaching/mpa1/data/titanic.xls) --- ### Radiologists and Sons 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 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 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? --- ## The Poisson Distribution  --- The number of shark incidents per country per year -- is a discrete variable that can never drop below 0 but can assume any negative non-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[

Probability of Complaints

  No. of Complaints 	  Probability

  0 	  0.28650480

  1 	  0.35813100

  2 	  0.22383187

  3 	  0.09326328

  4 	  0.02914478

  5 	  0.00728619

  6 	  0.00151796

  7 	  0.00027106

  8 	  0.00004235

  9 	  0.00000588

  10 	  0.00000074

  11 	  0.00000008

  12 	  0.00000001

  13 	  0.00000000

  14 	  0.00000000

  15 	  0.00000000

 ] .pull-right[

Probability Distribution of Complaints

 ] --- 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 [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/teaching/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) ---

Some Poisson Distributions

 --- When `\(n \rightarrow \infty\)` and `\(p \rightarrow 0\)`, the Poisson distribution approximates the Binomial distribution.

Some Poisson Distributions tending to the Binomial

 --- As `\(\lambda \rightarrow \infty\)`, the Poisson distribution approximates the Normal distribution

Some Poisson Distributions tending to the Normal

 --- ## Continuous Probability Distributions A `continuous random variables` takes on an uncountably 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 `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

Three Normal Distributions: Different Means, Equal Standard Deviations

 ---

Three Normal Distributions: Different Means, Different Standard Deviations

 --- ## 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 `Standard Normal Distribution`, also known as the `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 `above the mean` * `\(-z\)` thus means that score lies `below the mean` * Usefulness? see below ...

Comparing Snowfall in Disparate Locations

  Place 	  Mean 	  Std.Dev. 	  December.2016

  Caribou (ME) 	  110 	  30 	  125

  Boston (MA) 	  24 	  5 	  39

 --- 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

Area of the Standard Normal Distribution within 1 Standard Deviation

 --- * about 95% of the data values fall within `\(\pm\)` 2 standard deviation

Area of the Standard Normal Distribution within 2 Standard Deviations

 --- * about 99% of the data values fall within `\(\pm\)` 3 standard deviation * z-scores greater/smaller than `\(\pm{3}\)` are indicative of `outliers`

Area of the Standard Normal Distribution within 3 Standard Deviations

 --- [This standard normal table](http://sphweb.bumc.bu.edu/otlt/mph-modules/bs/bs704_probability/standardnormaltable.pdf) shows you the `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\)`

Areas Under the Standard Normal Curve

 --- `\(P(-0.52 \leq z \leq +1.26)=\)`?

Areas Under the Standard Normal Curve

 Online tables/calculators are available: Use [David M. Lane](http://davidmlane.com/hyperstat/z_table.html) or [surfstat](https://surfstat.anu.edu.au/surfstat-home/tables/normal.php) --- 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


{% extends 'tests/base.html' %} {% block content %}
{{test.score}}%
{{test.test_name}}
Test Id: {{test.id}}
You must have Tutor-level access to view this page.


--- layout: post title: We need to change how we think about scientists date: type: post parent_id: '0' published: false password: '' status: draft categories: [] tags: [] meta: _wpcom_is_markdown: '1' _oembed_24bf4df2b6597a3cf87130ccf945c7b6: "{{unknown}}" _oembed_4f564f4780211fa8c66e06ab5de9c561: "{{unknown}}" _oembed_6c029234f1b11edaa8bed91231b84d20: "{{unknown}}" author: login: pboes email<EMAIL_ADDRESS>display_name: pboes first_name: '' last_name: '' permalink: "/" ---
tl;dr:
Francis Fukuyama, in his famous XXXX text "The end of history", argued that it is important to appreciate ideologies of agents to understand why they behave how they behave.
Establish that there is a problem: THere are lots of articles being published, many of them are rarely ever cited (reference), there is a problem with the replication crisis, there is the question how much bang for buck we are producing, there is the EMOORe's law, there are problems with predatory publishing. On the other hand, scientists notoriously feel under pressure to produce output etc..
The basic argument of this article is very simple: We need scientists to spend more time on curating existing knowledge, making it available to others, etc. Not only because there are probably a lot of hidden gems that, with hidnsight, we will think we were blind not to see. But more importantly because damage is growing exponentially, we need to create a culture of curating, "slow-research". Lets put more efforts in avoiding duplicates: There are many great scripts that are being passed around, still professors all over the place stand under pressure to produce more output.
One can take measures to avoid that, but really the problem goes much deeper: We need to change what we think makes for a good scientist.
Find quotes in which people describe the purpose of a science in 19th century as some kind of genius: You want to have genius insights and communicate them. The librarians and people working in the archives are those that digest the output coming out of the great professor's mind. Advancing on the academic career ladder means being allowed to hand the archival tasks to others. WHile this may be alright, it perpetuates an idea.
This is obvious in disciplines like computer science, where a great amount of efforts goes into curating ideas, making sure others can build on them out of the box. But why is that, compared with biology?
There is also an interesting further aspect here: That too much weight can be given to the opinion of individuals when they are regarded as some kind of "genius scientist"
http://theconversation.com/myth-of-the-genius-solitary-scientist-is-dangerous-87835
There is also a danger of a "Middle Ages" effect, in which anything from the pre-digitized age is effectively lost and has to be derived again (at least in mathematics, this may partly be the case)
Finish this post with a number of ideas about how to solve some of these problems:
A crowd-sourced database of mathematical identities (asking researchers to confirm best guesses by a machine-learned database)
3.


Dashboard
Client
Services
Master
User
Stats
Some Actions
Account
Document 1
Choose File
Title
Mr
First Name
John
Middle Name
S
Last Name
Watson
Alias Name
Jhony
CaseRef Number
123der
Email Id
<EMAIL_ADDRESS>Internal Ref Id
Abcd46
Order Creation Date
23/3/2020
Joining Date
23/6/2020
Joining Location
Pune
Current Location
Bangalore
Additional Comments
Packages
Service Selected
Documents Uploaded
Incase OF Insufficiency Contact
Applicant
is Rush Order


“
I take those goods and sell them to the nobility for something I find more useful — coin...
”
An unhandled error has occurred.
Reload
🗙


Market
public struct Market : Equatable, CodableModel
Exchange Market
-
Exchange pair, eg. ETH/BTC
Declaration
Swift
public let pair: String
-
Base currency ID, eg. eth-ethereum
Declaration
Swift
public let baseCurrencyId: String
-
Base currency name, eg. Ethereum
Declaration
Swift
public let baseCurrencyName: String
-
Quote currency ID, eg. btc-bitcoin
Declaration
Swift
public let quoteCurrencyId: String
-
Quote currency name, eg. Bitcoin
Declaration
Swift
public let quoteCurrencyName: String
-
Market URL on
Exchange
websiteDeclaration
Swift
public let marketUrl: URL?
-
Market category, eg. Spot
Declaration
Swift
public let category: Category
-
Market fee type, eg. Percentage
Declaration
Swift
public let feeType: FeeType
-
Outliner
Declaration
Swift
public let outlier: Bool
-
Percent of volume
Declaration
Swift
public let reportedVolume24hShare: Decimal
-
Last update time
Declaration
Swift
public let lastUpdated: Date
-
Use this method to access market data in provided quote currency
For accessing coin price in USD use
market[.usd].price
For accessing coin volume24h in BTC use
market[.btc].volume24h
This method returns implicitly unwrapped optional
Quote!
- be sure to download Market(s) with requestedQuoteCurrency
before use
Declaration
Swift
public subscript(currency: QuoteCurrency) -> Quote! { get }
Parameters
currency
QuoteCurrency, eg. .usd or .btc
-
Market.Quote
See moreDeclaration
Swift
public struct Quote : Codable, Equatable
-
Market category
See moreDeclaration
Swift
public enum Category : String, Codable
-
Market fees type
See moreDeclaration
Swift
public enum FeeType : String, Codable


A: The XView toolkit that CIDD uses as a GUI layer has a relatively ambiguous specification for its default font. It finds a really big font because your X server lists big fonts first when it sets up the default X font path and XView does not scale the size of the widgets to fit the fonts.1.2 Under Mac OS 10.4 and above: CIDD's popup panels are non-functional. The Mac OS window manager never gives focus to the popup panels, so the user cannot select or change GUI elements.The current, preferred workaround is to add specific Openwindows font specifications into your .Xresources file:
- OpenWindows.MonospaceFont: fixed
- OpenWindows.RegularFont: -b&h-lucida-medium-r-normal-sans-12-100-75-75-*-*-iso8859-1
- OpenWindows.BoldFont: -b&h-lucida-bold-r-normal-sans-12-100-75-75-*-*-iso8859-1
or, if lucida sans fonts are not found on your system, try:
- OpenWindows.MonospaceFont: fixed
- OpenWindows.RegularFont: 6x13
- OpenWindows.BoldFont: 6x13bold
For a Mac with minimal fonts installed try:
- OpenWindows.MonospaceFont: fixed
- OpenWindows.RegularFont: times-medium-12
- OpenWindows.BoldFont: times-bold-12
Merge this into your current resource set with: 'xrdb -merge ~/.Xresources' After editing your ~/.Xresources file.
Another Simple work-around is to ask for a specific font on the command line;
CIDD -font lucidasans-bold-12 -p CIDD.myparamfile
CIDD -font times-medium-12 -p CIDD.myparamfile
Note: Older versions of CIDD will honor but complain of unknown command line arguments when using the -font or any other Openwindows command line options on startup. These can be safely ignored. Newer versions of CIDD do not complain.
A: Enter the following commands in a terminal window, then quit and restart X11.defaults write com.apple.x11 wm_click_through -bool true
defaults write com.apple.x11 wm_ffm -bool true
Check your current settings with 'defaults read com.apple.x11' For the latest XQuartz server, the preference name is org.macosforge.xquartz.X11 So enter the following commands in a terminal window, then quit and restart X11.
defaults write org.macosforge.xquartz.X11 wm_click_through -bool true
defaults org.macosforge.xquartz.X11 wm_ffm -bool true
Dennis Flanigan<EMAIL_ADDRESS>Adds:
I installed the Xquartz version of X windows and not the Apple version when I upgraded to Leopard. I discovered that for Xquartz, the defaults are not kept in the com.apple.x11 preferences , but in the org.x.X11 preferences instead.
So Xquartz users should replace com.apple.x11 with org.x.X11 in the commands listed in section 1.2 of the CIDD FAQ.
A somewhat easier procedure is to navigate to ~/Library/Preferences. From the command line use 'open org.x.X11.plist' or from the finder double click on org.x.X11.plist. Either of these steps will bring up the Property List Editor. Opening the Root property list will allow access to the wm_click_through and wm_ffm properties.
A: CIDD can run completely stand-alone if gridded data are requested from the local disk and no SPDB data are being visualized. However, in cases where SPDB data are being visualized or the data are located on another machine, the following programs programs are required.
- DsServerMgr - The Master Server - Should always be running.
This server automatically starts other servers as needed. NOTE: This is typically the only "Server" that needs to be started independently from CIDD.- DsMdvServer - The Gridded Data Server - Serves 'MDV' data
- DsSpdbServer - The Symbolic Product Data Server - Serves raw 'SPDB' data.
The following executables provide support for real time operations
- procmap - The Process Heartbeat Collector. Used in concert with auto_restart (A perl script) to keep process running in case of failure.
- DataMapper - The Master Index of data availability within a "system". All data sets 'register' their deposits of new data into the database. This registry of data is used by clients to detect the presence of new data on the system.
- DsFileDist - A daemon which traverses a database and distributes files to remote hosts. Requires DsServerMgr and DsFCopyServer be available on the remote host.
- Janitor - Scrubs data from our databases in an intelligent way.
- Scout - Finds (scouts out) and registers data in our databases.
The following executables provide graphical representations of data stored in the binary, Symbolic Product Data Base (SPDB) as of Spring 2005..
- AcTrack2Symprod - Converts Aircraft Track (ac_data.h> data to Symprod format
- Acars2Symprod - Converts Aircraft telemetry data to Symprod format
- BasinGenPt2Symprod - Converts data to Symprod format
- Bdry2Symprod - Converts convergence line boundary data to Symprod format
- Chunk2Symprod - Converts raw data to Symprod format
- Contour2Symprod - Converts contour/Contour.hh buffers to Symprod format
- Edr2Symprod - Converts Turbulence EDR data to Symprod format
- FltPath2Symprod - Converts Flight path data to Symprod format
- GenPoly2Symprod - Converts Generic Polyline data to Symprod format
- GenPt2Symprod - Converts Generic Point data to Symprod format
- GenPtField2Symprod - Converts Generic Point Field data to Symprod format
- HydroStation2Symprod - Converts HydroStation data to Symprod format
- Metar2Symprod - Converts SPDB Metar (station_report) Data to Symprod format
- Ltg2Symprod - Converts Lightning data to Symprod
- Mad2Symprod - Converts ?? data to Symprod format
- Pirep2Symprod - Converts Pilot Report data to Symprod format
- PosnRpt2Symprod - Converts Position data to Symprod format
- Rhi2Symprod - Provides MDV Rhi scan indicators in Symprod format
- SigAirMet2Symprod/ - Converts Sig AIRMET data to Symprod format
- Sigmet2Symprod - Converts Sigmet data to Symprod format
- TrecGauge2Symprod - Converts raw Reflectivity Trace data to Symprod format
- Tstorms2Symprod - Converts raw Titan storm track data to Symprod format
- Vergrid2Symprod - Converts ?? data to Symprod format
- WxHazards2Symprod - Converts Weather Hazard data to Symprod format
- simpleAcTrack2Symprod - Converts Aircraft Track (ac_posn.h> data to Symprod format
The following executables provide support for optional and infrequently used features.
- DsFmqServer - A server that is required when distributing or operating File Message Queues (FMQ's) across remote hosts.
- DrawFmq2Bdry - A program which translates human generated drawings into SPDB format boundary products.
- RemoteUI2Fmq - A program which sends the contents of a file to CIDD's Remote User Interface FMQ. - Used in concert with scripts, php or cgi mechanisms to deliver output for interactive users or for static graphic generation. mechanisms
- WMS2MdvServer - A program which translates Mdv requests into WMS requests and returns the resultant image as a Mdv encapsulated geo-tiff.
The following utilities are often used to view the contents of the data bases, files, and server stats and info.
- PrintDataMap - Prints the contents of DataMapper.
- print_procmap - Prints the contents of procmap.
- print_mdv - Prints the contents of Mdv files.
- fmq_print - Prints the contents of FMQ files.
- print_server_mgr - Prints the status of DsServerMgr.
- print_spdb - Prints the low level SPDB data.
- print_spdb_index - Prints the low level SPDB data index files.
- didss_print - Prints many RAP format data, including TITAN track data.
- PrintMdv - Prints the contents of Mdv files.
- SpdbQuery - Prints the contents of SPDB data. - Command line driven.
- XSpdbQuery - An X windows Application which prints the contents of SPDB data. GUI Driven.
A: "Terrain" must be a Mdv file/URL which contains elevation data. It is used primarily to obscure data above a particular elevation. For example, looking at the 900Mb plot over Colorado, or a cross section of model data, on pressure layers, over a mountain range.
Note: Niles Oien has instructions on preparing these data.Landuse, is gridded data that is rendered underneath all other data. Many choose to use the same URL as their terrain data and use a color scale to provide a false colored topological map. Many choose to use a colorscale that uses "ocean blue" for elevations of 0 meters. This works pretty well, unless you are looking at coastal areas where your map will show "Ocean" far inland. A better approach, and much more pleasing to the eye is to take a geo-referenced image, like a geotiff and run it through Image2Mdv to produce an Mdv encapsulated geo-tiff, which CIDD and JADE know how to render. Shaded relief images are available from the USGS that contain a combination of topological features as well as land category to produce very pleasing maps. There are detailed notes in the Image2Mdv source code directory which illustrate its use.
Note: Landuse can refer to a non-static data set. For example you could use a WMS Server(via WMS2MdvServer), or a Mdv Server to feed it live data showing maps that include up-to-date- traffic, flood coverage, satellite imagery, etc.
If you are using a totally new data type, you'll need to create a Symprod server for this new data format. In OO terms - you need to create a vi1G method for your new model. This process will translate your binary format into lines, text and symbols (Symprod format spdb data) which CIDD renders. If you used a pre-existing data format you just need to place the proper "SPDB to Symprod Server" in your URL's. See question 2.1
Check out cvs/apps/dsserver/ and look at all the different *2Symprod apps. Pick one with similar data format and/or and rendering. Copy that and create a Edr2Symprod server. Once this gets built, you can then add a config line in CIDD's param files to load and render this product.
You'll also need to coordinate with Mike Dixon (author of DsServerMgr) to add a hook for your new data type into the server manager, so it can fire up your new Symprod server automatically.
A: The likely cause of this problem is that the cidd.data_timeout_secs: parameter is set too small. Spdb Servers can sometimes take a long time to do their work and respond, especially if they have a lot of data to process.In some cases it may be advantageous to set up CIDD to request SPDB products for each individual frame, rather than requesting data which covers the entire movie loop. To enable this, set the parameter; short_requests = TRUE; in the <SYMPRODS> section of the parameter file.
Note: The 'short requests' mode will often return data quicker, but will take a longer time overall to build a movie loop because products which appear in more than one movie frame have to be re-requested. Additionally, several of the time selection modes become ineffective due to the limited storage of product data across time.
Another possibility is that your DS_COMM_TIMEOUT_MSECS environment variable is set too small. The default value is 30,000. (30 sec). 30 seconds is high enough for most access across the Internet. Unless you have reset this, this is probably not an issue.


public abstract class BaseVerificationOverlayController extends java.lang.Object implements ScanningOverlay, GlareCallback
| Modifier and Type | Class and Description |
|---|---|
protected static class |
BaseVerificationOverlayController.AdditionalStepConfiguration
Configuration for the additional verification step that can be performed in the verification
flow in addition to the document recognizer step.
|
protected static interface |
BaseVerificationOverlayController.AdditionalStepEventListener
Listener for the events that happen during additional verification step.
|
protected static class |
BaseVerificationOverlayController.OverlayState |
static interface |
BaseVerificationOverlayController.VerificationStepListener
Listener that is called when any of the verification steps is starting.
|
| Modifier and Type | Field and Description |
|---|---|
protected android.content.Context |
mApplicationContext |
protected android.os.Handler |
mHandler
Handler associated withe the main thread.
|
protected HighResImagesBundle |
mHighResImagesBundle |
protected BaseVerificationOverlayController.OverlayState |
mOverlayState |
protected RecognizerRunnerFragment |
mRecognizerRunnerFragment |
protected RecognizerRunnerView |
mRecognizerRunnerView |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseVerificationOverlayController(BaseVerificationUISettings uiSettings,
ScanResultListener scanResultListener) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract BaseVerificationOverlayController.AdditionalStepConfiguration |
createAdditionalStepConfiguration()
Creates configuration for the additional verification step that can be performed in the verification
flow in addition to the document recognizer step.
|
protected abstract android.view.View |
createDocumentStepCameraOverlay()
Creates and returns camera overlay view for the document verification step.
|
protected MetadataCallbacks |
createMetadataCallbacks()
Creates and initializes all possible metadata callbacks that can observe recognition process.
|
protected java.lang.CharSequence |
findString(int textId,
java.lang.String text,
int defaultTextId,
android.content.Context context)
Chooses which string will be used among given strings.
|
HighResImagesBundle |
getHighResImagesBundle() |
protected void |
onBackPressed() |
protected void |
onCameraPreviewStarted()
Called when camera preview is started.
|
protected abstract void |
onCameraTorchSupportStatusAvailable(boolean cameraTorchSupported)
This method is called when camera preview is started and camera torch(flashlight) support status is
available.
|
abstract void |
onGlare(boolean glareDetected)
Callback that is called during recognition process when/if the glare is detected on the
scanned document.
|
void |
onRecognizerRunnerFragmentAttached(RecognizerRunnerFragment recognizerRunnerFragment,
android.app.Activity activity)
Called after
RecognizerRunnerFragment gets attached to its host activity. |
protected void |
onRecognizerRunnerFragmentResume() |
protected void |
onRecognizerRunnerFragmentSaveInstanceState(android.os.Bundle outState)
Called from the
RecognizerRunnerFragment , from its Fragment.onSaveInstanceState(Bundle) . |
void |
onRecognizerRunnerViewCreated(RecognizerRunnerFragment recognizerRunnerFragment)
Called when
RecognizerRunnerView has been created within given
RecognizerRunnerFragment . |
void |
onScanningDone(RecognitionSuccessType successType)
This method is called when recognition is done.
|
protected abstract void |
onStartDocumentFirstSide(boolean isCameraPreviewStarted)
Callback method that is called when document recognizer is set to scan first side and recognition
is started.
|
protected abstract void |
onStartDocumentSecondSide(boolean isCameraPreviewStarted)
Callback method that is called when document recognizer is set to scan second side
(only if second side exists) and recognition is started.
|
void |
pauseScanning()
If the
RecognizerRunnerView has been created, pauses the scanning
loop by calling RecognizerRunnerView.pauseScanning() . |
void |
resumeScanning()
If the
RecognizerRunnerView has been created, resumes the scanning
loop (that has been paused) by calling RecognizerRunnerView.resumeScanning(boolean) }. |
void |
setVerificationStepListener(BaseVerificationOverlayController.VerificationStepListener listener)
Sets the verification step listener, for the first side and second side of the document.
|
@NonNull protected android.content.Context mApplicationContext
@NonNull protected android.os.Handler mHandler
@Nullable protected RecognizerRunnerFragment mRecognizerRunnerFragment
@Nullable protected RecognizerRunnerView mRecognizerRunnerView
@NonNull protected HighResImagesBundle mHighResImagesBundle
@NonNull protected BaseVerificationOverlayController.OverlayState mOverlayState
protected BaseVerificationOverlayController(@NonNull BaseVerificationUISettings uiSettings, @NonNull ScanResultListener scanResultListener)
public void onRecognizerRunnerFragmentAttached(@NonNull RecognizerRunnerFragment recognizerRunnerFragment, @NonNull android.app.Activity activity)
ScanningOverlay
RecognizerRunnerFragment
gets attached to its host activity. This happens before
RecognizerRunnerFragment.onCreateView(LayoutInflater, ViewGroup, Bundle)
which internally invokes
ScanningOverlay.onRecognizerRunnerViewCreated(RecognizerRunnerFragment)
. This means that at the time this method
is invoked, methods like RecognizerRunnerFragment.getRecognizerRunnerView()
or RecognizerRunnerFragment.getContentLayout()
will return null.
However, this is a good place to register your LifecycleObserver
with RecognizerRunnerFragment.registerLifecycleObserver(LifecycleObserver)
if your overlay needs to be notified about lifecycle events of RecognizerRunnerFragment
.onRecognizerRunnerFragmentAttached
in interface ScanningOverlay
recognizerRunnerFragment
- RecognizerRunnerFragment
that has been attached to host activity.activity
- Activity
to which RecognizerRunnerFragment
has been attached.public void onRecognizerRunnerViewCreated(@NonNull RecognizerRunnerFragment recognizerRunnerFragment)
ScanningOverlay
RecognizerRunnerView
has been created within given
RecognizerRunnerFragment
. You can use RecognizerRunnerFragment.getRecognizerRunnerView()
to get the created RecognizerRunnerView
and configure it.
The most important thing you should do in this method is to set RecognizerBundle
to
created RecognizerRunnerView
using RecognizerRunnerView.setRecognizerBundle(RecognizerBundle)
.
You can also register various callbacks to RecognizerRunnerView
, except CameraEventsListener
(using BaseCameraView.setCameraEventsListener(CameraEventsListener)
) and ScanResultListener
(using RecognizerRunnerView.setScanResultListener(ScanResultListener)
- those two listeners will be set
to RecognizerRunnerView
within RecognizerRunnerFragment
after calling this method - if you
need to observe camera events within RecognizerRunnerFragment
, you can set your own BaseCameraEventsListener
to it with RecognizerRunnerFragment.setCameraEventsListener(BaseCameraEventsListener)
.
In this method, you can also access RecognizerRunnerFragment
's content layout with method
RecognizerRunnerFragment.getContentLayout()
and add your views to it.onRecognizerRunnerViewCreated
in interface ScanningOverlay
recognizerRunnerFragment
- RecognizerRunnerFragment
within which RecognizerRunnerView
has been created.@NonNull protected MetadataCallbacks createMetadataCallbacks()
@AnyThread @NonNull public HighResImagesBundle getHighResImagesBundle()
public void onScanningDone(@NonNull RecognitionSuccessType successType)
ScanResultListener
onScanningDone
in interface ScanResultListener
successType
- indicates the success type of recognitionprotected final void onBackPressed()
@CallSuper protected void onRecognizerRunnerFragmentResume()
@CallSuper protected void onRecognizerRunnerFragmentSaveInstanceState(@Nullable android.os.Bundle outState)
RecognizerRunnerFragment
, from its Fragment.onSaveInstanceState(Bundle)
.outState
- Bundle in which to place your saved state.@CallSuper protected void onCameraPreviewStarted()
@AnyThread public void resumeScanning()
RecognizerRunnerView
has been created, resumes the scanning
loop (that has been paused) by calling RecognizerRunnerView.resumeScanning(boolean)
}.
If the RecognizerRunnerView
has not been created yet, does nothing.@AnyThread public void pauseScanning()
RecognizerRunnerView
has been created, pauses the scanning
loop by calling RecognizerRunnerView.pauseScanning()
. But keeps camera active.
If the RecognizerRunnerView
has not been created yet, does nothing.
You can resume scanning by calling BaseVerificationOverlayController.resumeScanning()
.RecognizerRunnerView.pauseScanning()
@AnyThread public void setVerificationStepListener(@Nullable BaseVerificationOverlayController.VerificationStepListener listener)
listener
- verification step listener that will receive notifications when scanning of
the first side and second side of the document is started,
or null
to deactivate previous listener.protected abstract void onCameraTorchSupportStatusAvailable(boolean cameraTorchSupported)
cameraTorchSupported
- whether active camera supports torch(flashlight) or not.@NonNull protected abstract android.view.View createDocumentStepCameraOverlay()
protected abstract void onStartDocumentFirstSide(boolean isCameraPreviewStarted)
isCameraPreviewStarted
- whether camera preview has been already started or not. If the
camera preview has not been started yet (value is false
),
method BaseCameraEventsListener.onCameraPreviewStarted()
will be called when/if
the camera is successfully started.protected abstract void onStartDocumentSecondSide(boolean isCameraPreviewStarted)
isCameraPreviewStarted
- whether camera preview has been already started or not. If the
camera preview has not been started yet (value is false
),
method BaseCameraEventsListener.onCameraPreviewStarted()
will be called when/if
the camera is successfully started.public abstract void onGlare(boolean glareDetected)
onGlare
in interface GlareCallback
glareDetected
- whether glare is detected or not.@Nullable protected abstract BaseVerificationOverlayController.AdditionalStepConfiguration createAdditionalStepConfiguration()
null
if the additional
verification step is not needed. In that case additional step will not be performed.@AnyThread @NonNull protected java.lang.CharSequence findString(int textId, @Nullable java.lang.String text, @StringRes int defaultTextId, @NonNull android.content.Context context)
0
uses string obtained from that resource id, otherwise uses given String object if it is not
null
. If strign resource is 0
and String is null
then string resource
defaultTextId
is used.textId
- resource id of the string that will be used, or 0
if it is not set.text
- string that will be used if textId
is not set.defaultTextId
- resource id of the string that will be used if textId
is 0
and
text
is null
context
-


A good friend and myself had for some time been getting together regularly to share in the Nitrous experience. Let me say that a little marijuana is an incredible catalyst for the effects of Nitrous Oxide. I had been exposed to Salvia previously but had always found the initial effects physically uncomfortable; hot flashes being the main problem. Nitrous it turned out to be the perfect solution for my initial physical discomfort. The key is also a little mental preparation; breathing and some meditation.
The experience of being stretched into the Salvia space can be quite strange. The Nitrous allowed me to simply settle into the experience and enjoy the view, so to speak. The Salvia experience always tells me something if I let it. The vortex I had experienced in some of my earlier Salvia experimentation now crystallized into an entity which seemed completely benign. I felt drawn, almost stretched out toward it. The entire experience was so beautiful and strange that I found myself laughing. When I finally felt myself receding from the space of the Salvia and sliding back into my normal state my trusted friend loaded a small water pipe with a nominal hit of the 5-MeO-DMT.
The effect was startling. I found myself racing into the most lucid dream. I was at the gentle center of creation, seeing the reverberating energy such subtle chaos everywhere around me. I was a super-string vibrating with the same frequency as the most fundamental forces in the Universe. I am sure I experienced the core, it seemed completely and unpeakably beautiful. I saw a glimpse of an interconnectedness that defies any description, literal or mathematical. I was in the holiest of moments, I simply was.
In essence I realized that heaven does exist on Earth. I came to the conclusion that perhaps God (or god if it makes you feel better) would probably have given humanity a substance with which to better experience his divinity. A direct call so to speak, the creator's cell-phone number, the hot-line. After some of my experiences I believe that is what the pot and nitrous combination may be. It is the antithesis of Adam's apple in the sense that you bite and are returned to Eden. It allows me to go as far as I want within my mind, where creation and creativity are one and the same. The sensation is of a singularity, a point of infinite richness. I am drawn to some wonderful event horizon where I catch a glimpse of the truth , but can never cross into true under-standing. All this for about 10 bucks, two beers worth of cash.
I can see a religion where instead of some vacuous wine and wafer ritual you sit in a circle meditating as you inhale the true soul of god. Spirituality could be more then a commodity, more then a Chicken Soup for the Soul paperback. It could be an experience available to anyone, unfiltered. Just use some common sense and some restraint. I use a balloon and limit myself to less then five cartidges per useage. I always inhale from a balloon. I trust the quality of the nitrous I am inhaling. Anything else is just asking for trouble. People have died and people have developed permanent nerve damage due to vitamin deficincies associated with excessive nitrous inhalation. I learn from their mistakes and use a trusted sitter. These are important experiences and can be safe. Peace out.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


We encrypt and decrypt your data, in the browser with JavaScript. Please enable it and reload this page.


{% extends 'surveys/ecosystem_2020/base.html' %} {% load static %} {% load i18n %} {% load maps_extras %} {% block title %}{{ 'Contact Information'|titlify }}{% endblock %} {% block content %}
Please provide the contact information for the best person to reach out to should we have follow-up questions about the answers you have provided to the short form of our survey. This contact information will not be part of the index. It will not be published online.


|
Network Services API
<IP_ADDRESS>
|
Standard Definitions for HTTP Status Codes, Content Type and Fields.
Go to the source code of this file.
Macros | |
HTTP Standard Ports | |
| #define | HTTPStd_PORT 80 |
| #define | HTTPStd_SECURE_PORT 443 |
| #define HTTPStd_PORT 80 |
| #define HTTPStd_SECURE_PORT 443 |
| enum HTTPStd_STATUS_CODE |


Charlie Puth
-
Dangerously
[by:工作婊] This is gonna hurt but I blame myself first Cause I ignored the truth Drunk off that love, my head up There’s n... -
As You Are
[by:工作婊] Thinking back in time when I had you to lose Those were the days baby you were the truth And nothing you could ... -
Patient
Sorry These mistakes, I’ve made my fair share When you needed me, I wasn’t there I was young, I was dumb, I was so immat... -
Some Type of Love
When I’m old and grown I won’t sleep alone Every single moment will be fading into you That some type of love That some ... -
Next To You
[by:Atom-M] [ti:Next To You] [ar:Charlie Puth] [al:The Otto Tunes] [by:] [offset:0] Ohh Doo doo doo doo doo Right next t... -
Some Type Of Love
When I’m old and grown I won’t sleep alone Every single moment will be fading into you That some type of love That some ... -
Left Right Left
[by:工作婊] Oh I been hurting lately I’m down on all my luck Sometimes there’s no one there by your side I don’t deserve th... -
Oops
[by:Paperweights] 作曲 : Charles Puth/Jacob Luttrell/Michael Caren 作词 : Charles Puth/Michael Caren/Leigh-Anne Pinnock/Ja... -
See You Again
作曲 : DJ Frank E/Wiz Khalifa/Andrew Cedar/Charlie Puth 作词 : DJ Frank E/Wiz Khalifa/Andrew Cedar/Charlie Puth It's been ...  -
I Warned Myself
[by:本尼托先生] I warned myself that I shouldn‘t play with fire But I can tell that l’ll do it one more time Don‘t trust i... -
Sober
[by:Trap_Girl] Oh, I know that I'll regret this when I'm sober But, every shot I'm getting closer, getting closer Is it ... -
Slow It Down
I've got a situation, this girl been stressing Saying she better be the only one My life is complicated, she's only 23 I... -
One Call Away
I'm only one call away I'll be there to save the day Superman got nothing on me I'm only one call away Call me, baby, if... -
River
[by:工作婊] 作曲 : Priscilla Renea/Charlie Puth 作词 : Priscilla Renea/Charlie Puth Don't run from me river Don't run from me... -
We Don't Talk Anymore
We don't talk anymore, we don't talk anymore We don't talk anymore, like we used to do We don't love anymore What was al... -
Done For Me
[by:Trap_Girl] Oh, oh (Ay) What you thinking? You think that you could be better off with somebody new (No, oh, oh, baby...   -
LA Girls
Told you I'm moving on to bigger and better things Guess you never know What good you got until it's gone Thought I coul...  -
Mother
[by:Trap_Girl] He's such a nice boy so well mannered He's so much better than the last one you brought around Please and... -
The Way I Am
[by:工作婊] Maybe I'ma get a little anxious Maybe I'ma get a little shy Cause everybody's trying to be famous And I'm just ... -
Change
Why are we looking down On our sisters and brothers? Isn't love, all that we got? Don't we know everyone's Got a father ... -
Need You Now
Picture perfect memories scattered all around the floor And i was reaching for the phone 'cause I can't fight it anymore... -
Hotline Bling
[by:肖大能耐] You used to call me on my cell phone Late night when you need my love Call me on my cell phone Late night when... -
If You Leave Me Now
Oh this is not goodbye I swear that I'm gonna change Oh baby please don't cry It doesn't after when this way Cause ... -
Up All Night
[by:工作婊] Well I get the thrill run down my spine When I see you hitting me up Feeling so electrified With the heat of a ... -
Easier – Remix (with Charlie Puth)
[by:本尼托先生] 作曲 : 5 Seconds of Summer/Andrew Wotman/Ali Tamposi/Louis Bell/Ryan Tedder/Charlie Puth 作词 : 5 Seconds of Su... -
Kiss Me
[by:风早风早] I should have told you how I really feel a little in advance Then I would've had some time to go and work it o...  -
Somebody Told Me
[by:工作婊] I was just with you on your birthday And I met your whole family But on the way home You kept looking at your p... -
Your Name (The Ukulele Song)
[by:0] [ti:Your Name] [ar:Charlie Puth] [al:0] This goes out to the most beautiful girl that I saw the other day She had... -
Through the Fire
[by:EnchantedTay] [ti:] [ar:] [al:] [by:九九Lrc歌词网～www.99Lrc.net] 作曲 : Tom Keane/Cynthia Weil/David Foster 作词 : Tom Kean... -
Through It All
You could say I lived a crazy life for a man so young The kind of made me question my faith Now I'm looking back just wo...  -
Seventeen
The stone thrown at your window It's telling you to get up and get up and go And to climb down the shakers of your house... -
We Are Never Ever Getting Back Together
I remember when we broke up, the first time Saying, "This is it, I've had enough," cause like We hadn't seen each other ... -
Does It Feel
[by:工作婊] 作曲 : Charlie Puth/Jacob Kasher/Danny Schofield 作词 : Charlie Puth/Jacob Kasher/Danny Schofield Tell me lies, l... -
Mistletoe
[by:Anthony-___] [ti:Mistletoe] It's the most beautiful time of the year Lights fill the streets spreading so much cheer...  -
Charlie Puth - Chandelier by Manu Prieto
[by:爱莲君96] Party girls, don't get hurt Can't feel anything, when will I learn I push it down push it down I'm the one f... -
Attention
You've been running round, running round, running round throwing that dirt all on my name Cause you knew that I, knew th... -
Charlie Puth-We don't talk anymore (REMIX)（Skezz Phonic / Charlie Puth remix）
作曲 : Skezz Phonic 作词 : Skezz Phonic We don't talk anymore,We don't talk anymore We don't talk anymore,like we used to ... -
Beautiful Corruption
[by:yes96] Midnight,lock all the doors Keep playing that song one day Just the sound of the traffic The patron of you sw... -
In the Dark
Girl sitting right down here Where its not so crowded He sees you looking but he's not doing anything about it Baby, you... -
Lights Go Out
I've been trying, there's no denying, that girl you've got my heart falling so fast. My minds racing, you've got me wast... -
Santa Claus Is Coming To Town (Live At Jingleball, New York / 2016)
[by:蠢梨Sherry] You better watch out You better not cry You better not pout I am telling you why Santa Claus is coming to ... -
Nothing But Trouble (From 808 the Soundtrack)
I'm facing the bottle for all of my problems These Instagram models are nothing but trouble She's going away now, I'm go... -
Marvin Gaye
Let's Marvin Gaye and get it on You got the healing that I want Just like they say it in the song Until the dawn, let's ... -
BOY
[by:工作婊] I got these girls tryna lock me down And I always up and leave But for the first time in a while I wanna throw ... -
-River & FRIENDS（Urmyson / Charlie Puth / Marshmello / Anne-Marie remix）
作曲 : Urmyson 作词 : 无 Don't run from me river 河流啊 别从我身边流走 Don't run from me river river 时间啊 别从我身边溜走 No don't run from me r... -
Done For Me（Lucian Dai EDM Remix）
作曲 : Charlie Puth 作词 : Charlie Puth (Ay) What you thinking? 你到底在想什么呢 You think that you could be better off with somebod... -
1984
[by:BarryLiu] All of you I do so much better What you got though it's not enough But you let it go to your head now Ho...


The Nature of Atmospheric Pressure
Gas molecules continuously in motion
At sea level, one square inch of a column of air weighs about 14 lbs.
Barometer: variations in the weight of the air will bring the mercury up or down. Why do you vacuum the air?
Factors influencing atmospheric pressure
Mapping pressure with isobars
- Pressure measured with a barometer
- Typical unites are millibars or inches of mercury
- Contour pressure values reduced to sea level
- Shows highs and lows, ridges and troughs
The Nature of Wind
Uneven heating of Earth's surface creates temperature and pressure gradients. Direction of wind results from pressure gradient. Winds blow from high pressure to low pressure.
Forces which govern the wind
Pressure gradient force
- Characterized by wind moving from high to low pressure, always
- Winds blow at right angles to isobars
Coriolis Force
- Turns wind to the right in the Northern Hemisphere, left in southern Hemisphere
- Only affects wind direction, not speed, though faster winds turn more
Friction
- Wind is slowed by Earth's surface due to friction, does not affect upper levels
Anticyclones and Cyclones
Vertical Motions
- Surface convergence and low pressure indicate rising motion, cyclone - clouds
- Surface divergence and high pressure indicate sinking motion, anticyclone - clear air/weather
Wind Speed
Mapping image again, where there is a greater gradient, there will be higher wind speeds. The isobar lines will be closer together.
General Circulation of the Atmosphere
Atmosphere is in constant motion
Major semipermanent conditions of wind and pressure-- general circulation
semipermanent convection cell near the equator and 3 latitiudinal wind belts per hemisphere
ITCZ is an area where winds converge and they move into the high troposphere
These winds then split north/south and become antitrade winds - winds that experience the coriolis effect a lot more and travel nearly laterally close to 30° N/S. At these latitudes, there are almost permanent high pressure zones.
Polar front occurs due to winds coming from N & S.
Subtropical Highs
Persistent zones of high pressure near 30° latitude in both hemispheres
Result from descending air in Hadley cells
Subsidence is common over these regions
Regions of world's major deserts
Known as horse latitudes
Intertropical Convergence Zone (ITCZ)
Region of convergence of the trade winds, there is a constant rising motion from the winds.
Where would we find this zone? In the tropics.
Global Warming and the Greenhouse Effect
See:
- Climate of Earth is becoming warmer, known as global warming
- Human-enhanced greenhouse effect
- CO2 main culprit
- Also methane (CH4), nitrous oxide (N2O)
- Intergovernmental Panel on Climate Change
Variations in Heating by Latitude and Season
World distribution of insolation
Average Daily insolation decreases with increasing latitude. During the winter, Southern latitudes will have higher rates of insolation and Northern latitudes will have lower rates of insolation. The converse occurs during the summer.
Land heats and cools more rapidly than water due to:
- Specific heat
- Transmission
- Mobility
- Evaporative cooling
Land and Water Contrasts
San Diego and Dallas are at the same latitude, have roughly the same elevation, yet they differ significantly in their monthly average temperatures. San Diego has a more stable temperature curve due to its proximity to the ocean.
Global Temperature Patterns
Img: map showing average temperature
To get average temperature for a day, you take the highest temperature and the lowest temperature and then divide it by 2.
All of these temperatures have been reduced to their sea-level equivalents. The troposphere has an average decline of temperature is -3.6°F/1000 ft.
Primary controls on global temperature
- Altitude
- Latitude
- Land-Water contrasts
- Ocean currents
Earth-Sun Relations
Earth's Revolution around the Sun
One revolution takes 365 days, 5 hours, 49 minutes. The Earth follows an elliptical orbit.
- Aphelion 93.6 million miles (152,171,500 km)
- Perihelion 93 million miles (147,166,480 km)
- Average distance 93 million miles (149,597,892 km)
Earth is at the perihelion during Northern Hemisphere winter; and at the aphelion during Northern Hemisphere summer
Earth's tilt is 23.5 degrees off of the elliptical orbit plane
Annual March of the Seasons
Three important conditions:
- Declination of the Sun
- Solar altitude
- Length of day
There are Two solstices in June and December
December solstice
- Occurs on approximately December 22 each year
- Sun is directly overhead at 23.5 degree S latitude
Time
International Date Line
When we go around the world, we cross 24 time zones.
Magellan Expedition
Sept 20, 1519 - Sept 8, 1522
To Magellan's crew, it was Sunday. To Spainiards, it was Monday. Inquisitors thought that the crew sold a day to the devil. Scholars of the day quickly explained the date phenomenon. Saved by science!
Daylight-Savings Time
Move clocks ahead by an hour during the summer months ... "Spring Ahead; Fall Back!" This system was originally used by Germans during World War II and it's now practiced by many nations
This sytem conserves lighting energy by providing an extra hour of daylight.
Arizona and Hawaii are the only states that don't follow this system. The Navajo Nation, however, about 20% of Arizona, uses the DS system. The Hopi reservation, a reservation surrounded by the Navajo nation does not follow the system just because the Navajo do.


Welcome to Ray Tracer
Sorry, your environment does not support HTML5 canvas!
Download Scene
Contributors
Yusuf Dalva - 21602867
Sezin Zeydan - 21702567