Sie sind auf Seite 1von 49

Analysis of Variance:

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

SS(ab)= SStotal – SSerror - SS(a) - SS(b)

𝑆𝑆(𝐴) 𝑆𝑆(𝐴𝐵)
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

Gender Score Age


Group Boys 6 11y.o Boys 8 12y.o
Boys 4 10y.o Boys 6 11y.o Boys 9 12y.o
Boys 6 10y.o Boys 9 11y.o Boys 13 12y.o
Boys 8 10y.o Girls 7 11y.o Girls 12 12y.o
Girls 4 10y.o
Girls 10 11y.o Girls 14 12y.o
Girls 8 10y.o
Girls 13 11y.o Girls 16 12y.o
Girls 4 10y.o

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
+

 Sum of Squares 2nd Factor (Age) 93


+

 Sum of Squares Within (Error) 68


+
Sum of Squares Both Factors 7

 Sum of Squares Total 200

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
= 𝟏𝟔 = 𝟏𝟔

Sum of squares for 1st Factor (Gender)


16+16 = 32

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
= 𝟒𝟔. 𝟓 = 𝟒𝟔. 𝟓

Sum of squares for 1st Factor (Gender)


46.5 + 46.5 = 93

16
SUM OF SQUARES
 Sum of Squares Within (Error)

Boys Score Girls Score


(4 − 6) 2 + (6 − 6) 2 + (8 − 6) 2 (4 − 7) 2 + (8 − 7) 2 + (9 − 7) 2
+ (6 − 7) 2 + (6 − 7) 2+ (9 − 7) 2 + (7 − 10) 2 + (10 − 10) 2 + (13 − 10) 2
+ (8 − 10) 2 + (9 − 10) 2 + (13 − 10) 2 + (12 − 14) 2 + (14 − 14) 2+ (16 − 14) 2
= 𝟐𝟖. 𝟎 = 𝟒𝟎. 𝟎

Sum of squares for 1st Factor (Gender)


28 + 40= 68

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

Sum of Squares Total = 200

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

200 – 32 – 93 – 68 = Sum of Squares Both Factors

19
DEGREES OF FREEDOM
DF(A) = a – 1 DF(AB) = (a – 1) (b-1)
DF(B) = b – 1 DF Error = (n-1) – (b-1)

Degrees of Freedom 1st Factor Degrees of Freedom 2nd Factor


(Gender) (Age)

2–1=1 3–1=2

Degrees of Freedom Both Factor Degrees of Freedom Error


(Gender and Age)
(3 – 1) + (3 – 1) + (3 – 1) + (3
1x2=2 – 1) + (3 – 1) + (3 – 1)
= 6 x 2 = 12 20
MEAN OF SQUARES
Mean of Squares 1st Factor Mean of Squares 2nd Factors
32 93
MS(A) = 1
= 32 MS(B) = = 46.50
2

Mean of Squares Error Mean of Squares Both Factors

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

F Computed Value Both Factor


𝑀𝑆(𝐴𝐵) 3.5
𝐹𝐴𝐵 = = = 0.62
𝑀𝑆𝑒𝑟𝑟𝑜𝑟 5.67

22
DECISION
5.64 > 4.747 Reject null hypothesis F Distribution F(1,12) = 5.64
P < .05

F Distribution F(2,12) = 8.20


8.20 > 3.885 Reject null Hypothesis
P < .05

.62 < 3.885 Accept null hypothesis F Distribution F(2,12) = .62


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

Factor B 192 2 96 160

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
= 𝟏𝟐 = 𝟏𝟐

Sum of squares for 1st Factor (Detergent)


12+12 = 24
31
SUM OF SQUARES
 Sum of Squares 2nd Factor (Temperature)

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

= 𝟗𝟔 = 𝟗𝟔

Sum of squares for 2nd Factor (Temperature)


96 + 96 = 192

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
=𝟔 =𝟔

Sum of Squares Within


6 + 6 = 12
33
SUM OF SQUARES
 Sum of Squares Total

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

Sum of Squares Total = 274

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

274 – 24 – 192 – 12 = Sum of Squares Both Factors

35
DEGREES OF FREEDOM
DF(A) = a – 1 DF(AB) = (a – 1) (b-1)
DF(B) = b – 1 DF Error = (n-1) – (b-1)

Degrees of Freedom 1st Factor Degrees of Freedom 2nd Factor


(Detergent) (Temperature)

2–1=1 3–1=2

Degrees of Freedom Both Factor Degrees of Freedom Error


(Detergent and Temperature)
(4 – 1) + (4 – 1) + (4 – 1) + (4
1x2=2 – 1) + (4 – 1) + (4 – 1)
= 3 x 6 = 18 36
MEAN OF SQUARES
Mean of Squares 1st Factor Mean of Squares 2nd Factors
24 192
MS(A) = 1
= 24 MS(B) = = 96
2

Mean of Squares Error Mean of Squares Both Factors

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

F Computed Value Both Factor


𝑀𝑆(𝐴𝐵) 23
𝐹𝐴𝐵 = = = 38.3
𝑀𝑆𝑒𝑟𝑟𝑜𝑟 0.6

38
DECISION
40 > 5.978 Reject null hypothesis F Distribution F(1,18) = 40
P < .05

F Distribution F(2,18) = 160


160 > 4.560 Reject null Hypothesis
P < .05

38.3 > 4.560Accept null hypothesis F Distribution F(2,18) = 38.3


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

4.9 + 22.5 = 27.4


46
Sum of Squares of 2nd Factor
Male Female
2 2 2
6 − 10 + (6 − 7) + (6 − 9) + 6 − 5 2 + (6 − 4)2 + (6 − 6)2 + (6 − 3)2 +
(6 − 6)2 + 6−8 2 + 4−5 2 + 6 − 2 2 + 4 − 3 2 + (4 − 4)2 + (4 − 5)2 +
(4 − 4)2 + (4 − 7)2 + (4 − 4)2 + (4 − 1)2 + (4 − 2)2 = 45
(4 − 5)2 = 41

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

Das könnte Ihnen auch gefallen