You are on page 1of 4

Two-Way ANOVA, A Numerical Example

ANOVA can be extended to analyze data generated from experiments utilizing any number of
independent variables, or factors. In a typical two factor design, A represents the first factor and
B represents the second factor. So, in an AxB design, where A has 3 levels, and B has two levels.
This design can be presented as follows:
Factor

A1

A2

A3

B1

AB11

AB21

AB31

B2

AB12

AB22

AB32

This is called an AB matrix, generally, the cell AB11 would contain scores, or the total or mean for
subjects in condition A1 and B1, AB22 would contain information on subjects in condition A2 and
B2. Take the following two factor 3x2 experiment. We have a group of 24 chimpanzees, whom
we've taught a discrimination task. We place three objects (two are the same) in front of the
chimpanzees and their task is to pick out the odd one. So, if we place two square blocks and a
poker chip in front of them, they have been trained to point to the poker chip. For doing this they
receive a reward. Chimpanzees assigned to condition A1 get one grape as a reinforcer, A2
chimpanzees get two grapes, and A3 chimpanzees get three grapes. Furthermore, chimpanzees
have either been fed within the past hour (B1) or 24 hours ago (B2). Therefore, the questions are
1)do chimpanzees perform differently in this task, depending upon the size of the reinforcement;
2)do chimpanzees perform differently in this task, depending upon how hungry they are; and, 3)do
chimpanzees perform differently in this task depending upon the level of reinforcement, given their
level of hunger (this is a different question than 1 & 2).
Step 1
We begin by arranging our data into what's called an ABS matrix (Factor A by Factor B by
Subject matrix) We calculate the sums, sum of AB squared, means, and standard deviations for
preliminary analysis. The data follow (numbers represent the number of correct discriminations in
20 trials):

Subj. #

A1B1
1 grape &
1 hr

A2B1
2 grapes &
1 hr

A3B1
3 grapes &
1 hr

A1B2
1 grape &
24 hrs

A2B2
2 grapes &
24 hrs

A3B2
3 grapes &
24 hrs

13

15

14

16

18

18

10

15

13

13

15

13

ABij

12

40

56

44

48

40

ABijk2

66

468

830

530

666

450

Mean ABij

3.00

10.00

14.00

11.00

12.00

10.00

sij

3.16

4.76

3.92

3.92

5.48

4.08

Step 2
Next, we rearrange our data into an AB matrix, as above, with totals in each of the cells as well as
marginal totals.
Drive (Factor B)

Amount of Food (Factor A)


A1

A2

A3

Bi

B1

12

40

56

108

B2

44

48

40

132

Ai

56

88

96

240

Step 3
We can now form bracket terms. For this we will need a, b, and s, where a=the number of levels
for factor A (3), b=the number of levels of factor B (2), and s=the number of subjects serving in
each AxB condition (4).
T2
[T] = ---------(a)(b)(s)

(240)2
= -----------------3x2x4

57,600
= ---------------= 2400
24

Ai2
(56)2 + (88)2 + (96)2
20,096
[A] = -------- = -------------------------- = --------- = 2512
(b)(s)
2x4
8

Bj2
[B] = ------(a)(s)

(108)2 + (132)2
= ------------------3x4

(ABij)2
[AB] = ---------- =
s

29,088
--------12

= 2424

(12)2 + (44)2 + (40)2 + (48)2 + (56)2 + (40)2


10,720
------------------------------------------------------ = --------- = 2680
4
4

[ABS] = ABijk2 = 66 + 468 + 830 + 530 + 666 + 450 = 3010


Step 4
Computing SS for each component of variance:
SSA = [A] - [T] = 2512 - 2400 = 112
SSB = [B] - [T] = 2424 - 2400 = 24
SSA x B = [AB] - [A] -[B] + [T] = 2680 - 2512 - 2424 + 2400 = 144
SSW = [ABS] - [AB] = 3010 - 2680 = 330
SST = [ABS] - [T] = 3010 - 2400 = 610
Step 5
Computing df for each component of variance:
dfA = a - 1 = 3 - 1 = 2
dfb = b - 1 = 2 - 1 = 1
dfA x B = (a - 1)(b - 1) = (3 - 1)(2 - 1) = 2
dfW = (a)(b)(s - 1) = (3)(2)(4 - 1) = 18
dfT = (a)(b)(s) - 1 = (3)(2)(4) - 1 = 23
Step 6
Computing MS for each treatment effect:
SSA
112
MSA = ------- = ---------dfA
2
SSB
MSB = ----dfB

= 56

24
= ---- = 24
1

SSA x B
MSA x B = ---------dfA x B

144
= ----- = 72
2

SSW 330
MSW = ---------= ----- = 18.33
dfW
18

Step 7
Computing Fratios:
FA =

MSA
--------- =
MSW

56
------- = 3.055
18.33

FB =

MSB
--------- =
MSW

24
------- = 1.309
18.33

MSA x B
FA x B = ---------- =
MSW

72
--------- = 3.928
18.33

Step 8
Arrange values into an ANOVA Summary Table
Source
SS
df
SSA
112
2
SSB
24
1
SSAxB
144
2
SSW
330
18
SSTOT
610
23

MS
56
24
72
18.33

F
3.055
1.309
3.928

Step 9
Determine significance of each F-ratio by using the F-table in your text. Using the df for
numerator and denominator, we find that only the interaction effect is significant for this
experiment [Fcrit (2,18) = 3.55].

You might also like