Beruflich Dokumente
Kultur Dokumente
Two Way
1
INTRODUCTION
The t- and z-tests developed in the 20th century
were used until 1918, when Ronald Fisher
created the analysis of variance. ANOVA is
also called the Fisher analysis of variance,
and it is the extension of the t- and the z-tests.
The term became well-known in 1925, after
appearing in Fisher's book, "Statistical
Methods for Research Workers." It was
employed in experimental psychology and later
expanded to subjects that are more complex.
2
WHAT IS TWO-WAY ANOVA?
◈ The two-way ANOVA compares the mean differences
between groups that have been split on two independent
variables (called factors).
◈ The primary purpose of a two-way ANOVA is to understand
if there is an interaction between the two independent
variables on the dependent variables.
3
“
Note:
The interaction term in a two-way ANOVA
informs you wither the effect of one of your
independent variables, on the dependent
variables is the same for all values of your
other independent variable and vice versa.
4
ONE-WAY ANOVA VS. TWO-WAY ANOVA
◈ A two-way ANOVA is designed to assess the
interrelationship of two independent variables on a dependent
variable.
◈ A one-way ANOVA only involves one factor or independent
variable, whereas there are two independent variables in a
two-way ANOVA.
◈ A two-way ANOVA instead compares multiple groups
of two factors.
5
WHEN TO USE TWO-WAY ANOVA?
The two-way ANOVA compares the mean differences
between groups that have been split on
two independent variables (called factors). The
primary purpose of a two-way ANOVA is to
understand if there is an interaction between the two
independent variables on the dependent variable.
6
HOW DO WE USE THE TEST?
SS(𝐴) = bn σ𝑎𝑖=1 ( 𝑥ҧ𝑖… −𝑥𝐺𝑀 )2
SUM
SS(𝐵) = an σ𝑎𝑖=1 ( 𝑥𝑗…
ҧ −𝑥𝐺𝑀 )2
OF
2
SSE = σ𝑎𝑖=1 σ𝑎𝑗=1 σ𝑎𝑘=1 𝑥𝑖𝑗𝑘 − 𝑥ҧ𝑖𝑗 SQUARES
𝑆𝑆(𝐴) 𝑆𝑆(𝐴𝐵)
MS(A) = 𝐷𝐹(𝐴) MS(AB) = 𝐷𝐹(𝐴𝐵) MEAN
OF
𝑆𝑆(𝐵) 𝑆𝑆𝑒𝑟𝑟𝑜𝑟
MS(B) = 𝐷𝐹(𝐵) Mserror = 𝐷𝐹𝑒𝑟𝑟𝑜𝑟 SQUARES 7
HOW DO WE USE THE TEST? Degrees of
Freedom
DF(A) = a – 1 DF(AB) = (a – 1) (b-1)
DF(B) = b – 1 Dferror = (n-1) – (a-1) – (b-1)
𝑀𝑆(𝐴)
𝐹𝐴 = 𝑀𝑆(𝐴𝐵)
𝑀𝑆𝑒𝑟𝑟𝑜𝑟
𝐹𝐴 = F Value
𝑀𝑆𝑒𝑟𝑟𝑜𝑟
𝑀𝑆(𝐵)
𝐹𝐵 = 8
𝑀𝑆𝑒𝑟𝑟𝑜𝑟
PROBLEM 1
Given an arithmetic test two boys and girls
of different ages. Boys and Girls of 10,11,12
years old. Determine whether gender or age
group or both gender and age group impact
the test score.
9
FORMULATE HYPOTHESIS
Null Hypothesis : Gender will have no significant
effect on students score.
Null Hypothesis : Age will have no significant
effect on students score.
Null Hypothesis : Gender and Age interaction will
have no significant effect on students score.
10
LEVEL OF SIGNIFICANCE
0.05
TYPE OF TEST-STATISTICS
F - test
11
COMPUTATION
Data : 1
12
COMPUTATION
BOYS GIRLS
10 years old 11 years old 12 years old 10 years old 11 years old 12 years old
4 6 8 4 7 12
6 6 9 8 10 14
8 9 13 9 13 16
MEAN TABLE
10 years old 11 years old 12 years old average
Boys 6 7 10 7.7
Girls 7 10 14 10.3
Average 6.5 8.5 12 9 13
COMPUTATION
Sum of Squares 1st Factor (Gender) 32
+
14
SUM OF SQUARES
Sum of Squares 1st Factor (Gender)
Boys Girls
(7.7 − 9) 2 + (7.7 − 9) 2 + (7.7 − 9) 2 (10.3 − 9) 2 + (10.3 − 9) 2 + (10.3 − 9) 2
+ (7.7 − 9) 2 + (7.7 − 9) 2 + (7.7 − 9) 2 + (10.3 − 9) 2 + (10.3 − 9) 2+ (10.3 − 9) 2
+ (7.7 − 9) 2 + (7.7 − 9) 2 + (7.7 − 9) 2 + (10.3 − 9) 2 + (10.3 − 9) 2+ (10.3 − 9) 2
= 𝟏𝟔 = 𝟏𝟔
15
SUM OF SQUARES
Sum of Squares 2nd Factor (Age)
Boys Girls
(6.5 − 9) 2 + (6.5 − 9) 2 + (6.5 − 9) 2 (6.5 − 9) 2 + (6.5 − 9) 2 + (6.5 − 9) 2
+ (8.5 − 9) 2 + (8.5 − 9) 2 + (8.5 − 9) 2 + (8.5 − 9) 2 + (8.5 − 9) 2 + (8.5 − 9) 2
+ (12 − 9) 2 + (12 − 9) 2 + (12 − 9) 2 + (12 − 9) 2 + (12 − 9) 2 + (12 − 9) 2
= 𝟒𝟔. 𝟓 = 𝟒𝟔. 𝟓
16
SUM OF SQUARES
Sum of Squares Within (Error)
17
SUM OF SQUARES
Sum of Squares Total
Boys Score
(4 − 9) 2 + (6 − 9) 2 + (8 − 9) 2 (4 − 9) 2 + (8 − 9) 2 + (9 − 9) 2
+ (6 − 9) 2 + (6 − 9) 2+ (9 − 9) 2 + (7 − 9) 2 + (10 − 9) 2 + (13 − 9) 2
+ (8 − 9) 2 + (9 − 9) 2+ (13 − 9) 2 + (12 − 9) 2 + (14 − 9) 2 + (16 − 9) 2
18
SUM OF SQUARES
Sum of Squares Both Factors
Sum of Squares Total – Sum of Squares 1st Factor – Sum of Squares 2nd Factor –
Sum of Squares Within
19
DEGREES OF FREEDOM
DF(A) = a – 1 DF(AB) = (a – 1) (b-1)
DF(B) = b – 1 DF Error = (n-1) – (b-1)
2–1=1 3–1=2
68 7
MS Error = 12 = 5.67 MS(AB) = 2 = 3.5
21
F VALUE
F Computed Value 1st Factor F Computed Value 2nd Factor
𝑀𝑆(𝐴) 32 𝑀𝑆(𝐵) 46.50
𝐹𝐴 = = = 5.64 𝐹𝐵 = = = 8.20
𝑀𝑆𝑒𝑟𝑟𝑜𝑟 5.67 𝑀𝑆𝑒𝑟𝑟𝑜𝑟 5.67
22
DECISION
5.64 > 4.747 Reject null hypothesis F Distribution F(1,12) = 5.64
P < .05
23
CONCLUSION
Therefore, Gender have a significant effect on students score.
Age has a significant effect on student’s score. While, Gender
and Age interaction will have no significant effect on
Students score.
24
PROBLEM 2
Suppose you want to determine whether the brand of laundry
detergent used and the temperature affects the amount of dirt
removed from your laundry. To this end, you buy two
detergent with two different brands (Super and Best) and
choose three different levels (cold ,warm and hot). Then you
divide your laundry randomly into “6*r” pile of equal size and
assign each “r” piles into the combination of (Super and Best)
and (Cold, Warm and Hot).
25
DATA
COLD WARM HOT
SUPER 4 7 10
5 9 12
6 8 11
5 12 9
BEST 6 13 12
6 15 13
4 12 10
4 12 13 26
DATA
COLD WARM HOT AVERAGE
SUPER 5 9 10 8
BEST 5 13 12 10
AVERAGE 5 11 11 9
27
FORMULATE HYPOTHESIS
Null Hypothesis : The amount of dirt removed does
not depend on the type of detergent.
Null Hypothesis : The amount of dirt removed does
not depend on the temperature.
Null Hypothesis : The amount of dirt removed does
not depend on both detergent and temperature.
28
LEVEL OF SIGNIFICANCE
0.05
TYPE OF TEST-STATISTICS
F - test
29
DATA
Source Sum of Degrees of Mean of F Value
Squares Freedom Squares
Factor A 24 1 24 40
Interaction 46 2 23 18.3
(AB)
Error 12 18 0.6
Total 274 23
30
SUM OF SQUARES
Sum of Squares 1st Factor (Detergent)
Super Best
(8 − 9) 2 + (8 − 9) 2 + (8 − 9) 2 (10 − 9) 2 + (10 − 9) 2 + (10 − 9) 2
+ (8 − 9) 2 + (8 − 9) 2+ (8 − 9) 2 + (10 − 9) 2 + (10 − 9) 2 + (10 − 9) 2
+ (8 − 9) 2 + (8 − 9) 2+ + (10 − 9) 2 + (10 − 9) 2 +
(8 − 9) 2 +(8 − 9) 2 + (8 − 9) 2 (10 − 9) 2 + (10 − 9) 2
+(8 − 9) 2 +(10 − 9) 2 +(10 − 9) 2
= 𝟏𝟐 = 𝟏𝟐
Super Best
(5 − 9) 2 + (5 − 9) 2 + (5 − 9) 2 (5 − 9) 2 + (5 − 9) 2 + (5 − 9) 2
+ (5 − 9) 2 + (11 − 9) 2 + (11 − 9) 2 + (5 − 9) 2 + (11 − 9) 2 + (11 − 9) 2
+ (11 − 9) 2 + (11 − 9) 2 + (11 − 9) 2 + (11 − 9) 2 + (11 − 9) 2 + (11 − 9) 2
+(11 − 9) 2 +(11 − 9) 2 + (11 − 9) 2 +(11 − 9) 2 +(11 − 9) 2 + (11 − 9) 2
= 𝟗𝟔 = 𝟗𝟔
32
SUM OF SQUARES
Sum of Squares Within (Error)
Super Best
(4 − 5) 2 + (5 − 5) 2 + (6 − 5) 2 (6 − 5) 2 + (6 − 5) 2 + (4 − 5) 2
+ (5 − 5) 2 + (7 − 9) 2+ (9 − 9) 2 + (4 − 5) 2 + (13 − 11) 2+ (15 − 11) 2
+ (8 − 9) 2 + (12 − 9) 2 + (10 − 10.5) 2 + (12 − 11) 2 + (12 − 11) 2+
+(12 − 10.5) 2 + (11 − 10.5) 2 (12 − 11) 2 +(13 − 11) 2 +
+(9 − 10.5) 2 (10 − 11) 2 +(13 − 11) 2
=𝟔 =𝟔
Super Best
(4 − 9) 2 + (5 − 9) 2 + (6 − 9) 2 (6 − 9) 2 + (6 − 9) 2 + (4 − 9) 2
+ (5 − 9) 2 + (7 − 9) 2+ (9 − 9) 2 + (4 − 9) 2 + (13 − 9) 2 + (15 − 9) 2
+ (8 − 9) 2 + (12 − 9) 2 + (10 − 9) 2 + + (12 − 9) 2 + (12 − 9) 2 +
(12 − 9) 2 + (11 − 9) 2 + (9 − 9) 2 (12 − 9) 2 + (13 − 9) 2 + (10 − 9) 2 +
(13 − 9) 2
34
SUM OF SQUARES
Sum of Squares Both Factors
Sum of Squares Total – Sum of Squares 1st Factor – Sum of Squares 2nd Factor –
Sum of Squares Within
35
DEGREES OF FREEDOM
DF(A) = a – 1 DF(AB) = (a – 1) (b-1)
DF(B) = b – 1 DF Error = (n-1) – (b-1)
2–1=1 3–1=2
12 46
MS Error = 18 = 0.6 MS(AB) = 2
= 23
37
F VALUE
F Computed Value 1st Factor F Computed Value 2nd Factor
𝑀𝑆(𝐴) 24 𝑀𝑆(𝐵) 196
𝐹𝐴 = = = 40 𝐹𝐵 = = = 160
𝑀𝑆𝑒𝑟𝑟𝑜𝑟 0.6 𝑀𝑆𝑒𝑟𝑟𝑜𝑟 0.6
38
DECISION
40 > 5.978 Reject null hypothesis F Distribution F(1,18) = 40
P < .05
39
CONCLUSION
Therefore, the amount of dirt removed depends on the types
of detergent. The amount of dirt removed depends on the
temperature. Meanwhile, the amount of dirt removed depends
on the of detergent and temperature.
40
PROBLEM SETS
41
Example 1
A research study was conducted to examine the impact of
eating a high protein breakfast on adolescents’ performance
during a physical education fitness test. Half of the subjects
received a high protein breakfast and half were given a low
protein breakfast. All of the adolescents, both male and
female, were given a fitness test with high scores representing
better performance. Test scores are recorded below.
42
DATA
Group High Protein Low Protein
Male 10 5
7 4
9 7
6 4
8 5
Female 5 3
4 4
6 5
3 1
2 2
43
Formulate Hypothesis
◈ Null Hypothesis: Eating a high protein breakfast has no
significant impact on the adolescents’ performance.
◈ Null Hypothesis: Eating a low protein breakfast has no
significant impact on the adolescents’ performance.
◈ Null Hypothesis: Gaining a high scores representing better
performance does not depend on eating high or low
protein breakfast.
44
Level of Significance
0.05
Type of Test Statistics
F- Test
45
Computation
Sum of Squares
Sum of Squares 1st Factor
Males Females
2 2 2
4.3 − 5 + 4.3 − 5 + (4.3 − 5) + 3.5 − 5 2 + 3.5 − 5 2 + (3.5 − 5)2 +
(4.3 − 5)2 + (4.3 − 5)2 + 4.3 − 5 2 + (3.5 − 5)2 + (3.5 − 5)2 + 3.5 − 5 2 +
4.3 − 5 2 + (4.3 − 5)2 + (4.3 − 5)2 + 3.5 − 5 2 + (3.5 − 5)2 + (3.5 − 5)2 +
4.3 − 5 2 = 4.9 (3.5 − 5)2 = 22.5
41 + 45 = 86
47
Sum of Squares Within
Male Female
2 2 2
10 − 8 + (7 − 8) + (9 − 8) + 5 − 4 2 + (4 − 4)2 + (6 − 4)2 +
(6 − 8)2 + 8−8 2 + 5−5 2 + (3 − 4)2 + 2 − 4 2 + 3 − 4 2 +
(4 − 5)2 + (7 − 5)2 + (4 − 5)2 + (4 − 4)2 + (5 − 4)2 + (1 − 4)2 +
(5 − 5)2 = 16 (2 − 4)2 = 25
16+ 25= 41
48
Sum of Squares Total
Male Female
2 2 2
10 − 5 + (7 − 5) + (9 − 5) + 5 − 4 2 + (4 − 4)2 + (6 − 4)2 +
(6 − 5)2 + 8−5 2 + 5−5 2 + (3 − 4)2 + 2 − 4 2 + 3 − 4 2 +
(4 − 5)2 + (7 − 5)2 + (4 − 5)2 + (4 − 4)2 + (5 − 4)2 + (1 − 4)2 +
(5 − 5)2 = 16 (2 − 4)2 = 25
16+ 25= 41
49