Week 8 Chapter 14 Random Variables 1 Random
Week 8 Chapter 14. Random Variables 1
Random Variable A random variable (r. v. ) is a variable whose value is a numerical outcome of a random phenomenon. Consider the voting outcome of an eligible voter in an electoral campaign. Define a random variable as follows: X = 1 if they choose a particular candidate X = 0 if they don’t choose a particular candidate. This is an example of a Bernoulli r. v. Probability function of X x P(X = x) 0 1–p 1 p p + (1 – p) = 1 2
Probability Distributions • Each value of a random variable is an event, so each value has probability. • List of values and probabilities called probability model. • For example, recall Tim Horton’s Roll Up the Rim contest: P (Win) = 1/6 so, P(Lose) = 5/6 Possible Sample (n = 3 cups) x P(x) W, W, W 3 1/6 x 1/6 = 1/216 = 0. 005 W, W, L 2 1/6 x 5/6 = 5/216 = 0. 023 W, L, W 2 1/6 x 5/6 x 1/6 = 5/216 = 0. 023 W, L, L 1 1/6 x 5/6 = 25/216 = 0. 116 L, L, W 1 5/6 x 1/6 = 25/216 = 0. 116 L, W, L 1 5/6 x 1/6 x 5/6 = 25/216 = 0. 116 L, W, W 2 5/6 x 1/6 = 5/216 = 0. 023 L, L, L 0 5/6 x 5/6 = 125/216 = 0. 579 Sum of Probabilities = 1 3
Example of Probability Distribution • For example, recall Tim Horton’s Roll Up the Rim contest: P (Win) = 1/6 so, P(Lose) = 5/6 x P(x) 0 1 x 0. 579 = 0. 579 1 3 x 0. 116 = 0. 348 2 3 x 0. 023 = 0. 069 3 1 x 0. 005 = 0. 005 4
Combining Values of Random Variable • For example, recall Tim Horton’s Roll Up the Rim contest: P (Win) = 1/6 so, P(Lose) = 5/6 x P(x) 0 1 x 0. 579 = 0. 579 1 3 x 0. 116 = 0. 348 2 3 x 0. 023 = 0. 069 3 1 x 0. 005 = 0. 005 • How likely are we to get two or more winning cups? add up probabilities: p(2) + p(3) = 0. 069 + 0. 005 = 0. 074 • How likely to get at least one winning cup? p(no winning cups)= p(0) = 0. 579, so, P(at least one winning cup)=1 – p(0) = 1 – 0. 579 = 0. 421 or: P(1 or 2 or 3)= 0. 348 + 0. 069 + 0. 005 = 0. 422 5
The Mean of a Random Variable Recall the example: Spending evenings with neighbors. Let x be a random variable denoting outcomes: 1, 2, 3, 4, 5, 6, 7 x P(x) 1: Almost Daily 0. 058 7 is more likely than 1 or 6. 2: Several Times A Week 0. 183 Therefore, we have to account for more likely values when adding up; that means that we times by probability: 3: Several Times A Month 0. 116 Mean (x) = 1(0. 058) + 2(0. 183) + 3(0. 116) + 4(0. 147) + 5(0. 126) + 6(0. 094) + 7(0. 277) = 4. 493 4: Once A Month 0. 147 We have a weighted averages; weights (probabilities) sum to 1. 5: Several Times A Year 0. 126 • Median is value of x where summed-up probabilities first pass 0. 5: 6: Once A Year 0. 094 7: Never 0. 277 Mean of x is not (1+2+3+4+5+6+7)/7 = 28/7 = 4, because for example 3 too small, because total: 0. 058 + 0. 183 + 0. 116 = 0. 424 4 is right, because total: 0. 058 + 0. 183 + 0. 116 + 0. 147 = 0. 571 so, median (x) = 4 • Mean is a little bigger than median: right-skewed. 6
The Variance and SD of a Random Variable • x P(x) 1: Almost Daily 0. 058 2: Several Times A Week 0. 183 3: Several Times A Month 0. 116 4: Once A Month 0. 147 5: Several Times A Year 0. 126 6: Once A Year 0. 094 7: Never 0. 277 7
Continuous Random Variable • So far, our random variables were discrete: set of possible values, like 1, 2, 3, . . . , probability for each. • Recall normal distribution: any decimal value is possible; we can't talk about probability of any one value, because we are interested in areas of a certain region. e. g. , “less than 10”, “between 10 and 15”, “greater than 15”. • Normal random variable is an example of continuous r. v. Finding mean and SD of continuous random variable involves calculus; but in this course we work with given mean and SD of for example normal distributions. However, the same formulas in the previous slide hold for obtaining mean and SD of continuous r. v. 8
The Binomial Model • 9
The Binomial Table On our portal page for the course, the Statistical Tables folder includes statistical tables of binomial distribution (see pages 3 and 4). Based on the table, find chance of exactly k successes in n trials with success probability p. 10
The Binomial Table and Example The probability that a certain machine will produce a defective item is 1/5. If a random sample of 6 items is taken from the output of this machine, what is the probability that there will be 5 or more defectives in the sample? X ~ Binomial (n = 6, p = 1/5 = 0. 20) x can take values: 0, 1, 2, 3, 4, 5, 6 We need to find p(5 or 6) = p(5) + p(6) We can use the binomial table: 0. 0015 + 0. 0001 = 0. 0016 11
The Binomial Table and Example The probability that a certain machine will produce a defective item is 1/5. If a random sample of 6 items is taken from the output of this machine, what is the probability that there will be at most 5 defectives in the sample? At most 5 means: 5 or less X ~ Binomial (n = 6, p = 1/5 = 0. 20) x can take values: 0, 1, 2, 3, 4, 5, 6 We need to find: p(x less than and equal to 5) = p(0) + p(1) + p(2) + p(3) + p(4) + p(5) Or, we can use the idea of the complement of the event; that is, we find: 1 – p(6: all 6 are defective) For p(6), we can refer to the binomial table: P(6) = 0. 0001; So, 1 – p(6) = 1 – 0. 0001 = 0. 9999 12
The Mean and SD of Binomial Example • 13
Another Binomial Example • 14
15
16
17
18
Normal Approximation to Binomial Distribution How does the shape depend on p? • p<0. 5, skewed right; • p>0. 5, skewed left; • p=0. 5, symmetric What happens to the shape as n increases? − shape becomes normal What does this suggest to do if n is too large for the tables? • If n too large for tables, try normal approximation to binomial. • Compute mean and SD of binomial, then pretend binomial actually normal. 19
Normal Approximation to Binomial Distribution - Example People with O-negative blood type are “universal donors”. Only 6% of people have this blood type. Suppose 1000 people are randomly selected. Find the probability that there are more than 50 universal donors among 1000 people? X ~ Binomial (n = 1000, p = 0. 06) P(50 or more) = ? ? ? • By hand calculation is tedious • Table does not give information pass n=20 What do we do ? 20
Normal Approximation to Binomial Distribution – Example People with O-negative blood type are “universal donors”. Only 6% of people have this blood type. Suppose 1000 people are randomly selected. Find the probability that there are more than 50 universal donors among 1000 people? X ~ Binomial (n = 1000, p = 0. 06) P(50 or more) = ? ? ? 21
Normal Approximation to Binomial Distribution - Example • 22
- Slides: 22