Independent Samples: Comparing Means Lecture 38 Section 11.4 Robb T. Koether Hampden-Sydney College Fri, Nov 4, 2011 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 1 / 38
Outline 1 The Sum of Two Distributions 2 The Sampling Distribution of x 1 x 2 3 Examples Using z 4 Assignment Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 2 / 38
Outline 1 The Sum of Two Distributions 2 The Sampling Distribution of x 1 x 2 3 Examples Using z 4 Assignment Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 3 / 38
The Sum of Two Distributions Suppose x and y are random variables, each with its own distribution. What is the distribution of their sum, x + y? For example, what if x is the result of the first roll of a die (1 through 6) and y is the result of the second roll (again, 1 through 6). What is the distribution of the sum, x + y? Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 4 / 38
The Sum of Two Distributions x P(x) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 y P(y) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 5 / 38
The Sum of Two Distributions x + y P(x + y) 2 1/36 3 2/36 4 3/36 5 4/36 6 5/36 7 6/36 8 5/36 9 4/36 10 3/36 11 2/36 12 1/36 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 6 / 38
The Sum of Two Distributions x P(x) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 y P(y) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 µ x = 3.5 µ y = 3.5 x + y P(x + y) 2 1/36 3 2/36 4 3/36 5 4/36 6 5/36 7 6/36 8 5/36 9 4/36 10 3/36 11 2/36 12 1/36 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 7 / 38
The Sum of Two Distributions x P(x) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 y P(y) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 x + y P(x + y) 2 1/36 3 2/36 4 3/36 5 4/36 6 5/36 7 6/36 8 5/36 9 4/36 10 3/36 11 2/36 12 1/36 µ x = 3.5 µ y = 3.5 µ x+y = 7 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 8 / 38
The Sum of Two Distributions x P(x) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 y P(y) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 x + y P(x + y) 2 1/36 3 2/36 4 3/36 5 4/36 6 5/36 7 6/36 8 5/36 9 4/36 10 3/36 11 2/36 12 1/36 µ x = 3.5 µ y = 3.5 µ x+y = 7 σx 2 = 2.9167 σy 2 = 2.9167 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 9 / 38
The Sum of Two Distributions x P(x) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 y P(y) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 x + y P(x + y) 2 1/36 3 2/36 4 3/36 5 4/36 6 5/36 7 6/36 8 5/36 9 4/36 10 3/36 11 2/36 12 1/36 µ x = 3.5 µ y = 3.5 µ x+y = 7 σx 2 = 2.9167 σy 2 = 2.9167 σx+y 2 = 5.8333 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 10 / 38
The Sum of Two Distributions x P(x) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 y P(y) 1 1/6 2 1/6 3 1/6 4 1/6 5 1/6 6 1/6 x + y P(x + y) 2 1/36 3 2/36 4 3/36 5 4/36 6 5/36 7 6/36 8 5/36 9 4/36 10 3/36 11 2/36 12 1/36 µ x = 3.5 µ y = 3.5 µ x+y = 7 σ 2 x = 2.9167 σ 2 y = 2.9167 σ 2 x+y = 5.8333 σ x = 1.7078 σ y = 1.7078 σ x+y = 2.1452 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 11 / 38
The Sum of Two Distributions In other words, it turns out that µ x+y = µ x + µ y σx+y 2 = σx 2 + σy 2 σ x+y = σx 2 + σy 2 Furthermore, if x and y are both normal, then x + y is also normal. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 12 / 38
The Sum of Two Distributions Consider the average age at which a male first marries (x 1 ) vs. the average age at which a female first marries (x 2 ). (µ 1 vs. µ 2.) Suppose that x 1 is N(26, 8) and that x 2 is N(24, 6). Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 13 / 38
The Sum of Two Distributions 0.07 0.06 0.05 0.04 0.03 0.02 0.01 Age when males first marry (X) is N(26, 8). Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 14 / 38
The Sum of Two Distributions 0.07 0.06 0.05 0.04 0.03 0.02 0.01 Age when females first marry (Y ) is N(24, 6). Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 15 / 38
The Sum of Two Distributions 0.07 0.06 0.05 0.04 0.03 0.02 0.01 Combined ages (X + Y ) is N(50, 10). Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 16 / 38
The Sum of Two Distributions That was interesting, but we need to know about the difference between variables. For the difference x y, the situation is very similar to the sum. For any two random variables x and y µ x y = µ x µ y σx y 2 = σx 2 + σy 2 σ x y = σx 2 + σy 2 If x and y are both normal, then x y is also normal. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 17 / 38
The Distribution of x 0.06 0.05 0.04 0.03 0.02 0.01 20 Age when males first marry (X) is N(26, 8). Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 18 / 38
The Distribution of y 0.06 0.05 0.04 0.03 0.02 0.01 20 Age when females first marry (Y ) is N(24, 6). Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 19 / 38
The Distribution of x y 0.06 0.05 0.04 0.03 0.02 0.01 20 Difference between ages (X Y ) is N(2, 10). Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 20 / 38
Outline 1 The Sum of Two Distributions 2 The Sampling Distribution of x 1 x 2 3 Examples Using z 4 Assignment Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 21 / 38
The Distribution of x 1 x 2 Now let s consider two populations. Population 1 has mean µ 1 and standard deviation σ 1. Population 2 has mean µ 2 and standard deviation σ 2. We wish to compare µ 1 and µ 2. We do so by taking samples and comparing sample means x 1 and x 2. This means that we need to know the distribution of x 1 x 2. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 22 / 38
The Distribution of x 1 x 2 For large sample sizes, we know that ( ) σ 1 x 1 is N µ 1, n1 and x 2 is N ( ) σ 2 µ 2, n2 Therefore, x 1 x 2 has mean and standard deviation µ x 1 x 2 = µ 1 µ 2, σ1 2 σ x 1 x 2 = + σ2 2. n 1 n 2 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 23 / 38
The Distribution of x 1 x 2 Also, x 1 x 2 is normal, so σ1 x 1 x 1 is N µ 2 1 µ 2, + σ2 2 n 1 n 2. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 24 / 38
The Distribution of x 1 x 2 Therefore (for large samples), the test statistic will be z = (x 1 x 1 ) (µ 1 µ 2 ). σ 2 1 n 1 + σ2 2 n 2 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 25 / 38
The Distribution of x 1 x 2 Use z if σ 1 and σ 2 are known and the populations are normal. The populations are not normal, but the sample sizes are large. We will use t if σ 1 or σ 2 is unknown and the populations are normal. If both samples are large, we may use either z or t. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 26 / 38
Outline 1 The Sum of Two Distributions 2 The Sampling Distribution of x 1 x 2 3 Examples Using z 4 Assignment Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 27 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) I bought a book of Sudoku puzzles. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 28 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) I bought a book of Sudoku puzzles. The puzzles were divided into 4 levels of difficulty. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 28 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) I bought a book of Sudoku puzzles. The puzzles were divided into 4 levels of difficulty. Were the Level 2 puzzles really harder than the Level 1 puzzles? Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 28 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) I bought a book of Sudoku puzzles. The puzzles were divided into 4 levels of difficulty. Were the Level 2 puzzles really harder than the Level 1 puzzles? My average times for Levels 1 and 2 were Level 1 Level 2 x 1 = 3.02 x 2 = 4.70 s 1 = 0.84 s 2 = 0.95 n 1 = 30 n 2 = 30 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 28 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) I bought a book of Sudoku puzzles. The puzzles were divided into 4 levels of difficulty. Were the Level 2 puzzles really harder than the Level 1 puzzles? My average times for Levels 1 and 2 were Level 1 Level 2 x 1 = 3.02 x 2 = 4.70 s 1 = 0.84 s 2 = 0.95 n 1 = 30 n 2 = 30 Test the hypotheses at the 5% level of significance. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 28 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) (1) µ 1 = average time to solve a level 1 puzzle. µ 2 = average time to solve a level 2 puzzle. H 0 : µ 1 = µ 2. H 1 : µ 1 < µ 2. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 29 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) (1) µ 1 = average time to solve a level 1 puzzle. µ 2 = average time to solve a level 2 puzzle. H 0 : µ 1 = µ 2. H 1 : µ 1 < µ 2. (2) α = 0.05. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 29 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) (1) µ 1 = average time to solve a level 1 puzzle. µ 2 = average time to solve a level 2 puzzle. H 0 : µ 1 = µ 2. H 1 : µ 1 < µ 2. (2) α = 0.05. (3) The test statistic: z = (x 1 x 2 ) 0. s 2 1 n 1 + s2 2 n 2 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 29 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) (4) Compute z: (3.02 4.70) 0 z = 0.84 2 30 + 0.952 30 = 1.68 0.2315 = 7.256. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 30 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) (4) Compute z: (3.02 4.70) 0 z = 0.84 2 30 + 0.952 30 = 1.68 0.2315 = 7.256. (5) p-value = normalcdf(-e99,-7.256) = 0. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 30 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) (6) Reject H 0. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 31 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) (6) Reject H 0. (7) The average time to solve a Level 1 puzzle is less than the average time to solve a Level 2 puzzle. That is, the Level 2 puzzles are harder than the Level 1 puzzles. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 31 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) Is Level 3 harder than Level 2? Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 32 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) Is Level 3 harder than Level 2? My average times for Levels 2 and 3 were Level 2 Level 3 x 1 = 4.70 x 2 = 6.61 s 1 = 0.95 s 2 = 1.69 n 1 = 30 n 2 = 30 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 32 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) Is Level 3 harder than Level 2? My average times for Levels 2 and 3 were Level 2 Level 3 x 1 = 4.70 x 2 = 6.61 s 1 = 0.95 s 2 = 1.69 n 1 = 30 n 2 = 30 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 32 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) Is Level 3 harder than Level 2? My average times for Levels 2 and 3 were Level 2 Level 3 x 1 = 4.70 x 2 = 6.61 s 1 = 0.95 s 2 = 1.69 n 1 = 30 n 2 = 30 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 32 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) Is Level 3 harder than Level 2? My average times for Levels 2 and 3 were Level 2 Level 3 x 1 = 4.70 x 2 = 6.61 s 1 = 0.95 s 2 = 1.69 n 1 = 30 n 2 = 30 Test the hypotheses at the 5% level of significance. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 32 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) A new drug is introduced. Is it better than the old drug? A group of 40 patients was given the new drug and a group of 60 patients was given the old drug. Time until recovery (in days) was measured for each patient. New Drug (# 1) Old Drug (# 2) n 1 = 40 n 2 = 60 x 1 = 5.4 x 2 = 6.8 s 1 = 1.8 s 2 = 1.3 Test the hypotheses at the 5% level of significance. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 33 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) (1) µ 1 = average time to recovery for the new drug. µ 2 = average time to recovery for the old drug. H 0 : µ 1 µ 2 = 0. H 1 : µ 1 µ 2 < 0. (2) α = 0.05. (3) The test statistic: z = (x 1 x 2 ) 0. s 2 1 n 1 + s2 2 n 2 Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 34 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) (4) Compute z: (5.4 6.8) 0 z = 1.8 2 40 + 1.32 60 = 1.4 0.3304 = 4.237. (5) p-value = normalcdf(-e99,-4.237) = 1.132 10 5. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 35 / 38
Example Example (Testing hypotheses concerning µ 1 µ 2 ) (6) Reject H 0. (7) The average time to recovery for the new drug is less than it is for the old drug. That is, the new drug is more effective than the old drug. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 36 / 38
Outline 1 The Sum of Two Distributions 2 The Sampling Distribution of x 1 x 2 3 Examples Using z 4 Assignment Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 37 / 38
Assignment Homework Read Section 11.4, pages 695-712 (skip confidence intervals). Let s Do It! 11.6. Exercises postponed to Monday. Robb T. Koether (Hampden-Sydney College) Independent Samples:Comparing Means Fri, Nov 4, 2011 38 / 38