Unit 8 Two-Way Anova With M Observations Per Cell: Structure
Unit 8 Two-Way Anova With M Observations Per Cell: Structure
8.1 INTRODUCTION
61
Analysis of Variance
describe the test of hypothesis for two-way classified data with m
observations per cell;
derive the expectations of the various sum of squares; and
perform to test the hypothesis for two-way classified data with m
observations per cell.
In Unit 7, it was seen that we cannot obtain an estimate of, or make a test for
the interaction effect in the case of two-way classified data with one
observation per cell. This is possible, however, if some or all of the cells
contain more than one observations. We shall assume that there is an equal
number of (m) observations in each cell. The m observations in the (i, j)th cell
will be denoted yij1, yij2, . . ., yijm. Thus, yijk is the kth observation for ith level of
factor A and jth level of factor B, i = 1, 2, …, p; j = 1, 2, …,q & k = 1, 2, …,
m.
The mathematical model
yijk = µij + eijk
where µij is the true value for the (i, j)th cell and eijk is the error. eijk are
assumed to be independently identical normally distributed, each with mean
zero and variance σe2. The table of observations can be displayed as follows:
A/B B1 B2 Bj … Bq Total Total
A1 y111 y121 y1j1 … y1q1 y1.1 y1..
y112 y122 y1j2 … y1q2 y1.2
. . . . .
. . . . .
. . . . .
y11m y12m y1jm … y1qm y1.m
A2 y211 y221 y2j1 … y2q1 y2.1 y2..
y212 y222 y2j2 … y2q2 y2.2
. . . . .
. . . . .
. . . . .
y21m y22m y2jm … Y2qm y2.m
. yi11 yi21 yij1 … yiq1 yi.1 yi..
. yi12 yi22 yij2 … yiq2 yi.2
. . . . … . .
Ai . . . … . .
. . . . … . .
. yi1m yi2m yijm … yiqm yi.m
Ap yp11 yp21 ypj1 … ypq1 yp.1 yp..
yp12 yp22 ypj2 … ypq2 yp.2
. . . . .
. . . . .
. . . . .
yp1m yp2m ypjm … ypqm yp.m
62 Total y.1. y.2. y.j. … y.q. y…
The model can be written as Two-Way Anova with m
Observations Per Cell
yijk = µ + (µi.-µ) + (µ.j-µ) + (µij-µi.-µ.j+µ) + eijk
= µ + αi + βj + (αβ)ij + eijk
where, µ is general mean effect, αi is the effect of ith level of the factor A, j is
the effect of jth level of factor B, (αβ)ij is the interaction effect between ith level
of A factor and jth level of B factor.
p q p q
where,
y... = Sum of all the observations.
yi.. = Total of all observations in the ith level of factor A
y.j. = Total of all observations in the jth level of factor B.
The least square estimates for various effects, obtained by minimizing the
residual sum of squares
p q m 2
E y
i1 j1 k 1
ijk i j ij
by partially differentiating E with respect to μ, αi (i=1, 2, ..., p), βj (i=1, 2, ...,
q) and (αβ)ij for all i = 1, 2, ..., p; j =1, 2, … , q and equating these equations
equal to zero. These equations are called normal equations. Solution of these
normal equations provide the estimates of these parameters [μ, αi, βj, (αβ)ij].
p q m
E
2 y ijk i j ij 0
i1 j1 k 1
q m
E
i
2 y ijk i j ij 0
j1 k 1
63
Analysis of Variance
p m
E
j
2 y ijk i j ij 0
i 1 k 1
m
E
ij
2 y ijk i j ij 0
k 1
p q m
y
i 1 j1 k 1
ijk
y
j 1 k 1
. jk
i yi .. y...
qm
p m
y
i 1 k 1
i. k
Similarly, j y . j. y ...
pm
Substituting the values of i , i , j and ( α β̂ )ij, in the model and then
select the value of eijk such that both the sides are equal, so
yijk y... yi.. y... y. j. y... y ij. y i.. y. j. y... yijk y ij.
or
yijk y... yi.. y... y. j. y... y ij. yi.. y. j. y... yijk yij.
Squaring and summing both the sides over i, j & k, then we get
p q m p q
i 1 j1 i 1 j1 k 1
64 H0B: β1 = β 2 = . . . = βq = 0
H1B: β1 ≠ β2 ≠ . . . ≠ βq ≠ 0
H0AB: (αβ)ij = 0 for all i and j or A and B are independent to each other Two-Way Anova with m
Observations Per Cell
H1AB: (αβ)ij ≠ 0
The appropriate test statistics for testing the above hypothesis is:
SSA p 1 MSSA
F
SSE pq m 1 MSSE
If this value of F is greater than the tabulated value of F with [(p-1), pq (m-
1)] df at α level of significance so we reject the null hypothesis, otherwise we
may accept the null hypothesis.
Similarly, test statistics for second and third hypotheses are
SSB q 1 MSSB
F
SSE pqm 1 MSSE
SS AB p 1q 1 MSSAB
F
SSE pqm 1 MSSE
For practical point of view, first we should decide whether or not H0AB can be
rejected at an appropriate level of significance by using above F. If interaction
effects are not significant i.e. the factor A and factor B are independent then
we can find the best level of A and best level of B by multiple comparison
method using t-test. On the other hand, if they are found to be significant,
there may not be a single level of factor A and single level of factor B that
will be the best in all situations. In this case, one will have to compare for
each level of B at the different levels of A and for each level of A at the
different levels of B.
The above analysis can be shown in the following ANOVA table:
ANOVA Table for Two-way Classified Data
with m Observations per Cell
Sourses of DF SS MSS F
Variation
Total mpq-1
65
Analysis of Variance
Steps for Calculating Various Sums of Squares
p q m
1. Calculate G = Grand Total = Total of all observations = y ijk
i 1 j1 k 1
Total sum of squares (TSS) considers the pqm observations so the degrees of
freedom for TSS are (pqm-1). One degree of freedom is lost due to the
p q m
restriction that ( y
i 1 j1 k 1
ijk y... ) 0 .
The degrees of freedom for sum of squares due to factor A is (p-1) because it
has p levels. Similarly, the degrees of freedom for sum of squares due to
factor B is (q-1) because it has q levels, under consideration. Sum of squares
due to interaction of factors A and B is (p-1) (q-1) and the degrees of
freedom for sum of squares due to errors is pq (m-1). Thus partitioning of
degrees of freedom is as follows:
i 1
p
p 2
= mq αi2 mqE ei.. e.. 0
i1 i1
Because Eei.. e.. 0
p
p
E (SSA ) mq α i2 mq E ei.. p e...2
2
i1 i1
p
p
= mq i2 mq Eei.. 2 p E e...2
i 1 i 1
p 2
p
2 2e
= mq mq e
p
i
i 1 i1 mq mpq
p
= mq 2i p e2 2e
i 1
p
E SSA mq 2i (p 1) 2e
i 1
SSA mq p 2
E i 2e
p 1 ( p 1) i 1
mq p 2
or E MSSA 2e i
( p 1) i 1
2
q
we get
E(SSB) = E mp j e. j. e...
i1
q
E(SSB) = mp β 2j e. j. e... 2β j e. j. e...
2
or
i1
q
q 2
or E(SSB) = mp β 2j mp E e. j. e... 0
j1 j1
q
q
or E(SSB) = mp β 2j mp E e. j. 2 q e...2
j1 j1
q
q
= mp β 2j mp E e. j. 2 qE e...2
j1 j1
q
q 2 2
= mp 2j mp e q e
j1 j1 mp mpq
q
= mp 2j q 2e e2
j1
q
E(SSB) = q 1 e2 mp 2j
j1
SSB mp q 2
e2
q 1
E j
q 1 j1
mp q 2
E(MSSB) = e2
q 1
or j
j1
p q
SSAB m
E 2e 2
p 1q 1 p 1q 1 ij
i1 j1
p q
m 2
or E (MSSAB) e2
p 1q 1
i 1 j1
ij
p q m
E(SSE) = E e ijk eij. 2
i1 j1 k 1
p q m
= E e ijk eij. 2
i 1 j1 k 1
p q m 2
= E e ijk m e ij2.
i 1 j1 k 1
2
p q m p q
= E eijk m eij2.
i1 j1 k 1 i 1 j1
p q m p q
2
= E eijk
m E eij2.
i 1 j1 k 1 i 1 j1
= mpq 1 e2
SSE
or E 2e
pq ( m 1)
or E (MSSE) = 2e
69
Analysis of Variance
Solution: There are two factors the machine and shift. The levels of machine
are four and levels of shift are two. The Computation results are as follows:
G = 6+ 4 + 5 + 5 + 4 + 5 + 7 + 4 + 6 + 8 + 10 + 8 + 7 + 7 + 9 + 7
+ 9 + 12 + 8 + 8 + 7 + 5 + 6 + 5 + 9 + 9 + 7 + 5 + 4 + 6 + 8 + 4
+ 6 + 5 + 5 + 7 + 9 + 7 + 10
= 268
N = 40
G 2 268 268
CF = 1795.6
N 40
Raw Sum of Squares (RSS) = 62 + 42 +……+ 10 2 = 1946
Total Sum of Squares (TSS) = RSS - CF = 1946-1795.6 =150.4
Sum of square due to machines and due to shifts can be calculated by
considering the following two-way table:
Machine Shift Total
I Shift II Shift
A 24 30 54
B 41 44 85
C 32 31 63
D 28 38 66
Total 125 143 268
1252 1432
Sum of Squares due to Shifts SSS CF
20 20
= 1803.7 - 1795.6 = 8.1
Sum of Squares due to Interaction (SSMS)
242 412 322 282 302 442
5 5 5 5 5 5
31 38 CF SSM SSS
2 2
5 5
= 1861.2 1795.6 51.0 8.1 = 6.5
Finaly, the Sum of Squares due to error is founded by subtracting the SSM,
SSS and SSSM from TSS
SSE = TSS- SSM SSS SSMS
70
= 150.4 -51.0 -8.1 -6.5 = 84.8
SSM 51.0 Two-Way Anova with m
MSSM 17 Observations Per Cell
df 3
SSS 8.1
MSSS 8.1
df 1
SSE 84.8
MSSE 2.65
df 31
SSMS 6.5
MSSMS 2.167
df 3
For testing H 0 A : Mean effect of Machine A= Machine B =
Machine C = Machine D, is
17
F= 6.42
2.65
For testing H0B : Mean effect of Shift A = Shift B, is
8.1
F 3.06
2.65
Similarly, for testing H0AB : Interaction effect of Machine and Shift, is
2.167
F 0.817
2.65
ANOVA Table for Two-way Classified Data m- Observation per Cell
Sources of Degrees of Sum of Mean Sum F-test or
Variation Freedom Squares of Squares Variance
(DF) (SS) (MSS) Ratio
Due to 3 51.0 17 17
6.42
Machinery 2.65
Due to Shift 1 8.1 8.1 8.1
3.06
2.65
Due to 3 6.5 2.167 2.167
0.817
Interaction 2.65
Due to Error 32 84.8 2.65
Total 39 150.4
71
Analysis of Variance
E1) An experiment is performed to determine the effect of two
advertising campaigns on three kinds of cake mixes. Sales of each
mix were recorded after the first advertising campaigns and then
after the second advertising campaign. This experiment was
repeated three times for each advertising campaign and got the
following results:
Campaign I Campaign II
Mix1 574, 564, 550 1092, 1086, 1065
Mix2 524, 573, 551 1028, 1073, 998
Mix3 576, 540, 592 1066, 1045, 1055
8.8 SUMMARY
In this unit, we have discussed:
1. The ANOVA model for two-way classified data with m observations per
cell;
2. The basic assumptions for the given model;
3. How to obtain the estimates of the parameters of the given model;
4. How to test the hypothesis for two-way classified data with m
observations per cell;
5. How to derive the expectations of the various sum of squares; and
6. Numerical problems to test the hypothesis for two-way classified data
with m observations per cell.
E1) For set up an ANOVA Table for this problem, the computation results
are as follows:
Grand Total G = 14552
N = 18
Correction Factor (CF) = (14552 14552) /18 = 11764483.55
RSS = 12882026
TSS = 1117542
SSA = 1107070
SSB = 2957
SSAB = 1126
72
SSE = 6389
Two-Way Anova with m
Observations Per Cell
ANOVA Table
Total 17 1117542
Since computed value of F for cake mix and interaction are 2.8 and
1.06 respectively which are less than corresponding tabulated value so
they are not significant. Whereas the calculated value of F for
advertising campaign is greater than corresponding tabulated value so
there is a significant difference among advertising campaign.
73
Analysis of Variance TABLE: The F Table
Value of F Corresponding to 5% (Normal Type) and 1% (Bold Type) of the Area in the Upper Tail
Degrees of
Freedom: Degrees of Freedom (Numerator)
(Denominator) 1 2 3 4 5 6 7 8 9 10 11 12 14 16 20 24 30
____________________________________________________________________________________________________________________
1 161 200 216 225 230 234 237 239 241 242 243 244 245 246 248 249 250 254
4,052 4,999 5,403 5,625 5,764 5,859 5,928 5,981 6,022 6,056 6,082 6,106 6,142 6,169 6,208 6,234 6,258 6,366
2 18.51 19.00 19.16 19.25 19.30 19.33 19.36 19.37 19.38 19.39 19.40 19.41 19.42 19.43 19.44 19.45 19.46 19.50
98.49 99.00 99.17 99.25 99.30 99.33 99.34 99.36 99.38 99.40 99.41 99.42 99.43 99.44 99.45 99.46 99.47 99.50
3 10.13 9.55 9.28 9.12 9.01 8.94 8.88 8.84 8.81 8.78 8.76 8.74 8.71 8.69 8.66 8.64 8.62 8.53
34.12 30.82 29.46 28.71 28.24 27.91 27.67 27.49 27.34 27.23 27.13 27.05 26.92 26.83 26.69 26.60 26.50 26.12
4 7.71 6.94 6.59 6.39 6.26 6.16 6.09 6.04 6.00 5.96 5.93 5.91 5.87 5.84 5.80 5.77 5.74 5.63
22.20 18.00 16.69 15.98 15.52 15.21 14.98 14.80 14.66 14.54 14.45 14.37 14.24 14.15 14.02 13.93 13.83 13.46
5 6.61 5.79 5.41 5.19 5.05 4.95 4.88 4.82 4.78 4.74 4.70 4.68 4.64 4.60 4.56 4.53 4.50 4.36
16.26 13.27 12.06 11.39 10.97 10.67 10.45 10.27 10.15 10.05 9.96 9.89 9.77 9.68 9.55 9.47 9.38 9.02
6 5.99 5.14 4.76 4.53 4.39 4.28 4.21 4.15 4.10 4.06 4.03 4.00 3.96 3.92 3.87 3.84 3.81 3.67
13.74 10.92 9.78 9.15 8.75 8.47 8.26 8.10 7.98 7.87 7.79 7.72 7.60 7.52 7.39 7.31 7.23 6.88
7 5.59 4.47 4.35 4.12 3.97 3.87 3.79 3.73 3.68 3.63 3.60 3.57 3.52 3.49 3.44 3.41 3.38 3.23
12.25 9.55 8.45 7.85 7.46 7.19 7.00 6.84 6.71 6.62 6.54 6.47 6.35 6.27 6.15 6.07 5.98 5.65
8 5.32 4.46 4.07 3.84 3.69 3.58 3.50 3.44 3.39 3.34 3.31 3.28 3.23 3.20 3.15 3.12 3.08 2.93
11.26 8.65 7.59 7.01 6.63 6.37 6.19 6.03 5.91 5.82 5.74 5.67 5.56 5.48 5.36 5.28 5.20 4.86
9 5.12 4.26 3.86 3.63 3.48 3.37 3.29 3.23 3.18 3.13 3.10 3.07 3.02 2.98 2.93 2.90 2.86 2.71
10.56 8.02 6.99 6.42 6.06 5.80 5.62 5.47 5.35 5.26 5.18 5.11 5.00 4.92 4.80 4.73 4.64 4.31
10 4.96 4.10 3.71 3.48 3.33 3.22 3.14 3.07 3.02 2.97 2.94 2.91 2.86 2.82 2.77 2.74 2.70 2.54
10.04 7.56 6.55 5.99 5.64 5.39 5.21 5.06 4.95 4.85 4.78 4.71 4.60 4.52 4.41 4.33 4.25 3.91
11 4.84 3.98 3.59 3.36 3.20 3.09 3.01 2.95 2.90 2.86 2.82 2.79 2.74 2.70 2.65 2.61 2.57 2.40
9.65 7.20 6.22 5.67 5.32 5.07 4.88 4.74 4.63 4.54 4.46 4.40 4.29 4.21 4.10 4.02 3.94 3.60
12 4.75 3.88 3.49 3.26 3.11 3.00 2.92 2.85 2.80 2.76 2.72 2.69 2.64 2.60 2.54 2.50 2.46 2.30
9.33 6.93 5.95 5.41 5.06 4.82 4.65 4.50 4.39 4.30 4.22 4.16 4.05 3.98 3.86 3.78 3.70 3.36
13 4.67 3.80 3.41 3.18 3.02 2.92 2.84 2.77 2.72 2.67 2.63 2.60 2.55 2.51 2.46 2.42 2.38 2.21
9.07 6.70 5.74 5.20 4.86 4.62 4.44 4.30 4.19 4.10 4.02 3.96 3.85 3.78 3.67 3.59 3.51 3.16
14 4.60 3.74 3.34 3.11 2.96 2.85 2.77 2.70 2.65 2.60 2.56 2.53 2.48 2.44 2.39 2.35 2.31 2.13
8.86 6.51 5.56 5.03 4.69 4.46 4.28 4.14 4.03 3.94 3.86 3.80 3.70 3.62 3.51 3.43 3.34 3.00
15 4.54 3.68 3.29 3.06 2.90 2.79 2.70 2.64 2.59 2.55 2.51 2.48 2.43 2.39 2.33 2.29 2.25 2.07
8.68 6.36 5.42 4.89 4.56 4.32 4.14 4.00 3.89 3.80 3.73 3.67 3.56 3.48 3.36 3.29 3.20 2.87
16 4.49 3.63 3.24 3.01 2.85 2.74 2.66 2.59 2.54 2.49 2.45 2.42 2.37 2.33 2.28 2.24 2.20 2.01
8.53 6.23 5.29 4.77 4.44 4.20 4.03 3.89 3.78 3.69 3.61 3.55 3.45 3.37 3.25 3.18 3.10 2.75
17 4.45 3.59 3.20 2.96 2.81 2.70 2.62 2.55 2.50 2.45 2.41 2.38 2.33 2.29 2.23 2.19 2.15 1.96
8.40 6.11 5.18 4.67 4.34 4.10 3.93 3.79 3.68 3.95 3.52 3.45 3.35 3.27 3.16 3.08 3.00 2.65
18 4.41 3.55 3.16 2.93 2.77 2.66 2.58 2.51 2.46 2.41 2.37 2.34 2.29 2.25 2.19 2.15 2.11 1.92
8.28 6.01 5.09 4.58 4.25 4.01 3.85 3.71 3.60 3.51 3.44 3.37 3.27 3.19 3.07 3.00 2.91 2.57
19 4.38 3.52 3.13 2.90 2.74 2.63 2.55 2.48 2.43 2.38 2.34 2.31 2.26 2.21 2.15 2.11 2.07 1.88
8.18 5.93 5.01 4.50 4.17 3.94 3.77 3.63 3.52 3.43 3.36 3.30 3.19 3.12 3.00 2.92 2.84 2.49
20 4.35 3.49 3.10 2.87 2.71 2.60 2.52 2.45 2.40 2.35 2.31 2.28 2.23 2.18 2.12 2.08 2.04 1.84
8.10 5.85 4.94 4.43 4.10 3.87 3.71 3.56 3.45 3.37 3.30 3.23 3.13 3.05 2.94 2.86 2.77 2.42
21 4.32 3.47 3.07 2.84 2.68 2.57 2.49 2.42 2.37 2.32 2.28 2.25 2.20 2.15 2.09 2.05 2.00 1.81
74 8.02 5.78 4.87 4.37 4.04 3.81 3.65 3.51 3.40 3.31 3.24 3.17 3.07 2.99 2.88 2.80 2.72 2.36
Two-Way Anova with m
TABLE (Continued) Observations Per Cell
Degrees of
Freedom: Degrees of Freedom: Numerator
Denominator 1 2 3 4 5 6 7 8 9 10 11 12 14 16 20 24 30
22 4.30 3.44 3.05 2.82 2.66 2.55 2.47 2.40 2.35 2.30 2.23 2.23 2.18 2.13 2.07 2.03 1.98 1.78
7.94 5.72 4.82 4.31 3.99 3.76 3.59 3.45 3.35 3.26 3.18 3.12 3.02 2.94 2.83 2.75 2.67 2.31
23 4.28 3.42 3.03 2.80 2.64 2.53 2.45 2.38 3.32 2.28 2.24 2.20 2.14 2.10 2.04 2.00 1.96 1.76
7.88 5.66 4.76 4.26 3.94 3.71 3.54 3.41 3.30 3.21 3.14 3.07 2.97 2.89 2.78 2.70 2.62 2.26
24 4.26 3.40 3.01 2.78 2.62 2.51 2.43 2.36 2.30 2.26 2.22 2.18 2.13 2.09 2.02 1.98 1.94 1.73
7.82 5.61 4.72 4.22 3.90 3.67 3.50 3.36 3.25 3.17 3.09 3.03 2.93 2.85 2.74 2.66 2.58 2.21
25 4.24 3.38 2.99 2.76 2.60 2.49 2.41 2.34 2.28 2.24 2.20 2.16 2.11 2.06 2.00 1.96 1.92 1.71
7.77 5.57 4.68 4.18 3.86 3.63 3.46 3.32 3.21 3.13 3.05 2.99 2.89 2.81 2.70 2.62 2.54 2.17
26 4.22 3.37 2.98 2.74 2.59 2.47 2.39 2.32 2.27 2.22 2.18 2.15 2.10 2.05 1.99 1.95 1.90 1.69
7.72 5.53 4.64 4.14 3.82 3.59 3.42 3.29 3.17 3.09 3.02 2.96 2.86 2.77 2.66 2.58 2.50 2.13
27 4.21 3.35 2.96 2.73 2.57 2.46 2.37 2.30 2.25 2.20 2.16 2.13 2.08 2.03 1.97 1.93 1.88 1.67
7.68 5.49 4.60 4.11 3.79 3.56 3.39 3.26 3.14 3.06 2.98 2.93 2.83 2.74 2.63 2.55 2.47 2.10
28 4.20 3.34 2.95 2.71 2.56 2.44 2.36 2.29 2.24 2.19 2.15 2.12 2.06 2.02 1.96 1.91 1.87 1.65
7.64 5.45 4.57 4.07 3.76 3.53 3.36 3.23 3.11 3.03 2.95 2.90 2.80 2.71 2.60 2.52 2.44 2.06
29 4.18 3.33 2.93 2.70 2.54 2.43 2.35 2.28 2.22 2.18 2.14 2.10 2.05 2.00 1.94 1.90 1.85 1.64
7.60 5.42 4.54 4.04 3.73 3.50 3.33 3.20 3.08 3.00 2.92 2.87 2.77 2.68 2.57 2.49 2.41 2.03
30 4.17 3.32 2.92 2.69 2.53 2.42 2.34 2.27 2.21 2.16 2.12 2.09 2.04 1.99 1.93 1.89 1.84 1.62
7.56 5.39 4.51 4.02 3.70 3.47 3.30 3.17 3.06 2.98 2.90 2.84 2.74 2.66 2.55 2.47 2.38 2.01
3.84 2.99 2.60 2.37 2.21 2.09 2.01 1.94 1.88 1.83 1.79 1.75 1.69 1.64 1.57 1.52 1.46 1.00
6.64 4.60 3.78 3.32 3.02 2.80 2.64 2.51 2.41 2.32 2.24 2.18 2.07 1.99 1.87 1.79 1.69 1.00
75