N-way ANOVA
Two-factor ANOVA with equal replications
Experimental design: 2  2 (or 22)
factorial with n = 5 replicate
Total number of observations:
N = 2  2  5 = 20
Equal replications also termed
orthogonality
2
The hypothesis
H0: There is on effect of hormone treatment on the mean plasma concentration
H0: There is on difference in mean plasma concentration between sexes
H0: There is on interaction of sex and hormone treatment on the mean plasma
concentration
Why not just use one-way ANOVA with for levels?
3
How to do a 2-way ANOVA with equal replications
Calculating means
Calculate cell means:
X ab 

n
l 1
X abl
eg

n
5
l 1
X 11 l

16 ,3  20 , 4  12 , 4  15 ,8  9 ,5
5
 14 ,88
n
Calculate the total mean (grand mean)
X 
  
a
b
n
i 1
j 1
l 1
X ijl
 21 ,825
N
Calculating treatment means
X i 
 
b
n
j 1
l 1
bn
X ijl
eg X 1  13 ,5
4
How to do a 2-way ANOVA with equal replications
Calculating general Sum of Squares
Calculate total SS:
total SS 
   X
a
b
n
i 1
j 1
l 1
ijl
 X

2
 1762 , 7175
total DF  N  1  19
Calculate the cell SS
cells SS  n 
a
i 1
 X
b
j 1
ij

 1461 ,3255
i 1
  X
 X
2
cells DF  ab  1  3
Calculating treatment error SS
within
- cells (error) SS  n 
within
- cells (error) DF  ab  n  1   16
a
b
n
j 1
l 1
 X ij   301 , 3920
2
ijl
5
How to do a 2-way ANOVA with equal replications
Calculating factor Sum of Squares
Calculating factor A SS:
factor A SS  bn 
a
i 1
X
i
 X

 X

2
 1386 ,1125
factor A DF  a  1  1
Calculating factor B SS
factor B SS  an 
b
j 1
X
j
2
 70 ,3125
factor B DF b  1  1
Calculating A  B interaction SS
A  B interaction SS = cell SS – factor A SS – factor B SS = 4,9005
A  B DF = cell DF– factor A DF – factor B DF = 1
6
How to do a 2-way ANOVA with equal replications
Summary of calculations
7
How to do a 2-way ANOVA with equal replications
Hypothesis test
H0: There is on effect of hormone treatment on the
mean plasma concentration
F = hormone MS/within-cell MS =
1386,1125/18,8370 = 73,6
F0,05(1),1,16 = 4,49
H0: There is on difference in mean plasma
concentration between sexes
F = sex MS/within-cell MS = 3,73
F0,05(1),1,16 = 4,49
H0: There is on interaction of sex and hormone
treatment on the mean plasma concentration
F = A  B MS/within-cell MS = 0,260
F0,05(1),1,16 = 4,49
8
Visualizing 2-way ANOVA
Table 12.2 and Figure 12.1
9
2-way ANOVA in SPSS
10
2-way ANOVA in SPSS
Click Add
11
Visualizing 2-way ANOVA without interaction
12
Visualizing 2-way ANOVA with interaction
13
2-way ANOVA
Random or fixed factor
Random factor: Levels are selected at random…
Fixed factor: The ’value’ of each levels are of interest and selected on purpose.
14
2-way ANOVA
Assumptions
•
•
•
Independent levels of the each factor
Normal distributed numbers in each cell
Equal variance in each cell
• Bartletts homogenicity test (Section 10.7)
• s2 ~ within cell MS;  ~ within cell DF
•
•
•
The ANOVA test is robust to small violations of the assumptions
Data transformation is always an option (see chpter 13)
There are no non-parametric alternative to the 2-way ANOVA
15
2-way ANOVA
Multiple Comparisons
Multiple comparesons tests ~ post hoc tests can be used as in one-way ANOVA
Should only be performed if there is a main effect of the factor and no interaction
16
2-way ANOVA
Confidence limits for means
95 % confidence limits for calcium concentrations on in birds without hormone
treatment
s
95 % CI  X 1  t 0 , 05 ( 2 ),
2
bn
  within  cell DF; s  within  cell MS
2
17
2-way ANOVA
With proportional but unequal replications
Proportional replications:
n ij 
# row i  # col j 
N
18
2-way ANOVA
With disproportional replications
Statistical packges as SPSS has porcedures for estimating missing values and correcting
unballanced designs, eg using harmonic means
Values should not be estimated by simple cell means
Single values can be estimated, but remember to decrease the DF
Xˆ ijl 
aA i  bB j 
  
a
b
n ij
i 1
j 1
l 1
X ijl
N 1 a  b
19
2-way ANOVA
With one replication
Get more data!
20
2-way ANOVA
Randomized block design
21
3-way ANOVA
22
3-way ANOVA
H0: The mean respiratory rate is the same for all species
H0: The mean respiratory rate is the same for all temperatures
H0: The mean respiratory rate is the same for both sexes
H0: The mean respiratory rate is the same for all species
H0: There is no interaction between species and temperature across both sexes
H0: There is no interaction between species and sexes across temperature
H0: There is no interaction between sexes and temperature across both spices
H0: There is no interaction between species, temperature, and sexes
23
3-way ANOVA
Latin Square
24
Exercises
12.1, 12.2, 14.1, 14.2
25