Chapter 17 two-way anova

advertisement
Chapter 17: Two-way ANOVA
In the lecture on one-way ANOVA, we discussed the following experiment:
IV = Number of people present
 Observe an emergency alone
 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 person P + 0 people
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?
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 1
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 person P + 0 people
Male victim
X= 9
X= 8
X= 3
Female victim
X= 4
X= 4
X= 2
Chapter 17: Page 2
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 3
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 4
6
5
How do you feel right now?
5
4
Allergic?
3
3
No
3
Yes
2
1
1
0
No
Yes
Receive Anti-biotic
This illustrates an interaction
Chapter 17: Page 5
6
5
5
How do you feel right now?
5
4
Allergic?
3
3
No
3
Yes
2
1
0
No
Yes
Receive anti-biotic
If there were no interaction, then the graph would have looked
like this
Chapter 17: Page 6
Let’s return to our bystander intervention experiment:
P + 2 people P + 1 person P + 0 people
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 7
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 8
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 9
One way to understand main effects is to examine something
called marginal means
P + 2 people P + 1 person P + 0 people
Male victim
X= 9
Female victim
X= 4
X = 6.5
Marginal Means
Response time
for 3 bystanders,
averaging over
gender
(9 + 4) / 2 = 6.5
X= 8
X= 4
X
=6
X= 3
X= 2
X
Response time
for 2 bystanders,
averaging over
gender
(8 + 4) / 2 = 6
Marginal
Means
X
X
Response time for
male victims,
averaging over # of
bystanders
(9 + 8 + 3) / 3 =
6.67
= 6.67
= 3.33
= 2.5
Response time
for 1 bystander,
averaging over
gender
(3 + 2) / 2 = 2.5
Response time for
female victims,
averaging over # of
bystanders
(4 + 4 + 2) / 3 =
3.33
Chapter 17: Page 10
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 11
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 12
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
Male victim
X= 9
Female victim
X= 4
X = 6.5
Marginal Means
X= 8
X= 4
X
=6
X= 3
X= 2
X
= 2.5
Marginal Means
X
X
= 6.67
= 3.33
Overall: 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 13
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 14
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 15
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 16
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 17
ANOVA Table
Source
df
SS
MS
F
Gender
# of Bystanders
Interaction (G*B)
Error
Total
Chapter 17: Page 18
Calculations: Degrees of Freedom
N–1
dftotal =
(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 19
Calculations: Mean Squares
To find any MS, take the SS & divide by its corresponding df
MSGender
=
SS Gender
df Gender
SS Bys tan ders
MSBystanders
= df Bys tan ders
MSInteraction
=
SS Interaction
df Interaction
=
SS Error
df Error
MSError
Chapter 17: Page 20
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
FGender
=
MS Gender
MS Error
MS Bys tan ders
FBystanders
FInteraction
=
MS Error
=
MS Interaction
MS Error
Chapter 17: Page 21
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 22
Be twe en-S ubj ects Factors
Interpreting SPSS Output
N
Gender of
Vic tim
# of by standers
present
f
m
1.00
2.00
3.00
15
15
10
10
Main
effect of
gender
10
Tests of Between-Subjects Effects
Dependent Variable: How long do P wait to help?
Source
Corrected Model
Intercept
GENDER
BYSTAND
GENDER * BYSTAND
Error
Total
Corrected Total
Type III Sum
of Squares
200.000a
750.000
83.333
95.000
21.667
54.000
1004.000
254.000
df
5
1
1
2
2
24
30
29
a. R Squared = .787 (Adjus ted R Squared = .743)
Mean Square
40.000
750.000
83.333
47.500
10.833
2.250
F
17.778
333.333
37.037
21.111
4.815
Sig.
.000
.000
.000
.000
.017
Main effect
of
bystanders
Interaction
between
gender &
bystanders
Chapter 17: Page 23
Estimated Marginal Means
There was a
main effect
of gender, so
these means
differ
1. Gender of Victim
Dependent Variable: How long do P wait to help?
Gender of Victim
f
m
Mean
3.333
6.667
Std. Error
.387
.387
95% Confidence Interval
Lower Bound Upper Bound
2.534
4.133
5.867
7.466
2. # of bystanders pre sent
Dependent Variable: How long do P wait to help?
# of by standers present
1.00
2.00
3.00
Mean
2.500
6.000
6.500
St d. Error
.474
.474
.474
There was a
main effect
of bystander,
so there is a
difference
among these
means
95% Confidenc e Interval
Lower Bound Upper Bound
1.521
3.479
5.021
6.979
5.521
7.479
Chapter 17: Page 24
3. Gender of Victim * # of bystanders present
Dependent Variable: How long do P wait to help?
Gender of Victim
f
m
# of bys tanders pres ent
1.00
2.00
3.00
1.00
2.00
3.00
Mean
2.000
4.000
4.000
3.000
8.000
9.000
Std. Error
.671
.671
.671
.671
.671
.671
95% Confidence Interval
Lower Bound Upper Bound
.615
3.385
2.615
5.385
2.615
5.385
1.615
4.385
6.615
9.385
7.615
10.385
There was a significant
interaction, so the effect
of bystander depends
on the level of gender
Chapter 17: Page 25
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 multiplecomparison procedures (post-hocs) to determine which ones.
Can be obtained in SPSS
Chapter 17: Page 26
Post Hoc Tests: # of bystanders present
Multiple Com pari sons
Dependent Variable: How long do P wait to help?
LS D
(I) # of bys tanders
present
1.00
2.00
3.00
(J) # of bys tanders
present
2.00
3.00
1.00
3.00
1.00
2.00
Mean
Difference
(I-J)
St d. E rror
-3. 5000*
.6708
-4. 0000*
.6708
3.5000*
.6708
-.5000
.6708
4.0000*
.6708
.5000
.6708
Based on observed means.
*. The mean differenc e is significant at the .05 level.
Sig.
.000
.000
.000
.463
.000
.463
95% Confidenc e Interval
Lower Bound Upper Bound
-4. 8845
-2. 1155
-5. 3845
-2. 6155
2.1155
4.8845
-1. 8845
.8845
2.6155
5.3845
-.8845
1.8845
1 bystander
differs from
2
1 bystander
differs from
3
2 bystanders
DO NOT
differ from 3
Chapter 17: Page 27
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 28
You could graph the means two different ways:
Estimated Marginal Means of How long do P wait to help?
10
Estimated Marginal Means
8
6
4
# of bys tanders 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 29
Estimated Marginal Means of How long do P wait to help?
10
Estimated Marginal Means
8
6
4
Gender of Victim
2
f
0
1.00
m
2.00
3.00
# of bys tanders 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 30
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 31
Simple effects of gender at each level of bystander:
There is no difference in
response time for male and
female victims when only 1
bystander is present
Univariate Tests
Dependent Variable: How long do P wait to help?
# of bys tanders pres ent
1.00
2.00
3.00
Contrast
Error
Contrast
Error
Contrast
Error
Sum of
Squares
2.500
54.000
40.000
54.000
62.500
54.000
df
1
24
1
24
1
24
Mean Square
2.500
2.250
40.000
2.250
62.500
2.250
F
1.111
Sig.
.302
17.778
.000
27.778
.000
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 32
Simple effects of bystander at each level of gender:
Univa riate Te sts
Dependent Variable: How long do P wait to help?
Gender of Victim
f
Contrast
Error
m
Contrast
Error
Sum of
Squares
13.333
54.000
103.333
54.000
df
2
24
2
24
Mean Square
6.667
2.250
51.667
2.250
F
2.963
Sig.
.071
22.963
.000
Each F tes ts the s imple effects of # of bystanders present within eac h level c ombinat ion of the
other effec ts shown. These test s are based on t he linearly independent pairwise c omparis ons
among the estimat ed 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 33
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:
“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 34
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 35
ANOVA Table
Source
df
SS
Spokesperson
Color
200
150
Interaction (S*C)
Error
Total
50
MS
F
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 36
Source
df
SS
Spokesperson
Color
1
1
200
150
Interaction (S*C)
Error
Total
1
76
79
50
MS
F
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 37
Source
df
SS
Spokesperson
Color
1
1
200
150
Interaction (S*C)
Error
Total
1
76
79
50
450
850
SS spokesperson
MSSpokesperson = df spokesperson
MSInteraction =

200
 200
1
SS Interaction 50

 50
df Interaction
1
MS
MScolor =
MSError =
F
SScolor 150

 150
df color
1
SS Error 450

 5.92
df Error
76
Chapter 17: Page 38
Source
df
SS
MS
Spokesperson
Color
1
1
200
150
200
150
Interaction (S*C)
Error
Total
1
76
79
50
450
850
50
5.92
MS Spokesperson
FSpokesperson =
FInteraction
=
MS Error

200
 33.78
5.92
FColor =
F
MS Color 150

 25.34
MS Error 5.92
MS Interaction
50

 8.45
MS Error
5.92
Chapter 17: Page 39
Source
df
SS
MS
F
Spokesperson
Color
1
1
200
150
200
150
33.78
25.34
Interaction (S*C)
Error
Total
1
76
79
50
450
850
50
5.92
8.45
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 40
Download