ST 305 Applied Statistics for Health Sciences Hypothesis Testing – Compare Means of Two Populations Bin Wang bwang@southalabama.edu Department of Mathematics and Statistics University of South Alabama Spring 2014 Last updated on March 19, 2014 1/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Example (Chocolate and Memory) Does eating chocolate improve memory? Nine (9) people were given a memory test before and after eating chocolate. The data for the number of words recalled out of 50 are shown below. Assume Normality. Before After Spring 2014 24 26 16 20 33 29 9 11 42 42 38 39 Last updated on March 19, 2014 27 25 30 34 41 44 2/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Example (Chocolate and Memory) Does eating chocolate improve memory? Nine (9) people were given a memory test before and after eating chocolate. The data for the number of words recalled out of 50 are shown below. Assume Normality. Before After 24 26 16 20 33 29 9 11 42 42 38 39 27 25 30 34 41 44 How many populations are there? Two populations: all people before eating chocolate, and all people after eating chocolate. Spring 2014 Last updated on March 19, 2014 2/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Example (Chocolate and Memory) Does eating chocolate improve memory? Nine (9) people were given a memory test before and after eating chocolate. The data for the number of words recalled out of 50 are shown below. Assume Normality. Before After 24 26 16 20 33 29 9 11 42 42 38 39 27 25 30 34 41 44 How many populations are there? Two populations: all people before eating chocolate, and all people after eating chocolate. Two samples: nine people before eating chocolate, and the same group of nine people after eating chocolate. Spring 2014 Last updated on March 19, 2014 2/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Example (Chocolate and Memory) Does eating chocolate improve memory? Nine (9) people were given a memory test before and after eating chocolate. The data for the number of words recalled out of 50 are shown below. Assume Normality. Before After 24 26 16 20 33 29 9 11 42 42 38 39 27 25 30 34 41 44 How many populations are there? Two populations: all people before eating chocolate, and all people after eating chocolate. Two samples: nine people before eating chocolate, and the same group of nine people after eating chocolate. Are the two samples independent? Spring 2014 Last updated on March 19, 2014 2/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Example (Chocolate and Memory) Does eating chocolate improve memory? Nine (9) people were given a memory test before and after eating chocolate. The data for the number of words recalled out of 50 are shown below. Assume Normality. Before After 24 26 16 20 33 29 9 11 42 42 38 39 27 25 30 34 41 44 What are the parameters being interested? The means of the two populations: the average words recalled by all people before eating chocolate, denoted as µbefore ; the average words recalled by all people after eating chocolate, denoted as µafter ; Spring 2014 Last updated on March 19, 2014 2/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Example (Chocolate and Memory) Does eating chocolate improve memory? Nine (9) people were given a memory test before and after eating chocolate. The data for the number of words recalled out of 50 are shown below. Assume Normality. Before After 24 26 16 20 33 29 9 11 42 42 38 39 27 25 30 34 41 44 What is the hypothesis we want to test? If answer is “yes”, µbefore < µafter or equivalently µbefore − µafter < 0. If answer is “no”, µbefore ≥ µafter or equivalently µbefore − µafter ≥ 0. We can state the null and alternative hypotheses as follows: H0 : µbefore − µafter = 0 Spring 2014 Ha : µbefore − µafter < 0 Last updated on March 19, 2014 2/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Paired t-test In this example, the two samples are paired. We use a paired t-test to analyze the data. Spring 2014 Last updated on March 19, 2014 3/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Paired t-test In this example, the two samples are paired. We use a paired t-test to analyze the data. The main idea is to compute the difference between each pair of measures Di = Xi,before − Xi,after Spring 2014 Last updated on March 19, 2014 3/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Paired t-test In this example, the two samples are paired. We use a paired t-test to analyze the data. The main idea is to compute the difference between each pair of measures Di = Xi,before − Xi,after If we setup H0 and Ha differently, we need to compute the difference in other ways. For example, if we have H0 : µafter − µbefore = 0 Ha : µafter − µbefore > 0 Di = Xi,after − Xi,before Spring 2014 Last updated on March 19, 2014 3/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Paired t-test To apply the paired t-test, the sample size needs to be large (to use the CLT). Spring 2014 Last updated on March 19, 2014 4/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Paired t-test To apply the paired t-test, the sample size needs to be large (to use the CLT). In practice, the sample size is often small in matched pairs design. If so, we need to assume the differences D follows approximately Normal distribution to use the paired t-test. Otherwise, we can consider non-parametric test. Spring 2014 Last updated on March 19, 2014 4/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Paired t-test Spring 2014 To apply the paired t-test, the sample size needs to be large (to use the CLT). In practice, the sample size is often small in matched pairs design. If so, we need to assume the differences D follows approximately Normal distribution to use the paired t-test. Otherwise, we can consider non-parametric test. Performed paired t-test using StatCrunch (demonstration). Last updated on March 19, 2014 4/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Paired t-test Find the p-value, and make a decision: If the p-value is smaller than the significance level, we reject H0 , otherwise, we don’t reject H0 . In this problem, we don’t reject H0 . H0 : µbefore − µafter = 0 Spring 2014 Ha : µbefore − µafter < 0 Last updated on March 19, 2014 5/7 Hypothesis Testing for Two Population Means An Example: Chocolate and Memory Paired t-test Find the p-value, and make a decision: If the p-value is smaller than the significance level, we reject H0 , otherwise, we don’t reject H0 . In this problem, we don’t reject H0 . H0 : µbefore − µafter = 0 Ha : µbefore − µafter < 0 In other words, we don’t have enough evidence to conclude H0 is false. The evidence from the experiment doesn’t show that eating chocolate will improve memory. Spring 2014 Last updated on March 19, 2014 5/7 Hypothesis Testing for Two Population Means Two independent samples t-test Example (Chocolate and Memory (revised)) Does eating chocolate improve memory? Nine (9) people were given a memory test without eating chocolate, and another group of nine people were given a memory test after eating chocolate. The data for the number of words recalled out of 50 are shown below. Assume Normality. Spring 2014 Without Chocolate With Chocolate 24 26 16 20 33 29 9 11 42 42 Last updated on March 19, 2014 38 39 27 25 30 34 41 44 6/7 Hypothesis Testing for Two Population Means Two independent samples t-test Example (Chocolate and Memory (revised)) Does eating chocolate improve memory? Nine (9) people were given a memory test without eating chocolate, and another group of nine people were given a memory test after eating chocolate. The data for the number of words recalled out of 50 are shown below. Assume Normality. Without Chocolate With Chocolate 24 26 16 20 33 29 9 11 42 42 38 39 27 25 30 34 41 44 The two samples that are independent, not paired. Spring 2014 Last updated on March 19, 2014 6/7 Hypothesis Testing for Two Population Means Two independent samples t-test Example (Chocolate and Memory (revised)) Does eating chocolate improve memory? Nine (9) people were given a memory test without eating chocolate, and another group of nine people were given a memory test after eating chocolate. The data for the number of words recalled out of 50 are shown below. Assume Normality. Without Chocolate With Chocolate 24 26 16 20 33 29 9 11 42 42 38 39 27 25 30 34 41 44 The two samples that are independent, not paired. The subjects involved in the study was doubled. Spring 2014 Last updated on March 19, 2014 6/7 Hypothesis Testing for Two Population Means Two independent samples t-test Example (Chocolate and Memory (revised)) Does eating chocolate improve memory? Nine (9) people were given a memory test without eating chocolate, and another group of nine people were given a memory test after eating chocolate. The data for the number of words recalled out of 50 are shown below. Assume Normality. Without Chocolate With Chocolate 24 26 16 20 33 29 9 11 42 42 38 39 27 25 30 34 41 44 The two samples that are independent, not paired. The subjects involved in the study was doubled. Individual effects. Spring 2014 Last updated on March 19, 2014 6/7 Hypothesis Testing for Two Population Means Two independent samples t-test Independent samples t-test with StatCrunch Spring 2014 Check assumptions: large sample/normality. Last updated on March 19, 2014 7/7 Hypothesis Testing for Two Population Means Two independent samples t-test Independent samples t-test with StatCrunch Spring 2014 Check assumptions: large sample/normality. Population standard deviations known? Last updated on March 19, 2014 7/7 Hypothesis Testing for Two Population Means Two independent samples t-test Independent samples t-test with StatCrunch Spring 2014 Check assumptions: large sample/normality. Population standard deviations known? Are the two population standard deviations equal? Last updated on March 19, 2014 7/7 Hypothesis Testing for Two Population Means Two independent samples t-test Independent samples t-test with StatCrunch Spring 2014 Check assumptions: large sample/normality. Population standard deviations known? Are the two population standard deviations equal? StatCrunch demonstration. Last updated on March 19, 2014 7/7