You are on page 1of 43

Chapter 17: Two-way ANOVA

In the lecture on one-way ANOVA, we discussed the following experiment:


• Observe an emergency alone IV = Number of people present
• Observe an emergency w/ 1 other DV = Time it takes (in secs.) to call for help
• Observe an emergency w/ 2 others

P + 2 people P+1 P + 0 people


person
X 2= 9 X 1= 8 X 0= 3

In this experiment, we have ONE IV: the # of bystanders present

What if we wanted to look at other IVs too?

Chapter 17: Page 1


EX: Would the amount of time people wait to help be affected by
the gender of the person in need of help?

Chapter 17: Page 2


Let’s do an experiment where we stage an emergency situation:

IV1: The victim of the emergency is either male OR female

IV2: The P witnesses the emergency alone, w/ 1 other, OR 2 others

These two IVs are “crossed,” meaning that each level of one IV is
paired with all levels of the other IV

Put another way, we have all possible combinations of the IVs

P + 2 people P+1 P + 0 people


person
Male victim X=9 X=8 X=3
Female victim X=4 X=4 X=2

Chapter 17: Page 3


Chapter 17: Page 4
VOCABULARY
Factor = Independent variable
Two-factor ANOVA / Two-way ANOVA: an experiment with 2
independent variables

Levels: number of treatment conditions (groups) for a specific IV


NOTATION
3 X 2 factorial = experiment w/ 2 IVs: one w/ 3 levels, one w/ 2
levels
2 X 2 factorial = experiment w/ 2 IVs: both w/ 2 levels

3 X 2 X 2 = ????

Chapter 17: Page 5


Why do a two-factor (two-way) ANOVA?
1. Greater generalizability of results
--EX: If experiment is only done with a male victim, we don’t
know if the results are also true for female victims

2. Allows one to look for interactions


--The effect of one IV depends on the level of the other IV

--EX: Sample of patients who have an infection:


¼ get antibiotics and are not allergic
¼ don’t get antibiotics and are not allergic
¼ get antibiotics and are allergic
¼ don’t get antibiotics and are allergic
--Measure how well the patients feel the next day
Chapter 17: Page 6
6

5
5

How do you feel right now?


4
Allergic?
3 3 No
3
Yes

1
1

0
No Yes
Receive Anti-biotic

This illustrates an interaction

Chapter 17: Page 7


6

5 5
5

How do you feel right now?


4
Allergic?
3 3 No
3
Yes

0
No Yes
Receive anti-biotic

If there were no interaction, then the graph would have looked


like this

Chapter 17: Page 8


Let’s return to our bystander intervention experiment:

P + 2 people P+1 P + 0 people


person
Male victim X=9 X=8 X=3
Female victim X=4 X=4 X=2

When we do a two-way ANOVA, we will obtain three different


statistical tests:

1. Main effect of IV1: Gender of Victim


2. Main effect of IV2: # of Bystanders Present
3. Interaction b/n the two IVs (gender & # of bystanders)

Chapter 17: Page 9


Each is a hypothesis test:

Gender Main Effect:


H0: all levels of gender have the same mean
H1: all levels of gender do not have the same mean

Bystander Main Effect:


H0: all levels of bystander have the same mean
H1: all levels of bystander do not have the same mean

Interaction:
H0: there is no interaction between the factors
H1: there is an interaction between the factors

Chapter 17: Page 10


Main Effects
Defined: The effect of ONE IV on the DV averaged across the levels of the
other IV

In our example:

--Main effect of gender: Is there a difference in response time for male


versus female victims, averaging over the number of bystanders present?

That is: Ignoring the number of bystanders, does response time differ for
male versus female victims?
--Main effect of # of bystanders: Is there a difference in response time when
there is 1 versus 2 versus 3 bystanders present, averaging over the victim’s
gender?
That is: Ignoring the gender of the victim, does response time differ based
on the number of bystanders present?

Chapter 17: Page 11


One way to understand main effects is to examine something
called marginal means
Response time for
male victims,
averaging over # of
bystanders
P + 2 people P + 1 person P + 0 people Marginal (9 + 8 + 3) / 3 =
Means 6.67
Male victim
X=9 X=8 X=3 X = 6.67
Female victim
X=4 X=4 X=2 X = 3.33
Marginal Means
X = 6.5 X =6 X = 2.5 Response time for
female victims,
averaging over # of
Response time bystanders
Response time (4 + 4 + 2) / 3 =
for 3 Response time
for 2 3.33
bystanders, for 1 bystander,
bystanders,
averaging over averaging over
averaging over
gender gender
gender
(9 + 4) / 2 = 6.5 (3 + 2) / 2 = 2.5
(8 + 4) / 2 = 6

Chapter 17: Page 12


A main effect of gender asks:

Do the marginal means of 6.67 (male victims) and 3.33 (female


victims) differ?

A main effect of # of bystanders asks:

Do the marginal means of 6.5 (3 bystanders), 6 (2 bystanders), &


2.5 (1 bystander) differ?

Chapter 17: Page 13


Calculations

To perform all the calculations for Sums of Squares for a two-way


anova by hand is time and labor intensive

These are almost exclusively done using the aid of a statistical


package, like SPSS

Thus, I’ll just explain the calculations conceptually

Chapter 17: Page 14


Calculations: Main Effects Sums of Squares
Calculations for main effects SS in a two-way ANOVA are very similar to the
calculations we used in one-way ANOVA
Conceptually, to calculate the SS for a main effect, one is comparing each
marginal mean to the overall (grand) mean
P + 2 people P + 1 person P + 0 people Marginal Means
Male victim
X=9 X=8 X=3 X = 6.67
Female victim
X=4 X=4 X=2 X = 3.33
Marginal Means Overall: 5
X = 6.5 X =6 X = 2.5
For a main effect of # of bystanders, one is taking the squared difference b/n:
The mean from 3 bystanders & the overall mean (6.5 – 5)
The mean from 2 bystanders & the overall mean (6-5)
The mean from 1 bystander & the overall mean (2.5 – 5)

These squared differences are multiplied by the # of scores per mean

Chapter 17: Page 15


For a main effect of gender, one is taking the squared difference b/n:
The mean from male victims & the overall mean (6.67 – 5)
The mean from female victims & the overall mean (3.33-5)

These squared differences are multiplied by the # of scores per mean

Calculations: Sums of Squares Total

The Total SS is calculated by summing the squared deviations


between each score and the overall grand mean

Chapter 17: Page 16


Calculations: Sums of Squares Cells

The SS Cells is calculated by summing the squared deviations


between each cell mean and the overall grand mean

Each deviation is weighted by the number of observations in that


cell

Why would we want this?

Cell means could differ b/c:

1. They come from different levels of gender


2. They come from different levels of # of bystanders
3. There is an interaction b/n gender & # of bystanders

Chapter 17: Page 17


SS cells is made up of 3 parts:

SS gender
SS # of bystanders
SS interaction

We can calculate SS gender & SS # of bystanders directly

Then, to find SS interaction:

SS interaction = SS cells – SS gender – SS # of bystanders

Chapter 17: Page 18


Calculations: Sums of Squares Error

The SS error is “what’s left over”

Of the total SS, we know what is due to gender (SS gender), what
is due to the # of bystanders (SS bystanders) and what is due
to the interaction (SS interaction). Thus:

SSerror = SStotal – (SSgender + SSbystanders + SSinteraction)

Chapter 17: Page 19


ANOVA Table

Source df SS MS F
Gender
# of Bystanders
Interaction (G*B)
Error
Total

Chapter 17: Page 20


Calculations: Degrees of Freedom

dftotal = N – 1

(where N is the total sample size of the entire experiment)

dfgender = k – 1 (where k is the # of gender levels)

dfbystanders = k – 1 (where k is the # of bystander levels)

dfinteraction = dfgender * dfbystanders

(Product of the df for the two IVs)

dferror = dftotal - dfgender - dfbystanders - dfinteraction

Chapter 17: Page 21


Calculations: Mean Squares
To find any MS, take the SS & divide by its corresponding df
SS Gender
MSGender = df Gender

SS Bys tan ders


MSBystanders = df Bys tan ders

SS Interactio n
MSInteraction = df Interactio n

SS Error
MSError = df Error

Chapter 17: Page 22


Calculations: F statistics
To find the 3 F statistics for our tests, take the MS for the 2 IVs &
the MS for the interaction & divide them by the MSError
MS Gender
FGender = MS Error

MS Bys tan ders


FBystanders = MS Error

MS Interactio
FInteraction =
n
MS Error

Chapter 17: Page 23


Calculations: Critical Values

To determine if a particular F statistic is statistically significant,


you obtain the appropriate critical value from Table E.3 or E.4

For each F, you have two df: one for the corresponding factor and
the dfError
As usual, if the obtained F value equals or exceeds the critical
value, then we reject the null hypothesis and conclude that we
have a statistically significant effect

Chapter 17: Page 24


Between-Subjects Factors

Interpreting SPSS Output N


Gender of f 15
Victim m 15
# of bystanders 1.00 10
present 2.00 10
3.00
10 Main
effect of
Tests of Between-Subjects Effects gender

Dependent Variable: How long do P wait to help?


Type III Sum
Source of Squares df Mean Square F Sig.
Corrected Model 200.000 a 5 40.000 17.778 .000
Intercept 750.000 1 750.000 333.333 .000
GENDER 83.333 1 83.333 37.037 .000 Main effect
of
BYSTAND 95.000 2 47.500 21.111 .000
bystanders
GENDER * BYSTAND 21.667 2 10.833 4.815 .017
Error 54.000 24 2.250
Total 1004.000 30
Corrected Total 254.000 29
a. R Squared = .787 (Adjusted R Squared = .743)
Interaction
between
gender &
bystanders

Chapter 17: Page 25


There was a
main effect
Estimated Marginal Means of gender, so
these means
differ
1. Gender of Victim

Dependent Variable: How long do P wait to help?


95% Confidence Interval
Gender of Victim Mean Std. Error Lower Bound Upper Bound
f 33
. 33 .387 25
. 34 41
. 33 There was a
m 66
. 67 .387 58
. 67 74
. 66 main effect
of bystander,
so there is a
difference
2. # of bystanders present
among these
Dependent Variable: How long do P wait to help? means
95% Confidence Interval
# of bystanders present Mean Std. Error Lower Bound Upper Bound
10
. 0 25
. 00 .474 15
. 21 34
. 79
20
. 0 60
. 00 .474 50
. 21 69
. 79
30
. 0 65
. 00 .474 55
. 21 74
. 79

Chapter 17: Page 26


3. Gender of Victim * # of bystanders present

Dependent Variable: How long do P wait to help?


95% Confidence Interval
Gender of Victim # of bystanders present Mean Std. Error Lower Bound Upper Bound
f 10
. 0 20
. 00 .671 .615 33
. 85
20
. 0 40
. 00 .671 26
. 15 53
. 85
30
. 0 40
. 00 .671 26
. 15 53
. 85
m 10
. 0 30
. 00 .671 16
. 15 43
. 85
20
. 0 80
. 00 .671 66
. 15 93
. 85
30
. 0 90
. 00 .671 76
. 15 103
. 85

There was a significant


interaction, so the
effect of bystander
depends on the level of
gender

Chapter 17: Page 27


Multiple-comparison procedures: Post-hoc tests VS simple effects

Understanding Main Effects

If there is a significant main effect, & that factor has only two levels, you know
that those two marginal means differ significantly from each other

If there is a significant main effect, & that factor has 3 or more levels, you
know that at least two of those marginal means differ. Need multiple-
comparison procedures (post-hocs) to determine which ones.

Can be obtained in SPSS

Chapter 17: Page 28


Post Hoc Tests: # of bystanders present
1 bystander
Multiple Comparisons
differs from
Dependent Variable: How long do P wait to help?
LSD
2

Mean
(I) # of bystanders (J) # of bystanders Difference 95% Confidence Interval
present present (I-J) Std. Error Sig. Lower Bound Upper Bound 1 bystander
10. 0 20
. 0 - 35000
. * .6708 .000 - 48845
. -21155
. differs from
30
. 0 - 40000
. * .6708 .000 - 53845
. -26155
.
20
. 0 10
. 0 35. 000* .6708 .000 21
. 155 48
. 845
3
30
. 0 -.5000 .6708 .463 - 18845
. .8845
30
. 0 10
. 0 40. 000* .6708 .000 26
. 155 53
. 845
20
. 0 .5000 .6708 .463 -.8845 18
. 845 2 bystanders
Based on observed means. DO NOT
*. The mean difference is significant at the .05level.
differ from 3

Chapter 17: Page 29


Multiple-comparison procedures: Post-hoc tests VS simple effects

Understanding Interactions

An interaction occurs when the effect of one IV depends on the level of the
other IV

If you obtain a significant interaction, you may want to examine it closely to see
what is causing it

A useful first step is to graph the means to see the pattern of the interaction

Can be obtained in SPSS or done “by hand”

Chapter 17: Page 30


You could graph the means two different ways:

Estimated Marginal Means of How long do P wait to help?


1
0

8
Estimated Marginal Means

4
# of bystanders pres

1
. 00
2
2
. 00

0 3
. 00
f m

Gender of Victim

Graphed this way, we see that the bystander effect seems smaller for female
victims compared to male victims

Chapter 17: Page 31


Estimated Marginal Means of How long do P wait to help?
10

Estimated Marginal Means


6

Gender of Victim
2
f

0 m
1.00 2.00 3.00

# of bystanders present

Graphed this way, we see that male and female victims get helped about equally
quickly with one bystander present, but when multiple bystanders are
present, a gender difference emerges

Chapter 17: Page 32


Understanding Interactions

Another thing to do to understand an interaction is to calculate “simple effects”


“The effect of one IV at one level of another IV”

Can be done in SPSS using Syntax

Chapter 17: Page 33


There is no difference in
Simple effects of gender at each level of bystander: response time for male and
female victims when only
1 bystander is present
Univariate Tests

Dependent Variable: How long do P wait to help?


Sum of
# of bystanders present Squares df Mean Square F Sig.
10
. 0 Contrast 25
. 00 1 25
. 00 11
. 11 .302
Error 540
. 00 24 22
. 50
20
. 0 Contrast 400
. 00 1 400
. 00 177
. 78 .000
Error 540
. 00 24 22
. 50
30
. 0 Contrast 625
. 00 1 625
. 00 277
. 78 .000
Error 540
. 00 24 22
. 50
Each F tests the simple effects of Gender of Victim within each level combination of the other effects
shown. These tests are based on the linearly independent pairwise comparisons among the estimated
marginal means.

There is a difference
between male and female
victims in response time
when 2 or 3 bystanders
are present

Chapter 17: Page 34


Simple effects of bystander at each level of gender:
Univariate Tests

Dependent Variable: How long do P wait to help?


Sum of
Gender of Victim Squares df Mean Square F Sig.
f Contrast 133
. 33 2 66
. 67 29
. 63 .071
Error 540
. 00 24 22
. 50
m Contrast 1033
. 33 2 516
. 67 229
. 63 .000
Error 540
. 00 24 22
. 50
Each F tests the simple effects of # of bystanders present within each level combination of the
other effects shown. These tests are based on the linearly independent pairwise comparisons
among the estimated marginal means.

There is a difference among


the levels of bystander for
male victims. There is no
such difference for female
victims

Chapter 17: Page 35


Interpretation

Reporting the results of a two-way anova is complex because there are so many
tests conducted. Below is one way you might report the results of the
above analyses:

Chapter 17: Page 36


“An experiment was conducted to determine if the number of bystanders present
in an emergency situation and the gender of the victim in an emergency
situation affect the time it takes a person to help. A two-way ANOVA
found a main effect of gender, F(1,24)=37.037, p ≤ .05, indicating that
female victims are helped sooner than male victims. There was also a
main effect of the number of bystanders present, F(2,24)=21.111, p ≤ .05.
This effect showed that a lone bystander helped much sooner than when
there were 2 or 3 bystanders present. Finally, there was an interaction
between gender and the number of bystanders present, F(2,24)=4.815, p
≤ .05. Simple effects tests showed that male and female victims receive
help equally quickly when only 1 bystander is present, F(1,24)=1.11, p
> .05. However, when 2 or 3 bystanders are present, female victims were
helped more quickly than male victims, F(1,24)=17.778, p ≤ .05 for 2
bystanders and F(1,24)=27.778, p ≤ .05 for 3 bystanders.”

Chapter 17: Page 37


Filling in an ANOVA Table
You should be able to complete a partially filled in ANOVA table

Let’s suppose we did an experiment where we investigate the effectiveness of


advertisements. We manipulate:

IV1: Whether the ad has a celebrity spokesperson or a “normal” person


IV2: Whether the ad is in black/white or color
DV: How persuasive do Ps find the ad on a scale where 1 = Not at all persuaded;
7 = Extremely persuaded

There are 20 participants “per cell”

Chapter 17: Page 38


ANOVA Table

Source df SS MS F
Spokesperson 200
Color 150
Interaction (S*C) 50
Error
Total 850
We should be able to complete everything else!

Calculate df
Spokesperson has 2 levels df = (k – 1) = (2 – 1) = 1
Color has 2 levels df = (k – 1) = (2 – 1) = 1
Interaction df is the product of the df for the 2 IVs = 1*1 = 1
Total df = (N – 1) = (80-1) = 79
Error df = “what’s left over” (79 – 1 – 1 – 1) = 76

Chapter 17: Page 39


Source df SS MS F
Spokesperson 1 200
Color 1 150
Interaction (S*C) 1 50
Error 76
Total 79 850

The SS for all factors and interactions should add up to the total
SS. Thus:

SSerror = SStotal – SSspokesperson – SScolor - SSinteraction

SSerror = 850 – 200 – 150 – 50 = 450

Chapter 17: Page 40


Source df SS MS F
Spokesperson 1 200
Color 1 150
Interaction (S*C) 1 50
Error 76 450
Total 79 850
SS spokespers 2
00 SS color 150
MSSpokesperson = df spokespers
on

on
=
1
=2
00
MScolor = df color
=
1
= 150

SS Interactio n 50 SS Error 450


MSInteraction = df Interactio n
=
1
= 50
MSError = df Error
=
76
= 5.92

Chapter 17: Page 41


Source df SS MS F
Spokesperson 1 200 200
Color 1 150 150
Interaction (S*C) 1 50 50
Error 76 450 5.92
Total 79 850
MS Spokespers 200 MS Color 150
FSpokesperson = MS Error
on
=
5.9
2
=3
3.7
8
FColor = MS Error
=
5.92
= 25.34

MS Interactio n 50
FInteraction = MS Error
=
5.92
= 8.45

Chapter 17: Page 42


Source df SS MS F
Spokesperson 1 200 200 33.78
Color 1 150 150 25.34
Interaction (S*C) 1 50 50 8.45
Error 76 450 5.92
Total 79 850
Finally, we’d compare each F to the appropriate critical F value
All tests in this example have 1,76 df. Assuming α = .05, from
Table E.3, we’ll use the df that are closest to but smaller than
the actual df, b/c they are not listed
Thus, we will use the df for (1,60) = 4.00
All F’s exceed the critical value

Chapter 17: Page 43

You might also like