Chapter 12: Analysis of Variance (ANOVA) Learning Objectives Upon successful completion of Chapter 12, you will be able to: • • Use the one-way Analysis of Variance (ANOVA) to determine if there is a significance difference among three or more means. Use the Scheffe test to determine which means actually differ if the null hypothesis for ANOVA is rejected. I. Introduction • • • • • The F test, which is used to compare two variances, is also used to compare three or more means. This technique is called analysis of variance, or ANOVA. The F test can only show whether or not a difference exists among the three means, not where the difference lies. The Scheffe test determines more specific differences. An F test used to test a hypothesis concerning three or more population means is called analysis of variance or ANOVA. II. Comments • • • ANOVA should not be used to test the quality of two means. Recall: the t-test is used to test the value of one mean or to compare two means. It should not be used to compare three or more means. Using the t-test multiple times to compare several means increases the type I error rate or the probability of finding a differences by chance instead of a real difference. III. Assumptions for ANOVA • • • • Samples are from normally or approximately normally distributed populations. Samples must be independent. Variances of the populations must be approximately equal. Sample sizes do not need to be equal. IV.ANOVA Hypotheses ๐ป0 : ๐1 = ๐2 = โฏ = ๐๐ , where k is the number of means and number of different groups. ๐ป1 : The k populations means are not all equivalent. Dr. Janet Winter, jmw11@psu.edu Stat 200 Page 1 • • • All F tests are always right-tailed. ๐. ๐. ๐. = ๐ − ๐, where k is the number of groups and ๐. ๐. ๐. = ๐ต − ๐ฒ where N is the sum of the sample sizes of the groups: ๐ = ๐1 + ๐2 + โฏ + ๐๐ V. Concepts A. The F Test compares two different estimates for the population variance: • • • The between-group variance which uses the means to find the variance. The within-group variance which uses all the data and is not affected by differences in the means. All F tests are always right-tailed. B. Characteristics of the F Distribution • • • • The value of F is always positive The distributions is positively skewed or skewed right The center value for F is approximately one. There is a different F distribution for each pair of degrees of freedom for the numerator and for the denominator. C. Terms 1. The Mean Sum of Squares (or Variance) Between Groups or for Factors The mean square values or the variances are equal to the sum of the squares divided by the degrees of freedom. ๐๐ ๐ต = ๐๐ต2 ๐๐๐ต = ๐−1 • • ๐๐ต2 = ∑ ๐๐ (๐๏ฟฝ๐ −๐๏ฟฝ๐บ๐ )2 ๐−1 Where the grand mean (๐๏ฟฝ๐บ๐ ) is the average of all values in the samples. ∑๐ ๐๏ฟฝ๐บ๐ = ๐ Be careful!!! The grand mean is the average of the group averages only when all groups are equal in size. 2. The Mean Sum of Squares (or Variance) Within Groups or for Error ๐๐ ๐ 2 ๐๐๐ = ๐−๐ = ๐๐ ๐๐ค2 = ∑(๐๐ −1)๐ ๐ 2 ∑(๐๐ −1) Note: This overall variance is a weighted average of the individual variances. It does not involve differences of the means. ๐ด๐บ 3. The Test Statistic is F where ๐ญ = ๐ด๐บ ๐ฉ where the degrees of freedom for F are K – 1 in ๐พ the numerator and N – K for the denominator Dr. Janet Winter, jmw11@psu.edu Stat 200 Page 2 D. Results of the comparison or Results of the ratio of the Between Group Variance divided by the Within Group Variance 1. If the means differ significantly: • The between-group variance will be much larger than the within-group variance. • The F test will be significantly greater than 1, and the null hypothesis will be rejected. • A significant test value means that there is a high probability that this difference in the means is not due to chance. 2. If there is no difference in the means: • The between-group variance will be approximately equal to the within-group variance. • The F test value will be close to 1. • The null hypothesis will not be rejected. VI.Procedure for Finding the F Test Value: A. Computation Using the Formula 1. 2. 3. 4. 5. Find the mean and variance of each sample. Find the grand mean or the mean for all data values. Find the between-group variance. Find the within-group variance. Find the F test value which is the between-group variance divided by the within-group variance. 6. Find the critical value or p-value and decide to reject or fail to reject the null hypothesis. 7. If the hypothesis is rejected, use the Scheffe Follow up Test (Section VI). B. TI-83 Calculator 1. Input the data for each group in a separate cleared list 2. Select STAT, Tests, ANOVA , type ๐ฟ1 , ๐ฟ2 , ๐ฟ3 , … ๐ฟ๐พ press enter 3. Record an appropriate hypothesis, decision, and conclusion using the p-value from the calculator test. C. Minitab Computer Analysis Variance 1. 2. 3. 4. Input the data for each group in a separate column Using an open Minitab worksheet, select Stat, ANOVA, One-way (unstacked) Double click on the appropriate columns Click OK Dr. Janet Winter, jmw11@psu.edu Stat 200 Page 3 Summary Table Source Sum of Squares Between d.f. ๐๐๐ต ๐−1 ๐๐๐ Within Total Mean Squares F ๐๐๐ต ๐−๐ ๐๐๐ต ๐๐๐ ๐๐๐ It is most likely not convenient to organize calculator work in this format. • Example: The number of grams of fiber per serving for a random sample of three different kinds of foods is listed. At the 0.05 level of significance, can we conclude that there is a difference in the mean fiber content among breakfast cereals, fruits, and vegetables? Breakfast Cereals 3 4 6 4 10 5 6 8 5 ๐1 = 9 ๐2 = 7 Fruits 5.5 2 4.4 1.6 3.8 4.5 2.8 ๐3 = 8 Vegetables 10 1.5 3.5 2.7 2.5 6.5 4 3 ๐=3 ๐ = ๐1 + ๐2 + ๐3 = 9 + 7 + 8 = 24 ๐. ๐. ๐. = ๐ − 1 = 2 ๐12 = 4.75 ๐. ๐. ๐ท. = ๐ − ๐ = 21 ๐22 = 2.0414 ๐๏ฟฝ๐บ๐ = 4.554 s 2 B ๐32 = 7.6184 ๐ ๐ต2 = ๐ฅฬ 1 = 5.667 ๐ฅฬ 2 = 3.5143 ∑ ๐๐ (๐๏ฟฝ๐ − ๐๏ฟฝ๐บ๐ )2 = 9.82113 ๐−1 ๐ฅฬ 3 = 4.2125 9(5.667 − 4.554) 2 + 7(3.5143 − 4.554) 2 + 8 ( 4.2125 − 4.554) 2 ) = 9.82113 2 2 ๐๐ = 8โ4.75+6โ2.0414+7โ7.6184 8+6+7 Answer: 1. ๐ป๐ : ๐๐ต = ๐๐น = ๐๐ถ 2. ๐น = ๐๐2 2 ๐ ๐ค = 9.82113 4.93225 = 4.93225 ∑(๐๐ −1)๐ ๐2 ∑(๐๐ −1) = 4.93225 ๐ป1 : ๐โ๐ ๐๐๐๐๐ ๐๐๐ ๐๐๐ก ๐๐๐ ๐๐๐๐๐ก๐๐๐๐. (claim) = 1.9912 Dr. Janet Winter, jmw11@psu.edu 2 ๐ ๐ = Stat 200 Page 4 3. C.V. = 3.47 F = 1.9912 ∝ = 0.05 d.f.D. = 21 d.f.N. = 2 1.9912 4. Do not reject the null hypothesis because the test value 1.99 is not larger than the cv = 3.47. 5. The data does not support an equal mean fiber content in cereal and fruit and cereal and vegetables. Question 1 The length (in feet) of a number of suspension bridges in the United States, Europe, and Asia are shown. At , is there sufficient evidence to conclude that there is a difference in mean lengths? United States 3500 2300 2000 1850 4260 Europe 5238 4626 4347 3300 Asia 6529 4543 3668 3379 2874 VII. Scheffé Test (Used Whenever ANOVA is rejected) A. Process • Use the Scheffé Test to compare all possible combinations of two means • For example, if there are three means, the following comparisons must be completed: • For example, if there are four means, the following must be compared: Dr. Janet Winter, jmw11@psu.edu Stat 200 Page 5 B. Formula for the Scheffé Test ๐ญ๐ = ๏ฟฝ ๐ −๐ฟ ๏ฟฝ ๐ )๐ (๐ฟ ๐ ๐๐ ๐ ๐๐ ๐๐๐ ๏ฟฝ๏ฟฝ ๏ฟฝ+๏ฟฝ ๏ฟฝ๏ฟฝ = ( X 1 − X 2 ) 2 ÷ ๏ฃฎ๏ฃฐ sW2 (1 ÷ n1 + 1 ÷ n2 ) ๏ฃน๏ฃป ๏ฟฝ ๐ and ๐ฟ ๏ฟฝ ๐ are the sample means being compared, ๐๐ and ๐๐ are the respective sample ๐ฟ sizes, and ๐๐๐ is the within-group variance. C. Critical Value • • The critical value ๐น′ for the Scheffé test is the product of the critical value for the ๐น test times ๐ − 1: ๐น ′ = (๐ − 1)(๐ถ. ๐. ) When ๐น๐ is greater than the ๐น ′ , there is a significant difference between the two mean being compared. VIII. The Tukey Test • • Can only be used for the groups with the equal sample sizes. Since this test is limited, we will not study it in this section. Question 2 A research organization tested microwave ovens. At ∝= 0.10, is there a significant difference in the average prices of the three types of 1000 watt ovens, 900 watt ovens, and 800 watt ovens. Watts 1000 270 245 190 215 250 230 900 240 135 160 230 250 200 200 210 800 180 155 200 120 140 180 140 130 A computer printout for this exercise is included. Use the P-value method and the information in the printout to run the test. Remember if reject the null hypothesis. Analysis of Variance Source Table Source Between Within df 2 19 SS 21729.735 20402.083 Dr. Janet Winter, jmw11@psu.edu MS 10864.867 1073.794 Stat 200 F 10.118 P-value 0.00102 Page 6 Total 21 42131.818 Descriptive Statistics Watts 1000 900 800 n 6 8 8 Means 233.333 203.125 155.625 St Dev 28.23 39.36 28.21 IX. Summary A. Summary of ANOVA • • • • The F test, which previously was used to compare to single variances, can also be used to compare three or more means in the Analysis of variance of ANOVA. The ANOVA technique uses two estimates of the population variance. The between-group variance is the variance of the sample means; the within-group variance is the overall variance of all the values. When there is no significant difference among the means, the two estimates will be approximately equal, and the F test value will be close to 1. B. Overall Summary • • • If there is a significant difference among the means, the between-group variance will be larger than the within-group and a significant test value will result. If there is a significant difference among the means and the sample sizes are the same, the Tukey test can be used to find where the difference lies. (Not responsible for this test!) The Scheffé test is more general and can be used even if the sample sizes are not equal. Dr. Janet Winter, jmw11@psu.edu Stat 200 Page 7 Answer: Question 1 The length (in feet) of a number of suspension bridges in the United States, Europe, and Asia are shown. At ∝ = 0.05, is there sufficient evidence to conclude that there is a difference in mean lengths? United States 3500 2300 2000 1850 4260 Europe 5238 4626 4347 3300 Asia 6529 4543 3668 3379 2874 1. ๐ป๐ : ๐1 = ๐2 = ๐3 ๐ป1 : ๐โ๐ ๐๐ฃ๐๐๐๐๐ ๐๐๐๐กโ ๐๐ ๐๐๐ ๐ ๐ข๐ ๐๐๐๐ ๐๐๐ ๐๐๐๐๐๐๐ ๐๐ ๐กโ๐๐๐ ๐๐๐๐๐ ๐๐ ๐๐๐ก ๐กโ๐ ๐ ๐๐๐. Computation: ๐1 = 5 ๐2 = 4 ๐ 1 = 1050.295 ๐ฅฬ 1 = 2782 ๐๏ฟฝ๐บ๐ = ๐3 = 5 ๐ = 14 ๐ 2 = 809.1454 ๐ฅฬ 2 = 4377.75 52,414 = 3743.857 14 ๐=3 ๐ 3 = 1436.769 ๐ฅฬ 3 = 4198.6 ๐ ๐ต2 ∑ ๐๐ (๐๏ฟฝ๐ − ๐๏ฟฝ๐บ๐ )2 = ๐−1 2 ๐ ๐ ∑(๐๐ − 1)๐ ๐2 = = 1,330,350 ∑(๐๐ − 1) = 3,633,540.88 ๐ป๐ : ๐1 = ๐2 = ๐3 ๐ป1 : ๐โ๐ ๐๐ฃ๐๐๐๐๐ ๐๐๐๐กโ ๐๐ ๐๐๐ ๐ ๐ข๐ ๐๐๐๐ ๐๐๐ ๐๐๐๐๐๐๐ ๐๐ ๐กโ๐๐๐ ๐๐๐๐๐ ๐๐ ๐๐๐ก ๐กโ๐ ๐ ๐๐๐. 2. ๐น = 2 ๐ ๐ต 2 ๐ ๐ = 3. D.f.N. = 2 3,633,540.88 1,330,350 = 2.7313 d.f.D. = 11 ∝ = 0.05 C.V. = 3.98 2.731 Dr. Janet Winter, jmw11@psu.edu Stat 200 Page 8 4. Do not reject the null hypothesis. The test statistic (2.73) is not larger than the c.v. 3.98. 5. The data does not support a statistical difference in the average length of the suspension bridges in the United State, Europe, and Asia. Answer: Question 2 A research organization tested microwave ovens. At ∝= 0.10, is there a significant difference in the average prices of the three types of 1000 watt ovens, 900 watt ovens, and 800 watt ovens. Watts 1000 900 800 270 245 190 215 250 230 240 135 160 230 250 200 200 210 180 155 200 120 140 180 140 130 A computer printout for this exercise is included. Use the P-value method and the information in the printout to run the test. Remember if reject the null hypothesis. Analysis of Variance Source Table Source Between Within Total df 2 19 21 SS 21729.735 20402.083 42131.818 MS 10864.867 1073.794 F 10.118 P-value 0.00102 Descriptive Statistics Watts 1000 900 800 1. 2. 3. 4. 5. n 6 8 8 Means 233.333 203.125 155.625 St Dev 28.23 39.36 28.21 ๐ป0 : ๐1 = ๐2 = ๐3 ๐ป1 : ๐โ๐ ๐กโ๐๐๐ ๐๐๐๐๐ ๐๐๐ ๐๐๐ก ๐๐๐ ๐๐๐ข๐๐ฃ๐๐๐๐๐ก. (claim) F = 10.118 P-value = 0.00102 Reject the null hypothesis since P-value = 0.00102 < ∝ = 0.10 The data supports population average prices of the three sizes of microwaves are not statistically equivalent. Continue with pairwise comparisons. Dr. Janet Winter, jmw11@psu.edu Stat 200 Page 9 Use the Scheffé Test since the ANOVA was rejected. Compare all pairs of means. d.f.N. = 2 ∝ = 0.10 d.f.D. = 19 C.V. = 2.61 F’ = (k – 1)(C.V.) = 2(2.61) = 5.22 ๐น= (๐๏ฟฝ๐ −๐๏ฟฝ๐ )2 1 ๐๐ ๐ ๐ ๏ฟฝ๏ฟฝ ๏ฟฝ+๏ฟฝ 1 ๏ฟฝ๏ฟฝ ๐๐ ๐๏ฟฝ1 ๐ฃ๐ . ๐๏ฟฝ2 ๐น= ๐๏ฟฝ2 ๐ฃ๐ . ๐๏ฟฝ3 ๐น= ๐๏ฟฝ1 ๐ฃ๐ . ๐๏ฟฝ3 ๐น= = ( X 1 − X 2 ) 2 ÷ ๏ฃฎ๏ฃฐ sW2 (1 ÷ n1 + 1 ÷ n2 ) ๏ฃน๏ฃป (233.33 − 203.125)2 = 2.91 1 1 1073.794 ๏ฟฝ6 + 8๏ฟฝ (203.125 − 155.625)2 = 8.40 1 1 1073.794 ๏ฟฝ6 + 8๏ฟฝ (233.33−155.625)2 1 1 6 8 1073.794๏ฟฝ + ๏ฟฝ From the Scheffé Test: ๐๏ฟฝ1 ๐ฃ๐ . ๐๏ฟฝ2 F = 2.91 F = 19.28 ๐๏ฟฝ2 ๐ฃ๐ . ๐๏ฟฝ3 ๐๏ฟฝ1 ๐ฃ๐ . ๐๏ฟฝ3 F = 8.40 = 19.28 ๏ฟฝ ๐ and ๐ ๏ฟฝ ๐ , and between ๐ ๏ฟฝ ๐ and ๐ ๏ฟฝ ๐ because the F There is a significant difference between ๐ from the Scheffé test is larger than 5.22. The third group mean is different from the other two. Dr. Janet Winter, jmw11@psu.edu Stat 200 Page 10