You are on page 1of 88

Two-way

ANOVA
& Interactions
Two-way ANOVA and
interactions
• Thinking about interactions
– Types of interactions
• Calculating and interpreting 2-way
ANOVAs
Good Samaritan Study
• How do situational variables affect
helping behavior?
– Darley & Batson (1973) recruited seminary
students and told them they were to
prepare a talk on either seminary jobs or
about the story of the Good Samaritan
– They then told subjects they were either
“fine” on time (low hurry), barely on time
(medium hurry), or running late (high
hurry)
– On the way to give the talk, they encounter
a man slumped in an alleyway
• Who helps?
The Good Samaritan Study
• What type of study design is this?
The Good Samaritan Study
• What type of study design is this?
– Two manipulations (IV’s)
• Topic of talk (2 conditions: seminary jobs or
Good Samaritan story)
• Hurriedness (3 conditions: low, medium,
and high)
The Good Samaritan Study
• What type of study design is this?
– Two manipulations (IV’s)
• Topic of talk (2 conditions: seminary jobs or
Good Samaritan story)
• Hurriedness (3 conditions: low, medium,
and high)
– 2x3 factorial design
• Can use a 2x3 ANOVA
• E.g., a two-way ANOVA with
– 2 levels of first IV
– 3 levels of second IV
The Good Samaritan Study
• What might be the prediction here?
– Hurriedness affects helping behavior,
such that people are less likely to help
when in a hurry
– What about the talk topic?
The Good Samaritan Study
• What might be the prediction here?
– Hurriedness affects helping behavior,
such that people are less likely to help
when in a hurry
– What about the talk topic?
• Think about the concept of an interaction
within this example…
Study results: No interaction
Effects of Depression
Medication
• Say you examine the
effects of a medication on
depression levels in
bipolar and non-bipolar
patients…
– You give either the medicine
or a placebo (X1)
– To patients who are either
bipolar or not
Depression Results
Depression results
• There might be a main effect for
patient type (bipolar vs. non-bipolar)

– This might not be interesting; maybe
already knew that
Depression Results
Depression results
• There might be a main effect for
patient type (bipolar vs. non-bipolar)…
– This might not be interesting; maybe
already knew that
• There might be a main effect for drug
– Averaging across everybody, the mean for
depression is lower in the drug (vs.
placebo) condition
– But notice that could be misleading without
noticing that there is an interaction
Depression Results
Depression results
• There might be a main effect for patient
type (bipolar vs. non-bipolar)…
– This might not be interesting; maybe already
knew that
• There might be a main effect for drug
– Averaging across everybody, the mean for
depression is lower in the drug (vs. placebo)
condition
– But notice that could be misleading without
noticing that there is an interaction
• Importantly, though, the two IV’s interact
– The drug only seems effective for non-bipolar
patients
Depression results: Type of
interaction
• The graph shows that bipolar
patients were unaffected by the
drug, whereas non-bipolar patients
were less depressed when taking the
drug (vs. placebo)
– This is called an “ordinal interaction”
– One group moves more than another
group…
• Looks like a fan
Another ordinal interaction

Both groups
are going
down, but the
non-bipolar
people are
going down
more than the
bipolars
Personality type &
environments
• You have a hypothesis that different
personality types will perform
differently in different environments
– Select introverts and extroverts (IV1)
– Have them solve a task in a room that is
noisy or quiet (IV2)
– DV: number of errors made on the task
Results: Personality types and
environments
Personality type & environment
• No main effect for personality type
• No main effect for room environment
• Complete “crossover” interaction
– Introverts do better when in a quiet (vs.
noisy) room
– Extroverts do better when the room is
noisy (vs. quiet)
Results: Personality types and
environments
Personality type & environment
• Complete “crossover” interaction
– Introverts do better when in a quiet (vs.
noisy) room
– Extroverts do better when the room is
noisy (vs. quiet)
• The effect of one IV (e.g., room noise)
is completely reversed for different
levels of the other IV (personality type)
• This is called a “disordinal interaction”
– Looks like an X
Another example
• You have a hypothesis that obese
individuals tend to eat whether or not
their bodies are actually hungry (e.g.,
they do not respond to internal signals)
– Participants are normal weight or obese
(IV1)
– After not eating for several hours,
participants are either given a full meal
upon arrival or no food (IV2)
– DV: Number of crackers eaten during a
“taste test”
Crackers eaten: Results
Crackers eaten
• Obese people seem to eat about the
same number of crackers regardless
of whether they are hungry or full
– No main effect of weight-type, though,
e.g. Obese people are not always eating
more (or less) than normal weight
people
Crackers eaten: Results
Crackers eaten
• Obese people seem to eat about the
same number of crackers regardless
of whether they are hungry or full
– No main effect of weight-type, though,
e.g. Obese people are not always eating
more (or less) than normal weight
people
• There might be a main effect for
level of fullness…
Crackers eaten: Results
Crackers eaten
• Obese people seem to eat about the same
number of crackers regardless of whether they
are hungry or full
– No main effect of weight-type, though, e.g. Obese
people are not always eating more (or less) than
normal weight people
• There might be a main effect for level of
fullness…
– But the important part is the interaction
– Normal weight people eat more crackers when
hungry, but obese people don’t
• This is also a disordinal interaction
– The lines cross each other, still looks like an X
F-ratio in 2-way ANOVA
• Two-way ANOVA gives you 3 F-ratios
– One for X1 (or IV1), one for X2 (or IV2)
and one for the interaction (X1*X2)
– Structure is the same for all tests
• MS-w is in the denominator as an estimate of
the population variance
– If the interaction is not significant, you can
just look at the two “main effects”
• The F-ratio for X1 and for X2
– If the interaction is significant, you should
plot the cell means to see what’s going on
An example

• Does caffeine affect test performance?


Does it work differently for men and
women?
– Men & women are assigned to four caffeine
conditions: none, small, moderate, large
– They then take a GRE-type test
– Who does the best?
The null hypothesis
• There are 3 hypotheses
(corresponding to the 3-F ratios)
– 1. is the null for the gender factor
• No gender difference in test performance
• H0: μfemale = μmale
The null hypothesis
• There are 3 hypotheses
(corresponding to the 3-F ratios)
– 1. is the null for the gender factor
• No gender difference in test performance
• H0: μfemale = μmale
– 2. is the null for caffeine factor
• No affect of caffeine on test performance
• H0: μzero= μsmall= μmoderate = μlarge
The null hypothesis
• There are 3 hypotheses
(corresponding to the 3-F ratios)
– 1. is the null for the gender factor
• No gender difference in test performance
• H0: μfemale = μmale
– 2. is the null for caffeine factor
• No affect of caffeine on test performance
• H0: μzero= μsmall= μmoderate = μlarge
– 3. is the null for the interaction
• The effects of caffeine on test performance
does not differ for men vs. women
• No symbolic way to write this
Select the test

• We have two independent variables


– Two gender conditions (male vs.
female)
– 4 caffeine conditions (none, low,
moderate, high dosage)
• Use a two-way ANOVA
– This is a 2x4 ANOVA
None Low Moderate High
Men 9 10 12 6 Row
10 13 10 15 mean =
10.85
7 15 12 12
12 12 13 12
7 10 7 13
Mean 9.0 12.0 10.8 11.6
SD 2.121 2.121 2.387 3.362
Women 4 12 9 10 Row
7 13 7 13 mean =
9.25
6 15 10 4
9 10 7 9
9 13 13 5
Mean 7.0 12.6 9.2 8.2
SD 2.121 1.817 2.490 3.701
Column
means
9.9 10.0 12.3 8.0 10.05
Calculate the ANOVA
• 1. First find MS-w
MS-within
• Average of the 8 variances (each of
the 8 cells has a variance)

MSW =
∑ s 2

k
None Low Moderate High
Men 9 10 12 6 Row
10 13 10 15 mean =
10.85
7 15 12 12
12 12 13 12
7 10 7 13
Mean 9.0 12.0 10.8 11.6
SD 2.121 2.121 2.387 3.362
Women 4 12 9 10 Row
7 13 7 13 mean =
9.25
6 15 10 4
9 10 7 9
9 13 13 5
Mean 7.0 12.6 9.2 8.2
SD 2.121 1.817 2.490 3.701
Column
means
9.9 10.0 12.3 8.0 10.05
MSW = ∑ s 2
MS-within
k
• Average of the 8 variances (each of
the 8 cells has a variance)

MSW =
1 ⎡( 2.121)
2
+ ( 2.121)
2
+ ( 2.387)
2
+ ( 3.362)
2
+ ( 2.121)
2
+ (1.817)
2⎤

⎢ ⎥
8 ⎢⎣+( 2.490) + ( 3.701)
2 2
⎥⎦
= 6.712
SS-w
• We could also calculate SS-w using
MS-w and df-w
– What’s df-w?

SSW = MSW ( df ) = 6.712( 32) = 214.78


None Low Moderate High
Men 9 10 12 6 Row
10 13 10 15 mean =
10.85
7 15 12 12
12 12 13 12
7 10 7 13
Mean 9.0 12.0 10.8 11.6
SD 2.121 2.121 2.387 3.362
Women 4 12 9 10 Row
7 13 7 13 mean =
9.25
6 15 10 4
9 10 7 9
9 13 13 5
Mean 7.0 12.6 9.2 8.2
SD 2.121 1.817 2.490 3.701
Column
means
9.9 10.0 12.3 8.0 10.05
SS-w
• We can calculate SS-w using MS-w
and df-w
– What’s df-w? 8 groups with 5 people
each
• 5*8-4 = 40-8 = 32

SSW = MSW ( df ) = 6.712( 32) = 214.78


SS df MS F p
Between
groups
Gender
Caffeine
Interaction
Within 214.78 32 6.712
groups
Total
Calculate the ANOVA
• 1. First find MS-w
• 2. Find SS-between
SS-between
• This is the total amount of variation
among the cell means (includes
main effects and interaction)
• Simplest way to find it is to find the
unbiased variance of the means
(using your calculator) & multiplying
by the total number of subjects

2
SSBet = N Tσ (means)
None Low Moderate High
Men 9 10 12 6 Row
10 13 10 15 mean =
10.85
7 15 12 12
12 12 13 12
7 10 7 13
Mean 9.0 12.0 10.8 11.6
SD 2.121 2.121 2.387 3.362
Women 4 12 9 10 Row
7 13 7 13 mean =
9.25
6 15 10 4
9 10 7 9
9 13 13 5
Mean 7.0 12.6 9.2 8.2
SD 2.121 1.817 2.490 3.701
Column
means
9.9 10.0 12.3 8.0 10.05
SS-between
• This is the total amount of variation
among the cell means (includes
main effects and interaction)
– Simplest way to find it is to find the
unbiased variance of the means (using
your calculator) & multiplying by the
total number of subjects

2
SSBet −cells = σ ( N ) = 3.4775(40) =139.1
SS df MS F p
Between 139.1 7
groups
Gender
Caffeine
Interaction
Within 214.78 32 6.712
groups
Total
Calculate the ANOVA
• 1. First find MS-w
• 2. Find SS-between
• 3. Find SS & MS for each of the two
factors (gender and caffeine group)
SS-gender
None Low Moderate High
Men 9 10 12 6 Row
10 13 10 15 mean =
10.85
7 15 12 12
12 12 13 12
7 10 7 13
Mean 9.0 12.0 10.8 11.6
SD 2.121 2.121 2.387 3.362
Women 4 12 9 10 Row
7 13 7 13 mean =
9.25
6 15 10 4
9 10 7 9
9 13 13 5
Mean 7.0 12.6 9.2 8.2
SD 2.121 1.817 2.490 3.701
Column
means
9.9 10.0 12.3 8.0 10.05
SS-gender
• The ss for gender is based on the
row means
– We can use the same method as for SS-
between, just using row means
– E.g., the variance of the means between
genders
SS-gender
• The ss for gender is based on the
row means
– We can use the same method as for SS-
between, just using row means
– E.g., the variance of the means between
genders

2
SSR = N Tσ (rowmeans)
SS-gender
• The ss for gender is based on the
row means
– We can use the same method as for SS-
between, just using row means
– E.g., the variance of the means between
genders 2
SSR = N Tσ (rowmeans) =
2
σ (10.85,9.25)(40) =
(.64)(40) = 25.6
SS-caffeine
None Low Moderate High
Men 9 10 12 6 Row
10 13 10 15 mean =
10.85
7 15 12 12
12 12 13 12
7 10 7 13
Mean 9.0 12.0 10.8 11.6
SD 2.121 2.121 2.387 3.362
Women 4 12 9 10 Row
7 13 7 13 mean =
9.25
6 15 10 4
9 10 7 9
9 13 13 5
Mean 7.0 12.6 9.2 8.2
SD 2.121 1.817 2.490 3.701
Column
means
9.9 10.0 12.3 8.0 10.05
SS-caffeine
• The means for each caffeine group
are the column means

2
SSC = N Tσ (colmeans)
SS-caffeine
• The means for each caffeine group
are the column means

2
SSC = N Tσ (colmeans) =
2
σ ( 8,12.3,10,9.9)( 40) =
( 2.3225)( 40) = 92.9
SS df MS F p
Between 139.1 7
groups
Gender 25.6
Caffeine 92.9
Interaction
Within 214.78 32 6.712
groups
Total
Degrees of freedom
• For gender, we have 2 groups
– df = 2-1 = 1
• For caffeine, we have 4 groups
– df = 4-1 = 3
Degrees of freedom & MS
• For gender, we have 2 groups
– df = 2-1 = 1
• For caffeine, we have 4 groups
– df = 4-1 = 3
• MS = SS/df
– For gender, 25.6/1 = 25.6
– For caffeine, 92.9/3 = 30.697
SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6
Caffeine 92.9 3 30.967
Interaction
Within 214.78 32 6.712
groups
Total
Calculate the ANOVA
• 1. First find MS-w
• 2. Find SS-between
• 3. Find SS & MS for each of the two
factors (gender and caffeine group)
• 4. Find SS & MS for the interaction
SS-interaction
• SS-between is the variance between
all the cell means
– SS-gender is the variance between row
means
– SS-caffeine is variance between column
means
– Whatever’s left is the interaction
between cell means
• SS-between = SS-gender + SS-
caffeine + SS-interaction
SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6
Caffeine 92.9 3 30.967
Interaction
Within 214.78 32 6.712
groups
Total

139.1 = 25.6 + 92.9 + SS-interaction


SS-interaction = 139.1 – (25.6+92.9) = 20.6
SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6
Caffeine 92.9 3 30.967
Interaction 20.6
Within 214.78 32 6.712
groups
Total

139.1 = 25.6 + 92.9 + SS-interaction


SS-interaction = 139.1 – (25.6+92.9) = 20.6
SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6
Caffeine 92.9 3 30.967
Interaction 20.6 3
Within 214.78 32 6.712
groups
Total
Df-between = df-gender + df-caffeine + df-
interaction
7 = 1+3+df-interaction, so df-interaction = 3
SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6
Caffeine 92.9 3 30.967
Interaction 20.6 3
Within 214.78 32 6.712
groups
Total
Df-between = df-gender + df-caffeine + df-
interaction
7 = 1+3+df-interaction, so df-interaction = 3

Another way:
df-interaction = df-gender * df-caffeine
SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6
Caffeine 92.9 3 30.967
Interaction 20.6 3 6.867
Within 214.78 32 6.712
groups
Total
MS-interaction = SS-interaction/df-interaction
20.6/3 = 6.867
Calculate the ANOVA
• 1. First find MS-w
• 2. Find SS-between
• 3. Find SS & MS for each of the two
factors (gender and caffeine group)
• 4. Find SS & MS for the interaction
• 5. Find the 3 F-ratios
SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6
Caffeine 92.9 3 30.967
Interaction 20.6 3 6.867
Within 214.78 32 6.712
groups
Total

Remember that MS-w is always in the denominator

F-gender = MS-gender/MS-w = 25.6/6.712 = 3.814


SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6 3.81
Caffeine 92.9 3 30.967
Interaction 20.6 3 6.867
Within 214.78 32 6.712
groups
Total

Remember that MS-w is always in the denominator

F-gender = MS-gender/MS-w = 25.6/6.712 = 3.814


F-caffeine = MS-caffeine/MS-w = 31/6.712 = 4.6
SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6 3.81
Caffeine 92.9 3 30.967 4.6
Interaction 20.6 3 6.867 1.02
Within 214.78 32 6.712
groups
Total

Remember that MS-w is always in the denominator

F-gender = MS-gender/MS-w = 25.6/6.712 = 3.814


F-caffeine = MS-caffeine/MS-w = 31/6.712 = 4.6
F-interaction = MS-interaction/MS-w =6.87/6.12 = 1.02
Calculate the ANOVA
• 1. First find MS-w
• 2. Find SS-between
• 3. Find SS & MS for each of the two
factors (gender and caffeine group)
• 4. Find SS & MS for the interaction
• 5. Find the 3 F-ratios

• Done– now test each F-ratio for


significance
SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6 3.81
Caffeine 92.9 3 30.967 4.6
Interaction 20.6 3 6.867 1.02
Within 214.78 32 6.712
groups
Total

Critical F for gender = F(1, 32) = 4.17


Critical F for caffeine = F(3,32) = 2.92
Critical F for interaction = F(3,32) = 2.92

Always use df-within as second df


SS df MS F p
Between 139.1 7
groups
Gender 25.6 1 25.6 3.81 > .05
Caffeine 92.9 3 30.967 4.6 < .05
Interaction 20.6 3 6.867 1.02 > .05
Within 214.78 32 6.712
groups
Total

Critical F for gender = F(1, 32) = 4.17


Critical F for caffeine = F(3,32) = 2.92
Critical F for interaction = F(3,32) = 2.92

Always use df-within as second df


Results
• Only the f-ratio for caffeine was
significant
– No main effect of gender and no
interaction
– Let’s look at the graph…
Results
• Only the f-ratio for caffeine was
significant
– No main effect of gender and no
interaction
– Let’s look at the graph…
– Dosage of caffeine makes a difference,
but how?
• Can use Tukey’s HSD (because there are 4
groups)
Find HSD
MSW 6.712
HSD = q = 3.85 = 3.154
n 10
• Notice that n=10 here.. That’s
because we are comparing the 4
caffeine conditions, ignoring gender
– There are 10 people in each caffeine
group
Multiple comparisons
HSD = 3.154
• Large – moderate = 9.9 – 10.0 = -.1


Multiple comparisons
HSD = 3.154
• Large – moderate = 9.9 – 10.0 = -.1
• Large – small = 9.9 – 12.3 = -2.4


Multiple comparisons
HSD = 3.154
• Large – moderate = 9.9 – 10.0 = -.1
• Large – small = 9.9 – 12.3 = -2.4
• Large – zero = 9.9 – 8 = 1.9

Multiple comparisons
HSD = 3.154
• Large – moderate = 9.9 – 10.0 = -.1
• Large – small = 9.9 – 12.3 = -2.4
• Large – zero = 9.9 – 8 = 1.9

• Moderate – small = 10 – 12.3 = -2.3
Multiple comparisons
HSD = 3.154
• Large – moderate = 9.9 – 10.0 = -.1
• Large – small = 9.9 – 12.3 = -2.4
• Large – zero = 9.9 – 8 = 1.9

• Moderate – small = 10 – 12.3 = -2.3
• Moderate – zero = 10 – 8 = 2.0
Multiple comparisons
HSD = 3.154
• Large – moderate = 9.9 – 10.0 = -.1
• Large – small = 9.9 – 12.3 = -2.4
• Large – zero = 9.9 – 8 = 1.9

• Moderate – small = 10 – 12.3 = -2.3
• Moderate – zero = 10 – 8 = 2.0
• Small – 0 = 12.3 – 8 = 4.3 **
– This is the only one that’s significant

You might also like