MKT 317
Two-Way ANOVA
Two-way ANOVA
So far, our ANOVA problems had only one dependent variable
and one independent variable (factor). (e.g. compare gas mileage
across different brands)
What if want to use two or more independent variables? (e.g.
compare gas mileage across different brands of cars and in
different states)
We will only look at the case of two independent variables, but the
process is the same for larger number of independent variables.
When we are examining the effect of two independent variables,
this is called a Two-Way ANOVA.
Two-way ANOVA
In a Two-way ANOVA, the effects of two factors can be
investigated simultaneously. Two-way ANOVA permits
the investigation of the effects of either factor alone (e.g.
the effect of brand of car on the gas mileage, and the effect
of the state on the gas mileage) and also the two factors
together (e.g.the combined effect of the model of the car
and the effect of state on gas mileage).
This ability to look at both factors together is the
advantage of a Two-Way ANOVA compared to two One-
Way ANOVA’s (one for each factor)
Two-way ANOVA
The effect on the population mean (of the
dependent variable) that can be attributed to the
levels of either factor alone is called a main
effect. This is what you would detect using two
separate one-way ANOVA’s.
Main Effect of Car Brand
MPG
Maxima
Camry
Taurus
Main Effect of Tire Brand
MPG
Maxima
Camry
Taurus
Pirelli Toyo Michelin Goodyear
Hypotheses
Two questions are answered by a Two-way
ANOVA
Is there any effect of Factor A on the outcome? (Main
Effect of A).
Is there any effect of Factor B on the outcome? (Main
Effect of B).
This means that we will have two sets of
hypotheses, one set for each question.
Hypotheses
1) Main effect of Factor A:
H0: 1 = 2 = 3 = ... a = 0 or, i = 0 for all i = 1 to a
(a = # of levels of A)
H1: not all i are 0 or, at least one i 0
2) Main effect of Factor B:
H0: ß1 = ß2 = ß3 = ... ßb = 0 or, ßj = 0 for all j = 1 to b
(b = # of levels of B)
H1: not all ßj are 0 or, at least one ß j 0
Hypotheses
Effect of brand of car (Factor A) and tire (Factor B) on gas mileage
(dependent variable).
1) Main effect of Car Brand:
H0: There is no difference in average gas mileage across
different brands of cars.
H1: There are differences in average gas mileage across
different brands of cars.
2) Main effect of Tire Brand:
H0: There is no difference in average gas mileage across
different brands of tires.
H1: There are differences in average gas mileage across
different brands of tires.
Sum Squares
In One-way ANOVA, the relationship between the sums of
squares was:
SST = SSTR + SSE
In Two-way ANOVA, we have two factors, which means
we have separate treatment levels for those two factors.
Thus the relationship becomes:
SST = SSA + SSB + SSE
Where:
SSA: Variance between different levels of factor A
SSB: Variance between different levels of factor B
Mean Squares and F value
Mean Squares: F-calculated:
MSA = SSA FA = MSA
(a - 1) MSE
MSB = SSB FB = MSB
(b - 1) MSE
MSE = SSE/(a-1)(b-1)
Two Way ANOVA Table
Source of Sum of
Variation Squares df Mean Square F-ratio F-critical
Factor A SSA a-1 MSA= SSA /(a-1) F= MSA/MSE F [(a-1),(a-1)(b-1)]
Factor B SSB b-1 MSB= SSB /(b-1) F= MSB/MSE F [(b-1),(a-1)(b-1]
Error SSE (a-1)(b-1) MSE= SSE /(a-1)(b-1)
TOTAL SST ab-1
a- Number of treatment levels (categories) for Factor A.
b- Number of treatment levels (categories) for Factor B.
TWO WAY ANOVA EXAMPLE
A group of students are interested in testing
how popular it is to watch Olympic events at
Vancouver. They wonder if there is an effect
of five different events or the day of week that
the events are scheduled for (Friday, Saturday,
or Sunday). The results are analyzed with a
two-way ANOVA Table shown below:
Source of Sum of Mean
Variation Squares df Square F-ratio F-critical
Event 568
Day 63
Error 170
TOTAL 801
Two Way ANOVA with Interactions
Hypotheses
Three questions are answered by a Two-way ANOVA with
Interactions
Is there any effect of Factor A on the outcome?
(Main Effect of A).
Is there any effect of Factor B on the outcome?
(Main Effect of B).
Is there any effect of the interaction of Factor A and Factor B on
the outcome?
(Interactive Effect of AB)
This means that we will have three sets of hypotheses, one
set for each question.
Interaction Effect of Car and Tire
MPG
Maxima
Camry
Taurus
Pirelli Toyo Michelin Goodyear
NO Interaction Effect of Car and Tire
MPG
Maxima
Camry
Taurus
Pirelli Toyo Michelin Goodyear
Hypotheses
1) Main effect of Factor A:
H0: 1 = 2 = 3 = ... a = 0 or, i = 0 for all i = 1 to a
(a = # of levels of A)
H1: not all i are 0 or at least one i 0
2) Main effect of Factor B:
H0: ß1 = ß2 = ß3 = ... ßb = 0 or, ßj = 0 for all j = 1 to b
(b = # of levels of B)
H1: not all ßj are 0 or at least one ßj 0
3) Interactive Effect of AB:
H0: ßij = 0 for all i and j
H1: the ßij are not all 0
Two Way ANOVA
with Interactions Table
Source of Sum of
Variation Squares df Mean Square F-ratio F-critical
Factor A SSA a-1 MSA= SSA / (a-1) F= MSA/MSE F [(a-1),ab(n-1)]
Factor B SSB b-1 MSB= SSB / (b-1) F= MSB/MSE F [(b-1),ab(n-1)]
Interaction SSAB (a-1)(b-1) MSI = SSAB / (a-1)(b-1) F= MSAB/MSE F [(a-1)(b-1),ab(n-1)]
Error SSE ab(n-1) MSE= SSE / ab(n-1)
TOTAL SST abn-1
a: Number of treatment levels (categories) for Factor A.
b: Number of treatment levels (categories) for Factor B.
n: number of observations per cell
Mean Squares and F value
Mean Squares: F-calculated:
MSA = SSA FA = MSA
(a - 1) MSE
MSB = SSB FB = MSB
(b - 1) MSE
MSAB = SSAB FAB = MSAB
(a-1)(b - 1) MSE
MSE = SSE
ab(n-1)
Two-Way ANOVA with Interaction Example
A group of students are interested in testing how popular it is
to watch Olympic events at Vancouver. They wonder if
there is an effect of five different events or the day of week
that the events are scheduled for (Friday, Saturday, or
Sunday). A total of 75 students are surveyed so that each
combination cell of event and day has an equal number of
students. The results are analyzed with a two-way ANOVA
with interactions table shown below:
Source of Sum of Mean
Variation Squares df Square F-ratio F-critical
Event 133
Day 63
Interaction
Error 486
TOTAL 801
Two-Way ANOVA with Interaction Example 2
The Neilson Company is interested in testing for differences in average
viewer satisfaction with morning news, evening news, and late news. The
company is also interested in determining whether differences exist in
average viewer satisfaction with the three main networks: CBS, ABC,
NBC. Nine groups of 50 viewers are assigned to each combination.
Complete the following ANOVA table and interpret the results.
Source of Sum of Mean
Variation Squares df Square F-ratio F-critical
Network 145
Time 160
Interaction 240
Error 6,200
TOTAL