Statistics for
Business and Economics
7th Edition
Chapter 15
Analysis of Variance
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-1
Chapter Goals
After completing this chapter, you should be able to:
Recognize situations in which to use analysis of variance
Understand different analysis of variance designs
Perform a one-way and two-way analysis of variance and
interpret the results
Conduct and interpret a Kruskal-Wallis test
Analyze two-factor analysis of variance tests with more than
one observation per cell
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-2
15.2
One-Way Analysis of Variance
Evaluate the difference among the means of three
or more groups
Examples: Average production for 1st, 2nd, and 3rd shifts
Expected mileage for five brands of tires
Assumptions
Populations are normally distributed
Populations have equal variances
Samples are randomly and independently drawn
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-3
Hypotheses of One-Way ANOVA
H0 : μ1 = μ2 = μ3 = = μK
All population means are equal
i.e., no variation in means between groups
H1 : μi ≠ μ j
for at least one i, j pair
At least one population mean is different
i.e., there is variation between groups
Does not mean that all population means are different
(some pairs may be the same)
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-4
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
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-5
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
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
μ1 ≠ μ2 ≠ μ3
Ch. 15-6
Variability
The variability of the data is key factor to test the
equality of means
In each case below, the means may look different, but a
large variation within groups in B makes the evidence
that the means are different weak
A
B
A
B
Group
C
Small variation within groups
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
A
B
Group
C
Large variation within groups
Ch. 15-7
Partitioning the Variation
Total variation can be split into two parts:
SST = SSW + SSG
SST = Total Sum of Squares
Total Variation = the aggregate dispersion of the individual
data values across the various groups
SSW = Sum of Squares Within Groups
Within-Group Variation = dispersion that exists among the
data values within a particular group
SSG = Sum of Squares Between Groups
Between-Group Variation = dispersion between the group
sample means
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-8
Partition of Total Variation
Total Sum of Squares
(SST)
=
Variation due to
random sampling
(SSW)
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
+
Variation due to
differences
between groups
(SSG)
Ch. 15-9
Total Sum of Squares
SST = SSW + SSG
K
ni
SST = ∑∑ (x ij − x)
2
i=1 j=1
Where:
SST = Total sum of squares
K = number of groups (levels or treatments)
ni = number of observations in group i
xij = jth observation from group i
x = overall sample mean
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-10
Total Variation
(continued)
SST = (x11 − x )2 + (X12 − x )2 + ... + (x KnK − x )2
Response, X
x
Group 1
Group 2
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Group 3
Ch. 15-11
Within-Group Variation
SST = SSW + SSG
K
ni
SSW = ∑∑ (x ij − x i )2
i =1 j=1
Where:
SSW = Sum of squares within groups
K = number of groups
ni = sample size from group i
xi = sample mean from group i
xij = jth observation in group i
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-12
Within-Group Variation
(continued)
K
ni
SSW = ∑∑ (x ij − x i )
i =1 j=1
Summing the variation
within each group and then
adding over all groups
2
SSW
MSW =
n −K
Mean Square Within =
SSW/degrees of freedom
μi
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-13
Within-Group Variation
(continued)
SSW = (x11 − x1 )2 + (x12 − x1 )2 + ... + (x KnK − x K )2
Response, X
x1
Group 1
Group 2
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
x2
x3
Group 3
Ch. 15-14
Between-Group Variation
SST = SSW + SSG
K
SSG = ∑ ni ( x i − x )
Where:
2
i=1
SSG = Sum of squares between groups
K = number of groups
ni = sample size from group i
xi = sample mean from group i
x = grand mean (mean of all data values)
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-15
Between-Group Variation
(continued)
K
SSG = ∑ ni ( x i − x )
2
i=1
Variation Due to
Differences
Between
Groups
SSG
MSG =
K −1
Mean Square Between Groups
= SSG/degrees of freedom
μi
μj
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-16
Between-Group Variation
(continued)
SSG = n1(x1 − x) + n2 (x 2 − x) + ... + nK (x K − x)
2
2
2
Response, X
x1
Group 1
Group 2
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
x2
x3
x
Group 3
Ch. 15-17
Obtaining the Mean Squares
SST
MST =
n −1
SSW
MSW =
n −K
SSG
MSG =
K −1
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-18
One-Way ANOVA Table
Source of
Variation
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
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-19
One-Factor ANOVA
F Test Statistic
H0: μ1= μ2 = … = μK
H1: At least two population means are different
Test statistic
MSG
F=
MSW
MSG is mean squares between variances
MSW is mean squares within variances
Degrees of freedom
df1 = K – 1
(K = number of groups)
df2 = n – K
(n = sum of sample sizes from all groups)
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-20
Interpreting the F Statistic
The F statistic is the ratio of the between estimate of variance and
the within estimate of variance
The ratio must always be positive
df1 = K -1 will typically be small
df2 = n - K will typically be large
Decision Rule:
Reject H0 if
F > FK-1,n-K,α
α = .05
0
Do not
reject H0
Reject H0
FK-1,n-K,α
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-21
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?
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Club 1
254
263
241
237
251
Club 2
234
218
235
227
216
Club 3
200
222
197
206
204
Ch. 15-22
One-Factor ANOVA Example:
Scatter Diagram
Club 1
254
263
241
237
251
Club 2
234
218
235
227
216
Club 3
200
222
197
206
204
Distance
270
260
250
240
230
•
••
•
•
220
x1 = 249.2 x 2 = 226.0 x 3 = 205.8
x = 227.0
210
••
•
••
x2
200
x
•
••
••
x3
190
1
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
x1
2
Club
3
Ch. 15-23
One-Factor ANOVA Example
Computations
Club 1
254
263
241
237
251
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
MSG = 4716.4 / (3-1) = 2358.2
MSW = 1119.6 / (15-3) = 93.3
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
2358.2
F=
= 25.275
93.3
Ch. 15-24
One-Factor ANOVA Example
Solution
Test Statistic:
H0: μ1 = μ2 = μ3
H1: μi not all equal
MSA 2358.2
F=
=
= 25.275
MSW
93.3
α = .05
df1= 2
df2 = 12
Decision:
Reject H0 at α = 0.05
Critical Value:
F2,12,.05= 3.89
α = .05
0
Do not
reject H0
Reject H0
F2,12,.05 = 3.89
Conclusion:
There is evidence that
at least one μi differs
F = 25.275
from the rest
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall
Ch. 15-25