Download Comparing Two Population Means: Hypothesis Testing and Confidence Intervals - Prof. Dongme and more Study notes Statistics in PDF only on Docsity! Chapter 9: Inferences based on two samples: Confidence intervals and tests of hypotheses 9.1 The target parameter 1 21 : difference between two population means 1p p 2 : difference between two population proportions 2 1 2 2 : ratio of two population variances 9.2 Comparing two population means: independent sampling Case 1, Large samples: Conditions required for valid large sample: 1. Two sample randomly and independently selected from two independent population, 2. 1 30n and 2 30n Sampling distribution of ( 1 2x x ) is approximately normal with: Mean: 1 2( ) 1x x 2 Standard error: 1 2 2 2 2 1 2 1 ( ) 1 2 1 x x S S n n n n 2 2 2 (1- ) 100% Confidence interval for 1 2( ) (difference of two population means): 1 2 2 2 1 2 1 2 ( ) 1 2 2 2 1 2 2 2 1 2 1 2 2 1 2 ( ) ( ) ( ) x xx x Z x x Z n n S S x x Z n n Interpret: We are (1- ) 100% confident that the true difference between these two population means will falls in this interval. Example1, DIETSTUDY, To investigate the effect of a new low-fat diet on weight loss, two random samples of 100 people each are selected. One group of 100 is placed on the low-fat diet, while the other group with regular diet. For each person, the amount of weight lost (or gained) in 3-week period is recorded. Diet Weight loss Low-fat diet (1) 8, 21, 13, …………….., 10 (100 observations) Regular diet (2) 6, 14, 4, ………………, 8 (100 observations) Q: Form a 95% confidence interval for ( 1 2 ), to estimate the difference between the population mean weight losses for the two diets. Interpret the result. Samples information: Group Statistics DIET N Mean Std. Deviation Std. Error Mean LOWFAT 1n 2 =100 1x =9.31 1S =4.668 .467 WTLOSS REGULAR =7.40 2S =4.035 .404 2n =100 2x 95% confidence interval for means difference 1 2( ) : 2 2 2 2 1 2 1 2 0.025 2 1 2 4.668 4.035 ( ) (9.31 7.40) 100 100 1.91 1.96 0.62 1.91 1.22 (0.69, 3.13) S S x x Z Z n n Interpret: We are 95% confident that the difference between the mean weight loss of low-fat diet and regular diet is between 0.69 pounds and 3.13 pounds. Note: 1 2( ) is at least 0.69 and at most 3.13 pounds, so we can infer 1 2 . Examples for comparing two population means: independent, large-samples: Example1, DIETSTUDY To investigate the effect of a new low-fat diet on weight loss, two random samples of 100 people each are selected. One group of 100 is placed on the low-fat diet, while the other group with regular diet. For each person, the amount of weight lost (or gained) in 3-week period is recorded. Diet Weight loss Low-fat diet (1) 8, 21, 13, …………….., 10 (100 observations) Regular diet (2) 6, 14, 4, ………………, 8 (100 observations) a. At 0.05 , conduct a test of hypothesis to determine whether the mean weight loss for low-fat diet is different from that of regular diet. Sample information: (SPSS output) Step 1. 0 1 2 1 2: 0 : 0 (a )H H different Step 2. test statistic: 1 2 2 2 2 2 1 2 1 2 ( ) 0 9.31 7.40 1.91 3.09 0.6174.668 4.035 100 100 x x z S S n n Step 3. rejection region : 0.025 2 1.96Z Z Z Step 4. Since 3.09 > 1.96 , reject . 0H At 0.05 , there is sufficient evidence to conclude that the mean weight loss of low-fat diet is different from that of regular diet. 2 ( 3.09 ) 2(0.5 0.4990) 2 0.001 0.002p value P z *(SPSS output: p-value = 0.002 < 0.05) 5 b. At 0.05 , conduct a test of hypothesis to determine whether the mean weight loss for low-fat diet is greater than that of regular diet. Step 1. 0 1 2 1 2 1 2: 0 : 0 (aH H greater than ) Step 2. test statistic: 1 2 2 2 2 2 1 2 1 2 ( ) 0 9.31 7.40 1.91 3.09 0.6174.668 4.035 100 100 x x z S S n n Step 3. rejection region : 0.05 1.645Z Z Z Step 4. Since 3.09 > 1.645, reject . 0H *(p-value= 0.002/2=0.001<0.05) At 0.05 , there is sufficient evidence to conclude that the mean weight loss of low-fat diet is greater than that of regular diet. SPSS output for DIETSTUDY Group Statistics DIET N Mean Std. Deviation Std. Error Mean LOWFAT 100 9.31 4.668 .467 WTLOSS REGULAR 100 7.40 4.035 .404 Independent Samples Test Levene's Test for Equality of Variances t-test for Equality of Means 95% Confidence Interval of the Difference F Sig. t df Sig. (2-tailed) Mean Difference Std. Error Difference Lower Upper Equal variances assumed 1.367 .244 3.095 198 .002 1.910 .617 .693 3.127 WTLOSS Equal variances not assumed 3.095 193.940 .002 1.910 .617 .693 3.127 6 Case 2, Small samples with equal variances Conditions required for valid small sample: 1. The two samples are randomly and independently selected from the two target population. (sampling procedure) 2. Both sampled populations have distributions that are approx. normal. (normal probability plots) 3. The population variances are equal. ( 21 2 2 ) (side-by-side box plot) 4. Sample size is small ( ). 1 230, 30n n Since these two populations have equal variance, ( 2 2 1 2 ), it is reasonable to use the information contained in both samples to construct a pooled variance estimator for use in confidence intervals and test statistics. 2 2 2 1 1 2 1 2 ( 1) ( 1) 2p n S n S S n n 2 (1-a )100% confidence interval for ( 1 2 ): 2 1 2 2 1 2 1 1 ( ) (px x t S n n ) 2 t with 1 2 2df n n Hypothesis test for mean difference ( 1 2 ): 1. 0 1 2 0 1 2 0 1 2 0 1 2 0 : : (a H D H D or D or )D 2. level of significance ; 3. test statistic: 1 2 0 2 1 2 ( ) 1 1 ( )p x x D t S n n with 1 2 2df n n 7 9.3 Comparing two population means: paired difference experiments Two sampling comparing: 10 )Example1: To estimate the difference 1 2( in mean test score between new teaching method and standard method in reading: 1. Randomly select 16 slow learners, 8 are assigned to new method, while the other 8 are assigned to the standard method. (independent sampling) 2. 8 pairs slow learner are selected, not randomly, two learners in each pair with the similar reading IQs; in each pair, one use new method, the other one use standard method, then the difference between the test score of each pair could be used to make inference about 1 2( ) . (two subjects in each pair with similar level, then assign treatments, to see the effect) Example2: To estimate the difference 1 2( ) in mean car mileage between new gasoline additive and no additive applied: 1. Randomly choose 10 cars, doesn’t matter what brand they are, 5 are assigned use the new additive while the other 5 not; (independent sampling) 2. Suppose mileage differences exist among different brand cars. Then choose 5 pairs brand cars: Honda, Ford, Toyota, Nissan, Hyundai, for each brand, one use the new additive while the other one not. The difference between the mileage of each pair could be used to make inference about 1 2( ) . (two subjects in each pair with similar level, then assign treatments, to see the effect) Paired difference experiment: each pair has two similar experimental units, observations are paired and the differences are analyzed. Blocking: making comparisons within groups of similar experimental units. Paired difference experiment is a simple example of randomized block design. (Read textbook P432, 433) Data layout: Pairs Sample1(New) Sample2(Old) Difference ( Dx ) 2 Dx 1 18 16 18-16 = 2 4 2 31 28 31-28 = 3 9 3 25 26 25-26 = -1 1 4 23 21 23-21 = 2 4 5 26 22 26-22 = 4 16 10Dx 2 34Dx 2 2 2 ( ) 10 3410 55, 2, 1.87 5 1 D D D D D D D D D x x x n n x S n n 5 1 Note: The variable we are interested is paired difference Dx . Inference based on paired difference (large sample): Conditions required for a valid large-sample inference about D : 1. A random sample of difference is selected from the target population of differences; 30Dn . 2. The sample size is 1. Paired difference (1- )100% confidence interval fora 1 2( )D : 2 2 D D D D D D S x z x z n n 2. Paired difference Test of hypothesis for 1 2( )D : 1. 0 0 0 0 : : ( : : D a D a D a D H D H D or H D or H D0 ) ; 2. Significance level 3. Test statistic: 0 0D D D D D D x D x D z n S n 4. Rejection region: 2 Z Z when 0:a DH D when ZZ 0:a DH D when ZZ 0:a DH D ; 5. Conclusion. Examples of making inference based on paired difference (large sample): Example: To investigate which supermarket (A or B) has the lower prices in town, a agency randomly selected 100 items common to each of the two supermarkets and recorded the prices charged by each supermarket. The summary results are provided below. 11 2.09 1.99 0.10 0.24 0.19 0.03 A B D A B D x x x S S S a. Use a 95% confidence interval for D A B to estimate the mean price difference between supermarket A and supermarket B. Interpret the result. 0.025 2 0.03 0.10 100 0.10 1.96 0.003 (0.09, 0.11)DD D S x z z n Interpret: We are 95% confident that the mean price difference between supermarket A and B fall between $0.09 and $0.11. ( A B ) b. Conduct a test of hypothesis to determine whether the mean price for supermarket B is cheaper than that for supermarket A? Use 0.05 . step1. 0 : 0 :D a D A BH H 0 step 2. test statistic: 0 0.10 0 0.10 33.3 0.03 0.003 100 D D D x D z S n step 3. rejection region: 0.05 1.645Z Z Z step 4. since 33.3 > 1.645, reject . 0H At 0.05 , there is sufficient evidence to conclude that the mean price for supermarket A is higher than market B. Inference based on paired difference (small sample): Conditions required for a valid small-sample inference about D : 1. A random sample of difference is selected from the target population of differences; 2. The population of differences is approximately normally distributed; 3. The sample size 30Dn . 1. (1- )100% confidence interval for Paired difference a 1 2(D ) : 2 D D D S x t n 2t with 1Ddf n 2. Test of hypothesis for Paired difference 1 2( )D : 12 Example 2, PAIREDSCORES To investigate the effect of a new teaching method on improving reading test score, 8 pairs slow learner are selected, not randomly, two learners in each pair with the similar reading IQs; in each pair, one use new method, the other one use standard method. Then after 6 months, the test scores are recorded. Pair New method (1) Standard method (2) Dx 1 77 72 5 2 74 68 6 3 82 76 6 4 73 68 5 5 87 84 3 6 69 68 1 7 66 61 5 8 80 76 4 a. Construct a 95% confidence interval to estimate the difference of mean test scores between new method and standard method. Interpret the result. (7) 0.0251 0.95, 0.05, 0.025, 1 8 1 7, 2.3652 D df n t 4.375, 1.685 ( )D Dx S SPSS output (8 1) 0.025 2 1.685 4.375 4.375 2.365 0.5957 8 4.375 1.409 (2.966, 5.784) D D D S x t t n Interpret: We are 95% confident that the mean difference of test score between new and standard methods will fall between 2.966 and 5.784 points. b. Do the data provide sufficient evidence that the new method leads to higher test scores than the standard method? Use 0.05 . (p-value = ? ) step1. 0 1: 0 :D a DH H 2 0 step 2. test statistic: 0 4.375 0 4.375 7.34 1.685 0.596 8 D D D x D t S n step 3. rejection region: (8 1) 0.05 1.895t t t 15 step 4. since 7.34 > 1.895, reject . *(p-value = 0.000/2 =0.000) 0H At 0.05 , there is sufficient evidence to conclude that the new method leads to higher test score than standard method. SPSS output for Example2, PAIREDSCORES Paired Samples Statistics Mean N Std. Deviation Std. Error Mean NEW 76.00 8 6.928 2.449Pair 1 STD 71.63 8 7.009 2.478 Paired Samples Test Paired Differences t df Sig. (2-tailed) Mean Std. Deviation Std. Error Mean 95% Confidence Interval of the Difference Lower Upper Pair 1 NEW - STD 4.375 1.685 .596 2.966 5.784 7.344 7 .000 16 9.4 Comparing two population proportions: independent sampling Conditions required for valid large-sample inferences about 1 2( )p p : 1. The two samples are randomly and independently selected from the two target populations. 2. The sample size and are both large. ( This condition will be satisfied if both 1n and 2n 2 2p1 1 1 1 2 2ˆ ˆ ˆ ˆ15, 15, 15, 15n p n q n n q .) Under large sample size, by the Central Limit Theorem, the sampling distribution of 1 2ˆ ˆ( )p p is approximately normal with: mean: 1 2ˆ ˆ( ) 1p p 2 p p standard deviation: 1 2) 1 1 2 2 ˆ ˆ( 1 2 p p p q p q n n Large sample 100(1-a )% confidence interval for 1 2( )p p : 1 2 1 1 2 2 ˆ ˆ1 2 2 ( ) 1 2 2 1 2 1 1 2 2 1 2 2 1 2 ˆ ˆ ˆ ˆ( ) ( ) ˆ ˆ ˆ ˆ ˆ ˆ( ) p p p q p q p p z p p z n n p q p q p p z n n Large –sample test of hypothesis about 1 2( )p p : 1. 0 1 2 1 2 1 2 1 2 : 0 : 0 ( 0a H p p H p p or p p or p p 0) 2. Level of significance ; 3. Test statistic: 1 2 1 2 1 2 1 2 ˆ ˆ( ) ˆ ˆ, 1 1 1 ˆ ˆ( ) p p x x z where p n n pq n n ˆq p 4. Rejection region : 2 Z Z when 1 2: 0aH p p when ZZ 1 2: 0aH p p when ZZ 1 2: 0aH p p ; 5. Conclusion. 17 9.6 Comparing Two Population Variances: Independent Sampling For some instance, we are interested in comparing two population variances. The common statistical procedure for comparing population variances 2 21 2and , we use : 2 2 21 20 1 2 : 1 (H 2 ) 2 2 21 2 1 2 2 : 1 (aH ) Test statistic: 2 1 2 2 s F s How about the sampling distribution of 2 1 2 2 s s ? When 1. the two sampled populations are normally distributed. 2. the samples are randomly and independently selected from their respective populations. 3. the null hypothesis is true 2 21 2( ) . Then, the sampling distribution of 2 1 2 2 sF s is the F-distribution with ( 1 1n ) numerator degrees of freedom and ( 2 1n ) denominator degrees of freedom, respectively. The properties of F-distribution: 1. right-skewed. 2. the total area under the F-curve equals 1. 3. it bases on two degrees of freedom, ( 1 1n ) numerator degrees of freedom and ( 2 1n ) denominator degrees of freedom. Note: 1. Table VIII-XI, p799-806, give the upper-tail F-value. To accomplish this, we will always place the larger sample variance in the numerator of the F-test statistic. 2. We always define: 21 is the population variance associated with the larger sample variance . 21s 20 For example: 0.05, 5, 8 3.69F Testing of hypothesis 2 20 1:H 2 2 2 2 21 2 1 2: ( :a aH or H ) 21 Test statistic: 2 2 21 1 22 2 ( ) s F s s s Rejection region: 1 22, ( 1), ( 1)n n F F when 2 21 2:aH when 1 2, ( 1), ( 1)n n F F 2 21 2:aH Conclusion. Since variance of supplier 1 is larger than that of supplier 2, let define 22