Download presentation
Presentation is loading. Please wait.
1
Week 8 Chapter 14. Random Variables
2
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 p + (1 – p) = 1 x P(X = x) 1 – p 1 p
3
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 x 1/6 = 1/216 = 0.005 W, W, L 2 1/6 x 1/6 x 5/6 = 5/216 = 0.023 W, L, W 1/6 x 5/6 x 1/6 = 5/216 = 0.023 W, L, L 1 1/6 x 5/6 x 5/6 = 25/216 = 0.116 L, L, W 5/6 x 5/6 x 1/6 = 25/216 = 0.116 L, W, L 5/6 x 1/6 x 5/6 = 25/216 = 0.116 L, W, W 5/6 x 1/6 x 1/6 = 5/216 = 0.023 L, L, L 5/6 x 5/6 x 5/6 = 125/216 = 0.579 Sum of Probabilities = 1
4
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) 1 x = 0.579 1 3 x = 0.348 2 3 x = 0.069 3 1 x = 0.005
5
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) 1 x = 0.579 1 3 x = 0.348 2 3 x = 0.069 3 1 x = 0.005 How likely are we to get two or more winning cups? add up probabilities: p(2) + p(3) = = 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.421 or: P(1 or 2 or 3)= = 0.422
6
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 Mean of x is not ( )/7 = 28/7 = 4, because for example 7 is more likely than 1 or 6. Therefore, we have to account for more likely values when adding up; that means that we times by probability: 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 We have a weighted averages; weights (probabilities) sum to 1. Median is value of x where summed-up probabilities first pass 0.5: 3 too small, because total: = 0.424 4 is right, because total: = 0.571 so, median (x) = 4 Mean is a little bigger than median: right-skewed. 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
The Variance and SD of a Random Variable
The variance of a discrete (it means countable) r. v. is: Var (X) = 𝜎 2 = 𝑋 − 𝜇 2 𝑃(𝑋) The standard deviation of a r. v. is the positive square root of its variance. SD(X) = Var (X) = 𝜎 2 = 𝜎 Recall the example spending evening with neighbors: 𝜇= mean (x) = 4.49 𝜎 2 = 𝑋 − 𝜇 2 𝑃(𝑋) = 1 − − − − − − − = 4.12 𝜎 = 𝜎 2 =4.12 = 2.03 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
8
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.
9
The Binomial Model 1. There are a fixed number n of observations.
2. The n observations are independent. 3. Each observation falls into one of just two categories (successes and failures). 4. The probability of a success (call it p) is the same for each observation. Probability function of the binomial distribution. If X has a B(n, p), 𝑃 𝑋=𝑥 = 𝑛 𝑥 𝑝 𝑥 (1−𝑝) 𝑛−𝑥 for 𝑥=0,…,𝑛 𝑛 𝑥 is referred to as n choose x: different order in which we can have x success in n trials 𝑛 𝑥 = 𝑛! 𝑥!(𝑛−𝑥)! Calculator: for 𝑛 𝑥 use the nCr button on your calculator (r is the x in our case). There might 𝑝: probability of success 1−𝑝: probability of failure (not success) Mean (X) = 𝑛𝑝 Var(X) = 𝑛𝑝(1−𝑝) and SD(X) = 𝑛𝑝(1−𝑝)
10
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.
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 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: =
12
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) = ; So, 1 – p(6) = 1 – =
13
The Mean and SD of Binomial Example
The probability that a certain machine will produce a defective item is 1/5. Suppose a random sample of 6 items is taken from the output of this machine. What are the mean and the standard deviation of the number of defective items among the 6 items? X ~ Binomial (n = 6, p = 1/5 = 0.20) Mean (X) = 𝑛𝑝 = 6 x 0.20 = 1.2 Var(X) = 𝑛𝑝(1−𝑝) = 6 x 0.20 x (1 – 0.2) = 0.96 and SD(X) = 𝑛𝑝(1−𝑝) = 0.96 = 0.98
14
Another Binomial Example
People with O-negative blood type are “universal donors”. Only 6% of people have this blood type. Suppose twenty people are randomly selected. What is the probability that exactly two of them are universal donors (have o-negative blood type)? X ~ Binomial (n = 20, p = 0.06) P(X=2) = (1-0.06)20-2 = 190 * * ≅ We can do this using StatCrunch.
19
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.
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 people are randomly selected. Find the probability that there are more than 50 universal donors among 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?
21
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) = ??? Normal distribution to the rescue X ~ N (mean=np, SD= 𝒏𝒑(𝟏−𝒑) ) The mean and SD are from binomial distribution Check: Normal approximation to the Binomial distribution: np ≥𝟏𝟎 n(1-p) ≥𝟏𝟎
22
Normal Approximation to Binomial Distribution - Example
People with O-negative blood type are “universal donors”. Only 6% of people have this blood type. Suppose people are randomly selected. Find the probability that there are more than 50 universal donors among people? Check: Normal approximation to the Binomial distribution: np = 1000*0.06 = 60>10 n(1-p) = 1000*0.94 = 940>10 We can use normal approximation to the binomial. X ~ Binomial (n = 1000, p = 0.06) Mean (X) = 𝑛𝑝 = 1000 x 0.06 = 60 SD(X) = 𝑛𝑝(1−𝑝) = 𝑥0.06𝑥0.94 = 7.51 X ~ N(mean=1000x0.06=60, SD= 1000𝑋0.06𝑋0.94 =7.51) P(X > 50 ) = P( Z > 𝟓𝟎−𝟔𝟎 𝟕.𝟓𝟏 ) = 𝒑 𝒛>−𝟏.𝟑𝟑 = (proportion above z of -1.33) =𝟏−𝒑(𝒛<−𝟏.𝟑𝟑) = 1 – (prop below z of -1.33) = = About 91% of the time, we find 50 or more universal donors among 1000 people.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.