Bernoulli Trials, Binomial and Cumulative Distributions Sec 4.4-4.6 Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Department of Mathematics University of Houston Lecture 9-3339 Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Sec (Department 4.4-4.6 of Mathematics University of Houston Lecture ) 9-3339 1 / 20
Outline 1 Bernoulli Random Variables 2 Binomial Distribution 3 Cumulative Distributions Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Sec (Department 4.4-4.6 of Mathematics University of Houston Lecture ) 9-3339 2 / 20
Review Questions The following is a probability distribution: X -10 10 Probability 0.4 0.6 1. Determine the expected value (mean) of this probability distribution. a) 0 b) 2 c) -2 d) 10 2. Determine the variance of this probability distribution. a) 20 b) 100 c) 96 d) 0 Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Sec (Department 4.4-4.6 of Mathematics University of Houston Lecture ) 9-3339 3 / 20
Review Questions Suppose a random variable X has a mean of 20, E(X) = 20 and standard deviation of 5, SD(X) = 5. We have a new random variable Y, where Y = 3X + 10. 3. What is the mean (expected value) of Y? a) 20 b) 70 c) 60 d) 30 4. What is the standard deviation of Y? a) 15 b) 25 c) 75 d) 5 Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Sec (Department 4.4-4.6 of Mathematics University of Houston Lecture ) 9-3339 4 / 20
Introduction Question Wallen Accounting Services specializes in tax preparation for individual tax returns. Data collected from past records reveals that 9% of the returns prepared by Wallen have been selected for audit by the Internal Revenue Service (IRS). 1. What is the probability that a customer of Wallen will be selected for audit? a. 0.09 b. 0.91 c. 1 d. 0 2. What is the probability that a customer is not selected for audit? a. 0.09 b. 0.91 c. 1 d. 0 Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Sec (Department 4.4-4.6 of Mathematics University of Houston Lecture ) 9-3339 5 / 20
Bernoulli Random Variable A Bernoulli random variable has only two possible values, usually designated as 1 and 0. Suppose we look at the i th customer of Wallen Accounting services. Let X be the random variable that indicates that the customer is selected for audit. Thus X = 1 is the customer is selected for audit, X = 0 if not selected for audit. Selected for audit is the "success" and not selected for audit is "failure." The probability of success is p and the probability of failure is 1 p. e.g. a coin is flipped (heads or tails), someone is either audited or not audited, p = 0.09, 1 - p = 0.91. Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Sec (Department 4.4-4.6 of Mathematics University of Houston Lecture ) 9-3339 6 / 20
Probability Function for Bernoulli Variable p, if x = 1 f (x) = P(x) = 1 p, if x = 0 0, if x 0, 1 A compact way of writing this is: f (x) = P(x) = p x (1 p) 1 x Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Sec (Department 4.4-4.6 of Mathematics University of Houston Lecture ) 9-3339 7 / 20
The Bernoulli Process The Bernoulli process must possess the following properties: 1. The experiment consists of n repeated trials. 2. Each trial in an outcome that may be classified as a success or failure. 3. The probability of success, denoted by p, remains constant from trial to trial. 4. The repeated trials are independent. Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Sec (Department 4.4-4.6 of Mathematics University of Houston Lecture ) 9-3339 8 / 20
Audit Example Today, Wallen has six new customers. Assume the chances of these six customers being audited are independent. This is a sequence of Bernoulli trials. We are interested in calculation the probability of obtaining a certain number of people being selected for audit. Let X i indicate the i th customer being selected for audit. Let Y = X 1 + X 2 + X 3 + X 4 + X 5 + X 6. What does Y represent? What is the probability that Y = 0? What is the probability that Y = 1? What is the probability that Y = 2? What is the probability that Y = n where n = 0, 1, 2, 3, 4, 5, 6? Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Sec (Department 4.4-4.6 of Mathematics University of Houston Lecture ) 9-3339 9 / 20
Binomial Probability Distribution The distribution of the count X of successes in the Binomial setting has a Binomial probability distribution. Where the parameters for a binomial probability distribution is: n the number of observations p is the probability of a success on any one observation The possible values of X are the whole numbers from 0 to n. As an abbreviation we say, X B(n, p). Binomial probabilities are calculated with the following formula: P(X = k) = n C k p k (1 p) n k - 3339 10 / 20
Stopping at an intersection Suppose that only 25% of all drivers come to a complete stop at an intersection with a stop sign when not other cars are visible. What is the probability that of the 20 randomly chosen drivers, 1. Exactly 6 will come to a complete stop? 2. No one will come to complete stop? 3. At least one will come to a complete stop? 4. At most 6 will come to a complete stop? - 3339 11 / 20
Using R To find P(X =k) use dbinom(k,n,p). From previous example P(X = 6), k = 6, n = 20, p = 0..25 > dbinom(6,20,.25) [1] 0.1686093 To find P(X k) use pbinom(k,n,p). From previous example P(X 6) > pbinom(6,20,0.25) [1] 0.7857819 What is the probability that less than 6 will come to a complete stop? What is the probability of at least 6? - 3339 12 / 20
Example #2 A fair coin is flipped 30 times. 1. What is the probability that the coin comes up heads exactly 12 times? P(X = 12), n = 30, p = 0.5 > dbinom(12,30,0.5) [1] 0.08055309 2. What is the probability that the coin comes up heads less than 12 times? P(X < 12) = P(X 11) > pbinom(11,30,0.5) [1] 0.1002442 3. What is the probability that the coin comes up heads more than 12 times? P(X > 12) = 1 P(X 12) > 1-pbinom(12,30,0.5) [1] 0.8192027 4. What is the probability that the coin comes up heads between 9 and 13 times, inclusive? P(9 X 13) = P(X 13) P(X 8) > pbinom(13,30,0.5)-pbinom(8,30,.5) [1] 0.28427-3339 13 / 20
Mean and Variance of a Binomial Distribution If a count X has the Binomial distribution with number of observations n and probability of success p, the mean and variance of X are µ X = E[X] = np σ 2 X = Var[X] = np(1 p) Then the standard deviation is the square root of the variance. - 3339 14 / 20
Example #3 Suppose it is known that 80% of the people exposed to the flu virus will contract the flu. Out of a family of five exposed to the virus, what is the probability that: 1. No one will contract the flu? 2. All will contract the flu? 3. Exactly two will get the flu? 4. At least two will get the flu? - 3339 15 / 20
Example Continued Suppose it is known that 80% of the people exposed to the flu virus will contract the flu. Suppose we have a family of five that were exposed to the flu. 1. Find the mean 2. Find the variance of this distribution. - 3339 16 / 20
Cumulative Distributions Any quantitative random variable X has a cumulative distribution function defined as F X (x) = P(X x) for all real numbers x. For discrete random variables the relationship between the probability function, pmf, and the cumulative distribution function is F X (x) = x i x f X (x i ) where x 1, x 2,... are the values of X. - 3339 17 / 20
Example of Cumulative Distribution What is the probability that at most 2 people will contract the flu? P(X 2) = F(2) = P(X = 0) + P(X = 1) + P(X = 2) = sum(dbinom(0 : 2, 5, 0.8)) or in RStudio: F(2) = pbinom(2, 5, 0.8). - 3339 18 / 20
Cumulative Distribution Function Properties Any cumulative distribution function F has the following properties: 1. F is a non-decreasing function defined on the set of all real numbers. 2. F is right-continuous. That is, for each a, F(a) = F(a+) = lim x a+ F(x). 3. lim x F(x) = 0; lim x + F(X) = 1. 4. P(a < X b) = F x (b) F x (a) for all real a and b, a < b. 5. P(X > a) = 1 F x (a). 6. P(X < b) = F x (b ) = lim x b F x (x). 7. P(a < X < b) = F x (b ) F x (a). 8. P(X = b) = F x (b) F x (b ). - 3339 19 / 20
Plot of Cumulative Distribution flu.prob 0.0 0.2 0.4 0.6 0.8 1.0 0 1 2 3 4 5 x - 3339 20 / 20