MAP 716 Lecture 2 Two Way Anova
MAP 716 Lecture 2 Two Way Anova
1
12/05/2023
Hypotheses
Factors
• There are three sets of hypothesis with the two-
way ANOVA. • The two independent variables in a two-way
ANOVA are called factors. The idea is that there
• The null hypotheses for each of the sets: are two variables, factors, which affect the
• The population means of the first factor are equal. This
is like the one-way ANOVA for the row factor. dependent variable.
• The population means of the second factor are equal. • Each factor will have two or more levels within
This is like the one-way ANOVA for the column it, and the degrees of freedom for each factor is
factor.
• There is no interaction between the two factors. This is
one less than the number of levels.
similar to performing a test for independence with
contingency tables.
MAP 716: Biostatistics II and Computting by MAP 716: Biostatistics II and Computting by
9 10
Dr As Lakati Dr As Lakati
EXAMPLE: Suppose we want to compare the cholesterol contents of four Two-Way ANOVA table
competing diet foods on the basis results three labs
Source of Variation SS df MS F
Diet food A 3.6 4.1 4.0 Main Effect B given B, SS / df MS(B) / MS(W)
b-1
Diet food B 3.1 3.2 3.9 Interaction Effect given A*B, SS / df MS(A*B) / MS(W)
(a-1)(b-1)
MAP 716: Biostatistics II and Computting MAP 716: Biostatistics II and Computting
11 12
by Dr As Lakati by Dr As Lakati
2
12/05/2023
MAP 716: Biostatistics II and Computting by MAP 716: Biostatistics II and Computting by
13 14
Dr As Lakati Dr As Lakati
MAP 716: Biostatistics II and Computting by MAP 716: Biostatistics II and Computting by
17 18
Dr As Lakati Dr As Lakati
3
12/05/2023
Interaction Interaction….
• Since we are dealing with two categorical predictors we • If the two factors do interact, we can speak without
need to test whether the effects of the two factors are qualification of the effect of each factor on the
additive or interactive mean response:
• An interaction between 2 factors occurs when the effect • E.g The effect of gestational age group on birth weight
on one factor changes the level of the other factor as is same for girls and baby boys
changes
• E.g gender and gestational age interact in their effect on • However if the factors do not interact, we have to
birth weight if the mean difference in birth weight qualify our statements about the effect of each
between premature and full term babies for girls is factor by giving it for every level of the other factor
different from the mean difference in birth weight
between premature and full term babies for boys
MAP 716: Biostatistics II and Computting by MAP 716: Biostatistics II and Computting by
19 20
Dr As Lakati Dr As Lakati
• If not the conclusions and interpretations are much Main Effect A SSA A,
a-1
SS / df MS(A) / MS(W)
simpler
Main Effect B SSB B, SS / df MS(B) / MS(W)
• Preliminary test for interaction is an important b-1
component for the analysis Interaction Effect SSAB A*B, SS / df MS(A*B) / MS(W)
• The test is carried out by including the interaction (a-1)(b-1)
term in the model and testing the significance using Within (Error) SSW N - ab, SS / df
the F statistic based on the mean square ab(n-1)
Total sum of N - 1,
othe abn - 1
rs
MAP 716: Biostatistics II and Computting by MAP 716: Biostatistics II and Computting
21 22
Dr As Lakati by Dr As Lakati
Example Example….
• A psychologist, decided to teach old dogs and puppies new Type of Trick
tricks. So he adopts 15 old dogs and 15 puppies. Then
"Sit" "Shake" "Roll Over"
attempted to teach each of the 30 dogs one of the standard (Column 1) (Column 2) (Column 3)
dog tricks, "sit", "stay", and "roll over."
Puppies 2 4 6
• Teaching only one trick to each dog, you keep a record of (Row 1) 1
3
5
4
9
7
how many days it takes before they learn the tricks. The 1
2
6
7
8
10
results of your experiment are listed in the table
below. Use that data to conduct a two-way analysis of
variance to determine if old dogs can learn new tricks. Old Dogs
(Row 2)
2
5
9
10
13
12
2 11 15
4 13 17
3 7 13
MAP 716: Biostatistics II and Computting by MAP 716: Biostatistics II and Computting
23 24
Dr As Lakati by Dr As Lakati
4
12/05/2023
MAP 716: Biostatistics II and Computting by MAP 716: Biostatistics II and Computting
25 26
Dr As Lakati by Dr As Lakati
Graph: Descriptive