factorial anova!. we can (and often do) conduct experiments or investigations in which there is...
TRANSCRIPT
More than one Factor?
Factorial ANOVA!
We can (and often do) conduct experiments or investigations in which there is more than one factor (i.e., independent or quasi-independent variable). ◦ Recall, in a One-way ANOVA, we have…◦ one Independent Variable (i.e., one manipulated by the
experimenter) or ◦ one Quazi-Independent Variable (i.e., a variable that is
accounted for by the experimenter, but is not actually manipulated).
Now, with a Factorial ANOVA, we have ◦ 2 or more independent variables, ◦ 2 or more quasi-independent variables, or ◦ a combination of each.
Factors
Just line a one-way ANOVA, each factor can have 2 or more levels◦ Gender: pre-existing group (quasi-independent
variable) with 2 levels.◦ Video-taped confession: might have 3 levels –
focused on the confessor, focused on the interrogator, or focused on both. Because the experimenter can manipulate this, this is an
independent variable.◦ Message position: might have 2 levels – agreeable
message vs. attitude inconsistent message. Because the experimenter can manipulate this, this is an
independent variable.
Levels
We might want to investigate if participants will help more or less depending on their gender and whether or not they are alone. ◦ Gender is a quasi-independent variable with 2
levels. ◦ The experimenter can manipulate whether the
participant is alone or in a group, so this is an independent variable with 2 levels.
Simplest type of Factorial ANOVA is often called a 2x2 ANOVA. This is a 2x2.
Simple example 1
We might want to investigate if participants will help more or less depending on their mood and whether or not the helping task is enjoyable. ◦ If mood is manipulated by the experimenter (e.g., have
people watch a happy, sad, or neutral video clip), mood is an independent variable with 3 levels.
◦ The experimenter can manipulate whether the helping task is enjoyable (e.g., proofreading a funny article or a dull article), so this is an independent variable with 2 levels.
This experiment has 2 factors, one with 2 levels and one with 3 levels.◦ This is a 2x3 ANOVA
Simple example 2
How many factors can we have? How many levels can we have? When does this become too much for our
brain to handle?◦ 3-4 factors is about as far as we can go before our
brains hemorrhage, so be careful . Example of 3 factors, each with 2 levels.
◦ 2 (Social Status: control vs. excluded) x 2 (Emotion: H vs. S) x 2 (Task: F vs. B).
Science is not always simple
Our factors and levels are INDEPENDENT. # conditions = (# levels in factor 1) x…x (#
levels in last factor). Each of these conditions are independent.
Things to note
Simplest factorial ANOVA is a 2x2 (2 factors each with 2 levels). ◦ Actually, a 2-factor ANOVAs are all simple relative
to 3+ factor ANOVAs.◦ So, lets there.
Start out simple
Set up: Is methamphetamine neuro-protective following ischemic stroke when compared to no-stroke conditions?◦ Neuro-protective is operationalized as low-normal
activity (damage is indicated by more activity). Design: Rats get a surgery that induces
stroke or not, then they receive an injection that contains methamphetamine or saline.◦ 2 (Surgery: stroke v. sham) x 2 (Injection: meth v.
saline)
Full Example 1: 2x2
A one-way ANOVA tests for one set of mean differences. ◦ Tests whether at least one mean differed from
another when we had 1 factor with 2 or more levels
The 2 Factor ANOVA tests 3 separate sets of mean differences.
Recall:◦ DV: Activity level◦ Factor A: Surgery (stroke v. sham)◦ Factor B: Injection (meth v. saline)
What does a 2-Factor ANOVA test?
1) Mean differences in activity level between surgery (stroke v. sham)
2) Mean differences in activity level between injection (meth v. saline)
3) Mean differences in activity level that result from a combination of surgery and injection.
So, 3 tests are combined into one analysis. We will have 3 f-ratios.
The 2 Factor ANOVA tests:
As usual, there will be variance attributable to differences between our groups (conditions) in the numerator of our F-ratio and variance attributable to chance in the denominator.
The primary difference between our 3 f-ratios is what goes into the numerator…◦ the variance due to our first factor, ◦ the variance due to our second factor, or ◦ the variance due to our the combination of our 2
factors.
What do these F-ratios look like?
The mean difference among levels of a factor is called a Main Effect. ◦ In determining whether there is a difference
between stroke and sham groups on activity level, we are testing for a “main effect of surgery.” Regardless of the injection rats received, is there a
difference among the levels in surgery?◦ In determining whether there is a difference
between meth and saline groups on activity level, we are testing for a “main effect of injection.” Regardless of the surgery rats received, is there a
difference among the levels in injection?
Main Effects: Tests of each Factor
For Factor A (Surgery)◦ Ho: µA1 = µA2 OR µstroke = µsham
◦ Ha: µA1 does not = µA2 OR
◦ µstroke does not = µsham
Conceptually: F = (the variance due to difference between
the means for Surgery)/the variance due to chance
Null and Alternative Hypotheses for Main Effects
For Factor A (Injection)◦ Ho: µB1 = µB2 OR µmeth = µsaline
◦ Ha: µB1 does not = µB2 OR
◦ µmeth does not = µsaline
Conceptually: F = (the variance due to difference between
the means for Injection)/the variance due to chance
Null and Alternative Hypotheses for Main Effects
We might have overall main effects of our factors, but we can also have variability due to the combination of our factors. ◦ That is, our 2 factors in combination can interact
to produce effects beyond those we see just by looking at main effects. An interaction is defined as – mean differences
between conditions that are different from what would be predicted from the overall main effects of the factors. In other words, observed differences beyond possible main effects.
Interactions
stroke sham
meth 3 5 4
saline 8 5 6.5
5.5 5
More than main effects
stroke sham
meth 3 8 5.5
saline 8 3 5.5
5.5 5.5
Ho: There is no interaction between mood and task. All mean differences are explained by the main effects of mood and task.
Ha: There is an interaction between mood and task. The mean differences between conditions is not what would be predicted from the overall main effects of mood and task.
Conceptually: F = (the variance not explained by main effects)/ the variance due to chance
Null and Alternative Hypotheses for Interactions
If the effect on the DV from one factor does not influence the effect on the DV from second factor, there will be no interaction.
If the effect on the DV from one factor does influence the effect on the DV from second factor another, there is an interaction.
If the effect of one factor on the DV depends on the levels of the other factor: INTERACTION.
Interactions…
We are going to calculate SSt and SSw/e and SSB the same way!
Now, we are going to break up SSb into SSfor factor A
SSfor factor B
And Ssinteraction
We are going to require data now…
Basics about computing a 2-Factor ANOVA
(Stroke v. Sham) X (Meth v Saline)
Actual research participant.
The Data Stroke and Meth (1):
Sum (X1)= 49; mean1 = 4.08; Sum (X12) = 215; n1 = 12
Stroke and Saline(2): Sum (X2)= 94; mean2 = 7.83; Sum (X2
2) = 750; n2 = 12
Sham and Meth (3): Sum (X3)= 46; mean3 = 3.83; Sum (X3
2) = 190; n3 = 12
Sham and Saline (4): Sum (X4)= 40; mean4 = 3.33; Sum (X4
2) = 142; n4 = 12
Overall values (across groups): Sum (Xoverall )= 229; Grand mean = 4.77; Sum (Xoverall
2) = 1297; N = 48; k = ??
…then break it into two components just like before:
SSTOTAL =
= (1297-[2292/48]) = 204.479
SStotal = SSbetween + SSwithin
Again, dftotal = N – 1 = 48– 1 = 47.
1) Find the total variability
TOT
TOTTOT
N
XX
22 )(
Again, SSwithin = SSerror =
(215 – [492]/12)+(750– [942]/12)+(190– [462]/12)+(142– [402]/12) = 50.917
Again, dfwithin/error = N – k = 48 – 4 = 44
OK, so, SSb = 204.479 – 50.917 = 153.562
2) Find the within group variability
k
kk n
XX
n
XX
n
XX
22
2
222
21
212
1
)((...)
)(()
)((
Again, SSbetween/group =
([492]/12)+([942]/12)+([462]/12)+([402]/12)-([2292]/48) = 153.562!!!
Again, dfbetween/group = k-1 =4-1 = 3
OK, so, NOW we need to do something NEW!!◦ Break up SSb =into its constituent parts.
3) Find the between-group variability
TOT
TOT
k
k
N
X
n
X
n
X
n
X 22
2
22
1
21 )()(
...)()(
SSfactor A (Surgery) =
([49+94]2/24)+([46+40]2/42)-([2292]/48) = 67.687
df factor A (Surgery) = (Levels in factor A) – 1 = 1
4) Find the between-group variability for Factor A (Surgery).
TOT
TOT
aa N
X
n
Xa
n
Xa 2
2
22
1
21 )()()(
SSfactor B (Injection) =
([49+46]2/24)+([94+40]2/42)-([2292]/48) = 31.687
df factor B (Injection) = (Levels in factor B) – 1 = 1
5) Find the between-group variability for Factor B (Injection).
TOT
TOT
bb N
X
n
Xb
n
Xb 2
2
22
1
21 )()()(
SSinteraction = SSB–(SSfactor A + SSfactor B )= 54.188
([49+40]2/24)+([46+94]2/42)-([2292]/48) = 54.18
Similarly, dfA x B interaction = dfbetween - dffactor
A - dffactor B
◦ dfA x B interaction = 3 – 1 – 1 = 1
6) Find the between-group variability for the Interaction.
TOT
TOT
baba N
X
n
XbXa
n
XbXa 2
12
212
21
221 )()()(
MSfactor A = SSfactor A/ dffactor A= 67.687 MSfactor B = SSfactor B/ dffactor B = 31.687 MSA x B interaction = SSA x B interaction / dfA x B
interaction= 54.188
MSwithin = SSwithin / dfwithin = 50.917/447 =1.157
7&8) Find the MS for your 2 main effects, interaction, and MSw.
Ffactor A= MSfactor A/ MSwithin = 67.687/1.157 = 58.493
Ffactor B = MSfactor B/ MSwithin = 31.687/1.157 = 27.383
FA x B interaction = MSA x B interaction / MSwithin = 54.188/1.157 = 46.827
Weeeeeeeee! Let’s check out SPSS
9) Compute Fs!!!
Condition
Main Effect ofSurgery
Main Effect of Injection
Interaction
Surgery Injection
1 Stroke Meth 1 -1 -1
2 Stroke Saline 1 1 1
3 Sham Meth -1 -1 1
4 Sham Saline -1 1 -1
Looking at Contrasts: What are the Fs testing?
Stroke Sham0
20
40
60
80
100
MethSaline
This is the same experiment, same data, same everything. But, I have recorded Gerbil gender as a quazi-independent variable.
What is our design now?
2x2x2 = gender x surgery x injection 3 factors:
◦ A = Gender◦ B = Surgery◦ C = Injection
OK, lets add a Factor…Gender!This also Applies to adding levels.
Calculations of:◦ SStot, SSbetween/group, SSwithin/error are all the same.
What is different?◦ We must break up SSbetween/group into more parts.
◦ What are they?
What is the same?
Female
X1 X12 Mea
nn Male X1 X1
2 Mean
n
StrokeMeth (1)
24 106 4 6 StrokeMeth (5)
25 109 4.17 6
StrokeSaline (2)
51 435 8.5 6 StrokeSaline (6)
43 315 7.17 6
Sham Meth(3)
23 93 3.83 6 Sham Meth(7)
23 97 3.83 6
Sham Saline(4)
20 74 3.33 6 Sham Saline(8)
20 68 3.33 6
Data broken up by Gender
Main effects◦ SSsurgery, SSinjection like before, but also…
◦ Ssgender now because we have an additional factor. ◦ Ok, that covers the Main effects. What else is there?
2-way Interactions (involving just 2 factors).◦ SSsxi (as before), but also: SSgxs and SSgxi
New: 3-way interaction (all 3 factors) SSgxsxi
Breaking up SSbetween/group
…then break it into two components just like before:
SSTOTAL =
= (1297-[2292/48]) = 204.479
SStotal = SSbetween + SSwithin
Again, dftotal = N – 1 = 48– 1 = 47.
1) Find the total variability
TOT
TOTTOT
N
XX
22 )(
Again, SSwithin = SSerror =
But, now we have 8 (not 4) groups◦ (106– [242]/6)+(435– [512]/6)+(93– [232]/6)+(74– [202]/6)+
(109– [252]/6)+(315– [432]/6)+(97– [232]/6)+(68– [202]/6) = 45.5
◦ This is a different number than we had before; why?
Again, dfwithin/error = N – k = 48 – 8 = 40
OK, so, SSb = 204.479 – 45.5 = 158.979
2) Find the within group variability
k
kk n
XX
n
XX
n
XX
22
2
222
21
212
1
)((...)
)(()
)((
Again, SSbetween/group =
Again, we have 8 groups now, so…◦ ([242]/6)+([512]/6)+([232]/6)+([212]/6)+([252]/6)+
([432]/6)+([232]/6)+([202]/6)-([2292]/48) = 158.9799!!!
Again, dfbetween/group = k-1 =8-1 = 7
OK, so, NOW we need to…◦ Break up SSb =into its constituent parts.
3) Find the between-group variability
TOT
TOT
k
k
N
X
n
X
n
X
n
X 22
2
22
1
21 )()(
...)()(
SSfactor A (Gender) =
([24+51+23+20]2/24)+([25+43+23+20]2/24)-([2292]/48) = 1.021
df factor A (gender) = (Levels in factor A) – 1 = 1
4) Find the between-group variability for Factor A (GENDER).
TOT
TOT
aa N
X
n
Xa
n
Xa 2
2
22
1
21 )()()(
SSfactor B (Surgery) =
([24+51+25+43]2/24)+([23+20+23+20]2/24)-([2292]/48) = 67.687
df factor B (Surgery) = (Levels in factor B) – 1 = 1
5) Find the between-group variability for Factor B (Surgery).
TOT
TOT
bb N
X
n
Xb
n
Xb 2
2
22
1
21 )()()(
SSfactor C (Injection) =
([24+23+25+23]2/24)+([51+20+43+20]2/42)-([2292]/48) = 31.687
df factor C (Injection) = (Levels in factor C) – 1 = 1
6) Find the between-group variability for Factor C (Injection).
TOT
TOT
cc N
X
n
Xc
n
Xc 2
2
22
1
21 )()()(
SSaxb = SSAB–(SSfactor A + SSfactor B )◦ SSAB is looking at 4 groups collapsing across Injection.
SSAB =
([24+51]2/12)+([23+20]2/12)+([25+43]2/12)+([23+20]2/12)-([2292]/48) = 69.72◦ So, SSaxb = 69.72- (1.021+67.688) = 1.021
dfA x B interaction = (dffactor A )( dffactor B)◦ dfA x B interaction = 1x1= 1
7a) Find the between-group variability for the Interactions.
TOT
TOT
bababa N
X
n
bXa
n
bXa
n
bXa
bna
bXa 22
222
122
21
21
211 )()()()()(
221221
SSaxc = SSAC–(SSfactor A + SSfactor C ) SSAC is looking at 4 groups collapsing across Surgery.
SSAC =
dfA x C interaction = (dffactor A )( dffactor C)◦ dfA x C interaction = 1x1= 1
7b) Find the between-group variability for the Interactions.
TOT
TOT
cacaca N
X
n
cXa
n
cXa
n
cXa
cna
cXa 22
222
122
21
21
211 )()()()()(
221221
SSbxc = SSBC–(SSfactor B + SSfactor C ) SSBC is looking at 4 groups collapsing across Gender.
SSBC =
dfB x C interaction = (dffactor B )( dffactor C)◦ dfB x C interaction = 1x1= 1
7c) Find the between-group variability for the Interactions.
TOT
TOT
cbcbcb N
X
n
cXb
n
cXb
n
cXb
cnb
cXb 22
222
122
21
21
211 )()()()()(
221221
SSaxbxc = SSBetween – (SSaxb + SSaxc + SSbxc + SSfactor A + SSfactor B + SSfactor C )
dfA x B x C interaction = (dffactor A )(dffactor B )( dffactor C)
◦ dfAxBxC interaction = 1x1x1= 1
8) Find the b-g variability for the 3-way Interaction.
TOT
TOT
cbcbcb N
X
n
cXb
n
cXb
n
cXb
cnb
cXb 22
222
122
21
21
211 )()()()()(
221221
Main effects◦ MSfactor A = SSfactor A/ dffactor A
◦ MSfactor B = SSfactor B/ dffactor B
◦ MSfactor C = SSfactor C/ dffactor C
2-way Interactions◦ MSA x B interaction = SSA x B interaction / dfA x B interaction
◦ MSA x C interaction = SSA x C interaction / dfA x C interaction
◦ MSB x C interaction = SSB x C interaction / dfB x C interaction
3-way Interaction MSAxBx C interaction = SSAxBx C interaction / dfAxBx C interaction
MSwithin = SSwithin / dfwithin
9) Find the MSs
F = MSb/MSw for each Main effect and interaction.
Let’s check out SPSS
10) 7 Compute Fs!!!
The Surgery x Injection interaction is significant. Sweet. Now what?
We can “decompose this interaction in several ways to determine which means are different from which within that interaction.
Post-hoc tests: like Tukey and Sheffe, etc.◦ Generally, these are ok for exploratory purposes.
Simple effects tests Planned Comparisons/contrasts
Waa hoo! We have Interactions
One way to do this is by doing a “Simple Effect” test. This looks at the main effect of one factor at each level of the other factor.◦ These are nice because they help control Type 1
error.◦ Because the overall MSWE is in the denominator.
What does the equation look like? Any F really. Let’s break down the SxI
interaction…
Simple Effects Tests
Simple Effect of Injection within Stroke Conditions.
)(
2)(
)(2
2)(2
)(1
2)(1 )()()(
strokeTOT
strokeTOT
strokec
stroke
strokec
stroke
N
X
n
Xc
n
Xc SSfactor C/Injection (stroke only) =
([24+25]2/12)+([51+43]2/12)-([1432]/24) = 200.08+736.33-852.04 = 84.375
df factor C/Injection (stroke only) = (Levels in factor C) – 1 = 1
MSfactor C/Injection (stroke only) = SSfactor C/Injection
(stroke only) /Dffactor C/Injection (stroke only)
Ffactor C/Injection (stroke only) =MSfactor C/Injection
(stroke only) /MSW/E = 84.375/1.137 = 74.176
The factorial ANOVA is not necessarily testing the interaction patterns you are predicting.
You can test for specific, predicted, interaction patterns even if the ANOVA says an interaction is not significant.
What is it testing (at least with a 2x2x2)?
Lets think about Contrasts
Cond(F)
MEGen
ME Surg
ME Inj
GxSInt
GxIInt
SxIInt
GxSxIInt
Surg
Inj
1 Str Meth 1 1 -1 1 -1 -1 -1
2 Str Sal 1 1 1 1 1 1 1
3 Sh Meth 1 -1 -1 -1 -1 1 1
4 Sh Sal 1 -1 1 -1 1 -1 -1
Looking at Contrasts: What are the Fs testing (in a 2x2x2)?
Cond(M)
MEGen
ME Surg
ME Inj
GxSInt
GxIInt
SxIInt
GxSxIInt
Surg
Inj
1 Str Meth -1 1 -1 -1 1 -1 1
2 Str Sal -1 1 1 -1 -1 1 -1
3 Sh Meth -1 -1 -1 1 1 1 -1
4 Sh Sal -1 -1 1 1 -1 -1 1
Each contrast gives us a t-value testing for a main effect or an interaction.◦ Each t2 corresponds to an F testing for that same
thing. The if we sum all the and divide by 7 (i.e.,
take an average), we get the omnibus F-value testing for an overall difference among all the conditions.
That is, we get the F for MSbetween/MSwithin/error
Check it!
About these contrasts
The omnibus interaction is testing for two opposite crossover interactions. What if you predicted something different?
1 crossover and 1 no interaction 1 fan and one opposite fan Etc.
You predicted a different 3-way
Stroke Sham0
1
2
3
4
5
6
7
8
9
MethSaline
Females Males
Stroke Sham0
1
2
3
4
5
6
7
8
MethSaline
Cond(F)
Surg
Inj
1 Str Meth -1 0 -1
2 Str Sal 1 0 1
3 Sh Meth 1 -1 0
4 Sh Sal -1 1 0
Other Contrasts
Cond(M)
Surg
Inj
1 Str Meth 0 -1 0
2 Str Sal 0 1 0
3 Sh Meth 0 0 -1
4 Sh Sal 0 0 1
We can use d or g in comparing two means.◦ Mean difference/Grand SD
For interactions, we can use partial eta squared or Omega squared.
Effect Sizes
Omega Squared is better