Title: TWO WAY ANOVA
1TWO WAY ANOVA
2Two way ANOVA -analyses the results of an
experimental design that combines the effects of
two independent variables
Variable 1 (Factor 1)
Levels of factor
Variable 2 (Factor 2)
Levels of factor
3Two way ANOVA -analyses the results of an
experimental design that combines the effects of
two independent variables
Factor 1 - time
Levels of factor
Factor 2 (Hormone treatment)
Levels of factor
4- Advantages of Two Way ANOVA
- Save on number of subjects used (ethical and
financial benefits) - Experimental control
- Examine interaction between factors
5Main Effects vs Interactions
6Main Effects vs Interactions
Examine effects of treatments - in our case age
and hormone level
7Main Effects vs Interactions
Examine effects of treatments - in our case age
and hormone level
Examine effects of the effect of one treatment
depending on the level of the second
8To put this in our flow chart
Total variability
Between treatment variability
- Within treatment variability
- Individual differences
- Experimental error
Factor A Factor B Interaction variability
variability variability
9Examples of Interactions
-hormone increases gonad wt. but the increases
over time are the same
1) Hormone effect and no interaction
wt
time
10Examples of Interactions
-hormone increases gonad wt. but the increases
over time are the same
1) Hormone effect and no interaction
wt
time
-increase in weight with age but a greater
increase with hormone
2) Hormone effect and interaction
wt
time
11Examples of Interactions
-hormone increases gonad wt. but the increases
over time are the same
1) Hormone effect and no interaction
wt
time
-increase in weight with age but a greater
increase with hormone
2) Hormone effect and interaction
wt
time
3) No hormone effect and an interaction
-effect of hormone depends on group being examined
wt
time
12Hypotheses of Two Way ANOVA
- Main effect of factor A
- H0 m A1 m A2 m A3
- H1 m A1 ? m A2 ? m A3
13Hypotheses of Two Way ANOVA
- Main effect of factor A
- H0 m A1 m A2 m A3
- H1 m A1 ? m A2 ? m A3
2) Main effect of factor B H0 m B1 m B2
m B3 H1 m B1 ? m B2 ? m B3
14Hypotheses of Two Way ANOVA
- Main effect of factor A
- H0 m A1 m A2 m A3
- H1 m A1 ? m A2 ? m A3
2) Main effect of factor B H0 m B1 m B2
m B3 H1 m B1 ? m B2 ? m B3
3) A X B interaction H0 no interaction
between B and A H1 interaction between B and A
15General Design of a Two Factor Experiment
Factor B
Factor A
16A Real(-ish) Experiment
Looked at testes weights of two species of
intertidal tunicates at different directional
exposures (north, south and west)
North
West
South
17Collect 5 animals at each site, dissect their
gonads and weigh them
Record data
18North South West B1 B2 B3
Species 1 1 7 3 A1 6 7 1 1 11 1 SA1
60 1 4 1 1 6 4 SA1B1 10 SA1B2
35 SA1B3 15 SS 20 SS 26 SS
18 Species 2 0 0 0 A2 3 5 2 7 0 0 SA2
30 5 0 0 5 0 3 SA1B1 20 SA1B1
5 SA1B1 5 SS 28 SS 20 SS 8 SB1
30 SB2 40 SB3 20 N 30, SX 90, SX2
520
19North South West B1 B2 B3
Species 1 1 7 3 A1 6 7 1 1 11 1 SA1
60 1 4 1 1 6 4 SA1B1 10 SA1B2 35 SA1B3
15 SS 20 SS 26 SS 18 Species
2 0 0 0 A2 3 5 2 7 0 0 SA2 30 5 0 0 5 0 3 S
A1B1 20 SA1B1 5 SA1B1 5 SS 28 SS 20 SS
8 SB1 30 SB2 40 SB3 20 N 30, SX
90, SX2 520
Now - we need to compute several sums of squares
1. TOTAL SS
- Total SS SS total SX2 - (SX)2 520 -
902 250 N 30
20North South West B1 B2 B3
Species 1 1 7 3 A1 6 7 1 1 11 1 SA1
60 1 4 1 1 6 4 SA1B1 10 SA1B2 35 SA1B3
15 SS 20 SS 26 SS 18 Species
2 0 0 0 A2 3 5 2 7 0 0 SA2 30 5 0 0 5 0 3 S
A1B1 20 SA1B1 5 SA1B1 5 SS 28 SS 20 SS
8 SB1 30 SB2 40 SB3 20 N 30, SX
90, SX2 520
Now - we need to compute several sums of squares
1. WITHIN TREATMENTS (SITES) SS
SSwithin SSS within each treatment cell 20
26 18 28 20 8 120
21North South West B1 B2 B3
Species 1 1 7 3 A1 6 7 1 1 11 1 SA1
60 1 4 1 1 6 4 SA1B1 10 SA1B2 35 SA1B3
15 SS 20 SS 26 SS 18 Species
2 0 0 0 A2 3 5 2 7 0 0 SA2 30 5 0 0 5 0 3 S
A1B1 20 SA1B1 5 SA1B1 5 SS 28 SS 20 SS
8 SB1 30 SB2 40 SB3 20 N 30, SX
90, SX2 520
Now - we need to compute several sums of squares
- BETWEEN TREATMENTS (SITES) SS
S(X2) - (SX)2 n N
SSbetween
Which, in a 2-way, design becomes
S(AB2) - (SX)2 n N
SSbetween
SSbetween 102 352 152 202 52 5 2 -
902 400 - 270 130 5 5 5
5 5 5 30
(As a check, SStotal SSbetween Sswithin or
250 130 120)
22This ends the first level of analysis
Total variability
Between treatment variability
- Within treatment variability
- Individual differences
- Experimental error
Factor A Factor B Interaction variability
variability variability
23Second level of analysis
Total variability
Between treatment variability
- Within treatment variability
- Individual differences
- Experimental error
Factor A Factor B Interaction variability
variability variability
Now we need to partition the between treatment
variability into A, B and A x B
24North South West B1 B2 B3
Second level of analysis
Species 1 1 7 3 A1 6 7 1 1 11 1 SA1
60 1 4 1 1 6 4 SA1B1 10 SA1B2 35 SA1B3
15 SS 20 SS 26 SS 18 Species
2 0 0 0 A2 3 5 2 7 0 0 SA2 30 5 0 0 5 0 3 S
A1B1 20 SA1B1 5 SA1B1 5 SS 28 SS 20 SS
8 SB1 30 SB2 40 SB3 20 N 30, SX
90, SX2 520
SS Factor A
SSFactor A A2- (SX)2 n N
602 302 - 902 240 60 - 270 30
15 15 30
S
25North South West B1 B2 B3
Second level of analysis
Species 1 1 7 3 A1 6 7 1 1 11 1 SA1
60 1 4 1 1 6 4 SA1B1 10 SA1B2 35 SA1B3
15 SS 20 SS 26 SS 18 Species
2 0 0 0 A2 3 5 2 7 0 0 SA2 30 5 0 0 5 0 3 S
A1B1 20 SA1B1 5 SA1B1 5 SS 28 SS 20 SS
8 SB1 30 SB2 40 SB3 20 N 30, SX
90, SX2 520
SS Factor B
SSFactor B B2- (SX)2 n N
302 402 202 - 902 90 160 40 - 270
20 10 10 10 30
S
26North South West B1 B2 B3
Second level of analysis
Species 1 1 7 3 A1 6 7 1 1 11 1 SA1
60 1 4 1 1 6 4 SA1B1 10 SA1B2 35 SA1B3
15 SS 20 SS 26 SS 18 Species
2 0 0 0 A2 3 5 2 7 0 0 SA2 30 5 0 0 5 0 3 S
A1B1 20 SA1B1 5 SA1B1 5 SS 28 SS 20 SS
8 SB1 30 SB2 40 SB3 20 N 30, SX
90, SX2 520
SS Interaction
Total variability
- Within treatment variability
- Individual differences
- Experimental error
Between treatment variability
Factor A Factor B Interaction variability
variability variability
We have just calculated these two
So,
SSinteraction SSA x B SSBetweem - SSFactor
A - SSFactor B 130 - 30 - 20 80
27So far ..
Total variability 250
Between treatment variability 130
Within treatment variability 120
Factor A Factor B Interaction variability
variability variability 30 20 80
28And now ---Degrees of freedom
Total variability 250
df N - 1 29
Between treatment variability 130
Within treatment variability 120
Factor A Factor B Interaction variability
variability variability 30 20 80
29And now ---Degrees of freedom
Total variability 250
dftotal N - 1 29
Between treatment variability 130
Within treatment variability 120
dfwithin S (n - 1) (5-1)x 6 24
Factor A Factor B Interaction variability
variability variability 30 20 80
30And now ---Degrees of freedom
Total variability 250
dftotal N - 1 29
Between treatment variability 130
Within treatment variability 120
dfwithin S (n - 1) (5-1)x 6 24
dfbetween number of cells - 1 5
Factor A Factor B Interaction variability
variability variability 30 20 80
31And now ---Degrees of freedom
Total variability 250
dftotal N - 1 29
Between treatment variability 130
Within treatment variability 120
dfwithin S (n - 1) (5-1)x 6 24
dfbetween number of cells - 1 5
Factor A Factor B Interaction variability
variability variability 30 20 80
dfA levels of A - 1 1
32And now ---Degrees of freedom
Total variability 250
dftotal N - 1 29
Between treatment variability 130
Within treatment variability 120
dfwithin S (n - 1) (5-1)x 6 24
dfbetween number of cells - 1 5
Factor A Factor B Interaction variability
variability variability 30 20 80
dfA levels of A - 1 1
dfA levels of B - 1 2
33And now ---Degrees of freedom
Total variability 250
dftotal N - 1 29
Between treatment variability 130
Within treatment variability 120
dfwithin S (n - 1) (5-1)x 6 24
dfbetween number of cells - 1 5
Factor A Factor B Interaction variability
variability variability 30 20 80
dfA levels of A - 1 1
dfA levels of B - 1 2
dfA x B dfbetween - dfA - dfB 5 - 2 -
1 2
34Calculation of MS values (finally!!)
FA MSA 30 6 MSwithin 5
MSA 30 30 1
Denominator for each F ratio is
MSwithin Mswithin 120 5 24
FB MSB 10 2 MSwithin 5
MSB 20 10 2
FAxB MSAxB 40 8
MSwithin 5
MSA x B 80 40 2
FA 6 Fcrit(.05, 30, 5) 4.26 Since 6 gt 4.26,
p lt .05
FB 2 Fcrit(.05, 10, 5) 3.40 Since 2 lt 3.40,
p gt .05
FAxB 8 Fcrit(.05, 40, 5) 6.18 Since 8 gt 6.18,
p lt .05
35Calculation of MS values (finally!!)
FA MSA 30 6 MSwithin 5
MSA 30 30 1
Denominator for each F ratio is
MSwithin Mswithin 120 5 24
FB MSB 10 2 MSwithin 5
MSB 20 10 2
FAxB MSAxB 40 8
MSwithin 5
MSA x B 80 40 2
FA 6 Fcrit(.05, 30, 5) 4.26 Since 6 gt 4.26,
p lt .05
FB 2 Fcrit(.05, 10, 5) 3.40 Since 2 lt 3.40,
p gt .05
FAxB 8 Fcrit(.05, 40, 5) 6.18 Since 8 gt 6.18,
p lt .05
36What does this mean?
- The effect of A (species) is significant.
- This means that the two species show different
gonad weights
2) The effect of B (exposure) is not significant.
This means that there is no overall difference
in gonad weights between the sites
3) The interaction between species (A) and
exposure (B) is significant. This means that
species are reacting differently to each site.