Chapter 12: Analysis of Variance (ANOVA)

advertisement
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
Download