Académique Documents
Professionnel Documents
Culture Documents
Chapter 17
Analysis of Variance
Chap 17-1
Chapter Goals
After completing this chapter, you should be able
to:
Assumptions
Populations are normally distributed
Populations have equal variances
Samples are randomly and independently drawn
H0 : 1 2 3 K
H1 : i j
One-Way ANOVA
H0 : 1 2 3 K
H1 : Not all i are the same
All Means are the same:
The Null Hypothesis is True
(No variation between
groups)
1 2 3
One-Way ANOVA
(continued)
H0 : 1 2 3 K
H1 : Not all i are the same
At least one mean is different:
The Null Hypothesis is NOT true
(Variation is present between groups)
or
1 2 3
1 2 3
Variability
B
C
Group
Small variation within groups
B
C
Group
Large variation within groups
Variation due to
random sampling
(SSW)
Variation due to
differences
between groups
(SSG)
ni
SST (x ij x)
Where:
i1 j1
Total Variation
(continued)
Group 1
Group 2
Group 3
Within-Group Variation
SST = SSW + SSG
K
ni
SSW (x ij x i )2
i 1 j1
Where:
Within-Group Variation
(continued)
K
ni
SSW (x ij x i )
i 1 j1
SSW
MSW
n K
Mean Square Within =
SSW/degrees of freedom
Within-Group Variation
(continued)
x1
Group 1
Group 2
x2
Group 3
x3
Between-Group Variation
SST = SSW + SSG
K
SSG ni ( x i x )
Where:
i1
Between-Group Variation
(continued)
K
SSG ni ( x i x )
i1
Variation Due to
Differences
Between
Groups
SSG
MSG
K 1
Mean Square Between Groups
= SSG/degrees of freedom
Between-Group Variation
(continued)
Response, X
x1
Group 1
Group 2
x2
Group 3
x3
SS
df
Between
Groups
SSG
K-1
Within
Groups
SSW
n-K
SST =
SSG+SSW
n-1
Total
MS
(Variance)
F ratio
SSG
MSG
MSG =
K - 1 F = MSW
SSW
MSW =
n-K
K = number of groups
n = sum of the sample sizes from all groups
df = degrees of freedom
One-Factor ANOVA
F Test Statistic
H0: 1= 2 = = K
H1: At least two population means are different
Test statistic
MSG
F
MSW
Degrees of freedom
df1 = K 1
(K = number of groups)
df2 = n K
Decision Rule:
Reject H if
0
F > FK-1,n-K,
= .05
Do not
reject H0
Reject H0
FK-1,n-K,
One-Factor ANOVA
F Test Example
You want to see if three
different golf clubs yield
different distances. You
randomly select five
measurements from trials on
an automated driving
machine for each club. At
the .05 significance level, is
there a difference in mean
distance?
Club 1
254
263
241
237
251
Club 2
234
218
235
227
216
Club 3
200
222
197
206
204
Club 2
234
218
235
227
216
Club 3
200
222
197
206
204
Distance
270
260
250
240
230
220
210
x1
x2
200
190
1
2
Club
x3
Club 2
234
218
235
227
216
Club 3
200
222
197
206
204
x1 = 249.2
n1 = 5
x2 = 226.0
n2 = 5
x3 = 205.8
n3 = 5
x = 227.0
n = 15
K=3
SSG = 5 (249.2 227)2 + 5 (226 227)2 + 5 (205.8 227)2 = 4716.4
SSW = (254 249.2)2 + (263 249.2)2 ++ (204 205.8)2 = 1119.6
2358.2
F
25.275
93.3
H0: 1 = 2 = 3
H1: i not all equal
= .05
df1= 2
df2 = 12
Critical Value:
F2,12,.05= 3.89
= .05
Do not
reject H0
Reject H0
F2,12,.05 = 3.89
MSA 2358.2
F
25.275
MSW
93.3
Decision:
Reject H0 at = 0.05
Conclusion:
There is evidence that
at least one i differs
F = 25.275
from the rest
Count
Sum
Average
Variance
Club 1
1246
249.2
108.2
Club 2
1130
226
77.5
Club 3
1029
205.8
94.2
ANOVA
Source of
Variation
SS
df
MS
Between
Groups
4716.4
2358.2
Within
Groups
1119.6
12
93.3
Total
5836.0
14
F
25.275
P-value
4.99E-05
F crit
3.89
Kruskal-Wallis Test
2
i
12
R
W
n(n 1) i1 ni
3(n 1)
where:
n = sum of sample sizes in all groups
K = Number of samples
Ri = Sum of ranks in the ith group
ni = Size of the ith group
Do not
reject H0
2K1,
Reject H0
Kruskal-Wallis Example
Class size
(English, E)
Class size
(Biology, B)
23
45
54
78
66
55
60
72
45
70
30
40
18
34
44
Kruskal-Wallis Example
Class size
Class size
Ranking
Ranking
(Math, M)
(English, E)
23
41
54
78
66
2
6
9
15
12
= 44
55
60
72
45
70
10
11
14
8
13
= 56
Class size
(Biology, B)
Ranking
30
40
18
34
44
3
5
1
4
7
= 20
Kruskal-Wallis Example
(continued)
The W statistic is
K
12
Ri2
W
3(n 1)
n(n 1) i1 ni
44 2 56 2 20 2
12
5
5
15(15 1) 5
3(15 1) 6.72
Kruskal-Wallis Example
(continued)
2
2,0.05
5.991
2
5.991 ,
Since H = 6.72 > 2,0.05
reject H0
Two-Way ANOVA
(continued)
Assumptions
1
2
.
.
H
x11
x21
xK1
x12
x22
.
.
x1H
.
.
x2H
.
.
xK2
.
.
xKH
Two-Way Notation
Let xji denote the observation in the jth group and ith
block
Suppose that there are K groups and H blocks, for a
total of n = KH observations
Let the overall mean be x
Denote the group sample means by
x j (j 1,2, ,K)
x i (i 1,2, ,H)
Total Sum of
Squares (SST)
Variation due to
differences between
groups (SSG)
Variation due to
differences between
blocks (SSB)
Variation due to
random sampling
(unexplained error)
(SSE)
Degrees of
Freedom:
SST (x ji x)2
n1
j1 i 1
Between - Groups :
SSG H (x j x)2
K1
j1
Between - Blocks :
SSB K (x i x)2
H1
i 1
Error :
SSE (x ji x j x i x)2
j 1 i 1
(K 1)(K 1)
Two-Way ANOVA:
The F Test Statistic
H0: The K population group
means are all the same
MSG
F
MSE
Reject H0 if
F > FK-1,(K-1)(H-1),
MSB
F
MSE
Reject H0 if
F > FH-1,(K-1)(H-1),
Sum of
Squares
Degrees of
Freedom
SSG
K1
SSB
H1
SSE
(K 1)(H 1)
SST
n-1
Mean Squares
MSG
MSB
MSE
SSG
K 1
SSB
H 1
SSE
(K 1)(H 1)
F Ratio
MSG
MSE
MSB
MSE
Let
K = number of groups
H = number of blocks
L = number of observations per cell
n = KHL = total number of observations
SST
Total Variation
SSB
Between-block variation
SSI
n1
SSE
Random variation (Error)
(continued)
Degrees of
Freedom:
K1
H1
(K 1)(H 1)
KH(L 1)
Total :
Between - groups :
SSG HL (x j x)2
j1
Between - blocks :
n-1
K1
SSB KL (x i x)2
H1
i1
Interaction :
SSI L (x ji x j x i x)2
j1 i1
Error :
SSE (x jil x ji )2
i
(K 1)(H 1)
KH(L 1)
MST
SST
n 1
MSG
SST
K 1
MSB
SST
H 1
MSI
SSI
(K - 1)(H 1)
SSE
MSE
KH(L 1)
Two-Way ANOVA:
The F Test Statistic
H0: The K population group
means are all the same
MSG
F
MSE
Reject H0 if
F > FK-1,KH(L-1),
MSB
F
MSE
Reject H0 if
F > FH-1,KH(L-1),
MSI
F
MSE
Reject H0 if
F > F(K-1)(H-1),KH(L-1),
Two-Way ANOVA
Summary Table
Source of
Variation
Sum of
Squares
Degrees of
Freedom
Mean
Squares
F
Statistic
Between
groups
SSG
K1
MSG
= SSG / (K 1)
MSG
MSE
Between
blocks
SSB
H1
MSB
= SSB / (H 1)
MSB
MSE
MSI
MSE
Interaction
SSI
(K 1)(H 1)
MSI
= SSI / (K 1)(H 1)
Error
SSE
KH(L 1)
MSE
= SSE / KH(L 1)
Total
SST
n1
Features of Two-Way
ANOVA F Test
Examples:
Interaction vs. No Interaction
No interaction:
Interaction is
present:
Block Level 3
Block Level 2
B
Groups
Mean Response
Mean Response
Block Level 1
Block Level 1
Block Level 2
Block Level 3
B
Groups
Chapter Summary