You are on page 1of 55

ANOVA TABLE

Factorial Experiment
Completely Randomized Design
Anova table for the 3 factor Experiment

Source SS df MS F p -value
A SSA a-1 MSA MSA/MSError

B SSB b-1 MSB MSB/MSError

C SSC c-1 MSC MSC/MSError

AB SSAB (a - 1)(b - 1) MSAB MSAB/MSError

AC SSAC (a - 1)(c - 1) MSAC MSAC/MSError

BC SSBC (b - 1)(c - 1) MSBC MSBC/MSError

ABC SSABC (a - 1)(b - 1)(c - 1) MSABC MSABC/MSError

Error SSError abc(n - 1) MSError


Sum of squares entries
a a
SS A nbc nbc yi y
2 2
i
i 1 i 1

Similar expressions for SSB , and SSC.

SS AB nc nc yij yi y j y
a a b
2 2
ij
i 1 i 1 j 1

Similar expressions for SSBC , and SSAC.


Sum of squares entries
a
SS ABC n ikj
2

i 1

n yijk yij yik y jk yi


a b c

y j yk yi
i 1 j 1 k 1
2

Finally

SS Error yijkl yijk


a b c n
2

i 1 j 1 k 1 l 1
The statistical model for the 3 factor Experiment

yijk/ i j k
mean effect main effects

ij ik jk ijk ijk/
2 factor interactions 3 factor interaction random error
Anova table for the 3 factor Experiment

Source SS df MS F p -value
A SSA a-1 MSA MSA/MSError

B SSB b-1 MSB MSB/MSError

C SSC c-1 MSC MSC/MSError

AB SSAB (a - 1)(b - 1) MSAB MSAB/MSError

AC SSAC (a - 1)(c - 1) MSAC MSAC/MSError

BC SSBC (b - 1)(c - 1) MSBC MSBC/MSError

ABC SSABC (a - 1)(b - 1)(c - 1) MSABC MSABC/MSError

Error SSError abc(n - 1) MSError


The testing in factorial experiments
1. Test first the higher order interactions.
2. If an interaction is present there is no need
to test lower order interactions or main
effects involving those factors. All factors
in the interaction affect the response and
they interact
3. The testing continues with lower order
interactions and main effects for factors
which have not yet been determined to
affect the response.
Examples

Using SPSS
Example
In this example we are examining the effect of
the level of protein A (High or Low) and
the source of protein B (Beef, Cereal, or
Pork) on weight gains (grams) in rats.

We have n = 10 test animals randomly


assigned to k = 6 diets
The k = 6 diets are the 6 = 32 Level-Source
combinations
1. High - Beef
2. High - Cereal
3. High - Pork
4. Low - Beef
5. Low - Cereal
6. Low - Pork
Table
Gains in weight (grams) for rats under six diets
differing in level of protein (High or Low) and s
ource of protein (Beef, Cereal, or Pork)

Level
of Protein High Protein Low protein
Source
of Protein Beef Cereal Pork Beef Cereal Pork
Diet 1 2 3 4 5 6
73 98 94 90 107 49
102 74 79 76 95 82
118 56 96 90 97 73
104 111 98 64 80 86
81 95 102 86 98 81
107 88 102 51 74 97
100 82 108 72 74 106
87 77 91 90 67 70
117 86 120 95 89 61
111 92 105 78 58 82
Mean 100.0 85.9 99.5 79.2 83.9 78.7
Std. Dev. 15.14 15.02 10.92 13.89 15.71 16.55
The data as it appears in SPSS
To perform ANOVA select Analyze->General Linear
Model-> Univariate
The following dialog box appears
Select the dependent variable and the fixed factors

Press OK to perform the Analysis


The Output
Tests of Between-Subjects Effects

Dependent Variable: WTGN


Type III
Sum of Mean
Source Squares df Square F Sig.
Corrected Model 4612.933 a 5 922.587 4.300 .002
Intercept 463233.1 1 463233.1 2159.036 .000
SOURCE 266.533 2 133.267 .621 .541
LEVEL 3168.267 1 3168.267 14.767 .000
SOURCE * LEVEL 1178.133 2 589.067 2.746 .073
Error 11586.000 54 214.556
Total 479432.0 60
Corrected Total 16198.933 59
a. R Squared = .285 (Adjusted R Squared = .219)
Example Four factor experiment
Four factors are studied for their effect on Y (luster
of paint film). The four factors are:

1) Film Thickness - (1 or 2 mils)


2) Drying conditions (Regular or Special)
3) Length of wash (10,30,40 or 60 Minutes), and
4) Temperature of wash (92 C or 100 C)

Two observations of film luster (Y) are taken


for each treatment combination
The data is tabulated below:
Regular Dry Special Dry
Minutes 92 C 100 C 92C 100 C
1-mil Thickness
20 3.4 3.4 19.6 14.5 2.1 3.8 17.2 13.4
30 4.1 4.1 17.5 17.0 4.0 4.6 13.5 14.3
40 4.9 4.2 17.6 15.2 5.1 3.3 16.0 17.8
60 5.0 4.9 20.9 17.1 8.3 4.3 17.5 13.9
2-mil Thickness
20 5.5 3.7 26.6 29.5 4.5 4.5 25.6 22.5
30 5.7 6.1 31.6 30.2 5.9 5.9 29.2 29.8
40 5.5 5.6 30.5 30.2 5.5 5.8 32.6 27.4
60 7.2 6.0 31.4 29.6 8.0 9.9 33.5 29.5
The Data as it appears in SPSS
The dialog box for performing ANOVA
The output Tests of Between-Subjects Effects

Dependent Variable: LUSTRE


Type III
Sum of Mean
Source Squares df Square F Sig.
Corrected Model 6548.020 a 31 211.226 76.814 .000
Intercept 12586.035 1 12586.035 4577.000 .000
TEMP 5039.225 1 5039.225 1832.550 .000
COND 5.700 1 5.700 2.073 .160
LENGTH 70.285 3 23.428 8.520 .000
THICK 844.629 1 844.629 307.155 .000
TEMP * COND 15.504 1 15.504 5.638 .024
TEMP * LENGTH 3.155 3 1.052 .383 .766
COND * LENGTH 9.890 3 3.297 1.199 .326
TEMP * COND * LENGTH 6.422 3 2.141 .778 .515
TEMP * THICK 511.325 1 511.325 185.947 .000
COND * THICK 1.410 1 1.410 .513 .479
TEMP * COND * THICK .150 1 .150 .055 .817
LENGTH * THICK 15.642 3 5.214 1.896 .150
TEMP * LENGTH * THICK 11.520 3 3.840 1.396 .262
COND * LENGTH *
7.320 3 2.440 .887 .458
THICK
TEMP * COND * LENGTH
5.840 3 1.947 .708 .554
* THICK
Error 87.995 32 2.750
Total 19222.050 64
Corrected Total 6636.015 63
a. R Squared = .987 (Adjusted R Squared = .974)
Random Effects and Fixed
Effects Factors
So far the factors that we have considered are
fixed effects factors
This is the case if the levels of the factor are a
fixed set of levels and the conclusions of any
analysis is in relationship to these levels.
If the levels have been selected at random from
a population of levels the factor is called a
random effects factor
The conclusions of the analysis will be
directed at the population of levels and not
only the levels selected for the experiment
Example - Fixed Effects

Source of Protein, Level of Protein, Weight Gain


Dependent
Weight Gain
Independent
Source of Protein,
Beef
Cereal
Pork
Level of Protein,
High
Low
Example - Random Effects
In this Example a Taxi company is interested in
comparing the effects of three brands of tires (A, B and
C) on mileage (mpg). Mileage will also be effected by
driver. The company selects b = 4 drivers at random
from its collection of drivers. Each driver has n = 3
opportunities to use each brand of tire in which mileage
is measured.
Dependent
Mileage
Independent
Tire brand (A, B, C),
Fixed Effect Factor
Driver (1, 2, 3, 4),
Random Effects factor
The Model for the fixed effects experiment
yijk i j ij ijk

where , 1, 2, 3, 1, 2, ()11 , ()21 , ()31 ,


()12 , ()22 , ()32 , are fixed unknown constants
And ijk is random, normally distributed with mean 0
and variance s2.
Note:
a n a b


i 1
i
j 1
j
i 1
ij
j 1
ij 0
The Model for the case when factor B is a random
effects factor
yijk i j ij ijk
where , 1, 2, 3, are fixed unknown constants
And ijk is random, normally distributed with mean 0 and
variance s2.
j is normal with mean 0 and variance s B2
and
()ij is normal with mean 0 and variance s AB
2

Note: a


i 1
i 0

This model is called a variance components model


The Anova table for the two factor model

yijk i j ij ijk

Source SS df MS
A SSA a -1 SSA/(a 1)
B SSA b-1 SSB/(a 1)
AB SSAB (a -1)(b -1) SSAB/(a 1) (a 1)

Error SSError ab(n 1) SSError/ab(n 1)


The Anova table for the two factor model (A, B fixed)

yijk i j ij ijk

Source SS df MS EMS F
nb a 2
a 1
A SSA a -1 MSA s 2
i MSA/MSError
i 1

na b 2
b 1
B SSA b-1 MSB s 2
j MSB/MSError
j 1
a b
AB SSAB (a -1)(b -1) MSAB s
2 n
ij2 MSAB/MSError
a 1b 1 i 1 j 1
Error SSError ab(n 1) MSError s2

EMS = Expected Mean Square


The Anova table for the two factor model
(A fixed, B - random)
yijk i j ij ijk

Source SS df MS EMS F
nb a 2
a 1
A SSA a -1 MSA s ns
2 2
AB i MSA/MSAB
i 1

B SSA b-1 MSB s 2 nas B2 MSB/MSError

AB SSAB (a -1)(b -1) MSAB s 2 ns AB


2 MSAB/MSError

Error SSError ab(n 1) MSError s2

Note: The divisor for testing the main effects


of A is no longer MSError but MSAB.
Rules for determining Expected
Mean Squares (EMS) in an Anova
Table
Both fixed and random effects
Formulated by Schultz[1]

1. Schultz E. F., Jr. Rules of Thumb for Determining


Expectations of Mean Squares in Analysis of
Variance,Biometrics, Vol 11, 1955, 123-48.
1. The EMS for Error is s2.
2. The EMS for each ANOVA term contains two
or more terms the first of which is s2.
3. All other terms in each EMS contain both
coefficients and subscripts (the total number
of letters being one more than the number of
factors) (if number of factors is k = 3, then
the number of letters is 4)
4. The subscript of s2 in the last term of each
EMS is the same as the treatment
designation.
5. The subscripts of all s2 other than the first contain
the treatment designation. These are written with
the combination involving the most letters written
first and ending with the treatment designation.
6. When a capital letter is omitted from a subscript ,
the corresponding small letter appears in the
coefficient.
7. For each EMS in the table ignore the letter or letters
that designate the effect. If any of the remaining
letters designate a fixed effect, delete that term from
the EMS.
8. Replace s2 whose subscripts are composed
entirely of fixed effects by the appropriate sum.

i
2

s 2
by i 1
a 1
A


2
ij
s AB
2
by i 1

a 1 b 1
Example: 3 factors A, B, C all are random effects

Source EMS F
A s 2 ns ABC
2
ncs AB
2
nbs AC
2
nbcs A2

B s 2 ns ABC
2
ncs AB
2
nas BC
2
nacs B2

C s 2 ns ABC
2
nas BC
2
nbs AC
2
nabs C2

AB s 2 ns ABC
2
ncs AB
2
MS AB MS ABC

AC s 2 ns ABC
2
nbs AC
2
MS AC MS ABC

BC s 2 ns ABC
2
nas BC
2
MS BC MS ABC

ABC s 2 ns ABC
2
MS ABC MSError

Error s2
Example: 3 factors A fixed, B, C random

Source EMS F
a

A s ns
2 2
ABC ncs 2
AB nbs 2
AC nbc i2 a 1
i 1

B s nas
2 2
BC nacs B2 MS B MS BC

C s 2 nas BC
2
nabs C2 MSC MS BC

AB s 2 ns ABC
2
ncs AB
2
MS AB MS ABC

AC s 2 ns ABC
2
nbs AC
2
MS AC MS ABC

BC s 2 nas BC
2
MSBC MSError

ABC s 2 ns ABC
2
MS ABC MSError

Error s2
Example: 3 factors A , B fixed, C random

Source EMS F
a

A s nbs
2 2
AC nbc i2 a 1 MS A MS AC
i 1
a
s nas
2 2
nac j2 b 1 MS B MS BC
B BC
i 1

C s 2 nabs C2 MSC MSError


a b
s ns nc ij a 1b 1
2 2 2
AB ABC MS AB MS ABC
i 1 j 1

AC s 2 nbs AC
2
MS AC MSError

BC s 2 nas BC
2
MSBC MSError

ABC s 2 ns ABC
2
MS ABC MSError

Error s2
Example: 3 factors A , B and C fixed

Source EMS F
a

A s nbc i2
2
a 1 MS A MS Error
i 1
a

B s nac j2
2
b 1 MS B MS Error
i 1
c

C s 2 nbc k2 c 1 MSC MSError


k 1
a b
s nc ij a 1b 1
2 2
AB MS AB MSError
i 1 j 1
a c
s 2 nb ij a 1 c 1
2
AC i 1 k 1
MS AC MSError
b c

BC s 2 na ij b 1 c 1
2
MSBC MSError
j 1 k 1
a b c
ABC s 2 n ijk a 1b 1 c 1
2
MS ABC MSError
i 1 j 1 k 1

Error s2
Example - Random Effects
In this Example a Taxi company is interested in
comparing the effects of three brands of tires (A, B and
C) on mileage (mpg). Mileage will also be effected by
driver. The company selects at random b = 4 drivers at
random from its collection of drivers. Each driver has n
= 3 opportunities to use each brand of tire in which
mileage is measured.
Dependent
Mileage
Independent
Tire brand (A, B, C),
Fixed Effect Factor
Driver (1, 2, 3, 4),
Random Effects factor
The Data
Driver Tire Mileage Driver Tire Mileage
1 A 39.6 3 A 33.9
1 A 38.6 3 A 43.2
1 A 41.9 3 A 41.3
1 B 18.1 3 B 17.8
1 B 20.4 3 B 21.3
1 B 19 3 B 22.3
1 C 31.1 3 C 31.3
1 C 29.8 3 C 28.7
1 C 26.6 3 C 29.7
2 A 38.1 4 A 36.9
2 A 35.4 4 A 30.3
2 A 38.8 4 A 35
2 B 18.2 4 B 17.8
2 B 14 4 B 21.2
2 B 15.6 4 B 24.3
2 C 30.2 4 C 27.4
2 C 27.9 4 C 26.6
2 C 27.2 4 C 21
Asking SPSS to perform Univariate ANOVA
Select the dependent variable, fixed factors, random factors
The Output

Tests of Between-Subjects Effects

Dependent Variable: MILEAGE


Type III
Sum of Mean
Source Squares df Square F Sig.
Intercept Hypothesis 28928.340 1 28928.340 1270.836 .000
Error 68.290 3 22.763a
TIRE Hypothesis 2072.931 2 1036.465 71.374 .000
Error 87.129 6 14.522b
DRIVER Hypothesis 68.290 3 22.763 1.568 .292
Error 87.129 6 14.522b
TIRE * DRIVER Hypothesis 87.129 6 14.522 2.039 .099
Error 170.940 24 7.123 c
a. MS(DRIVER)
b. MS(TIRE * DRIVER)
c. MS(Error)

The divisor for both the fixed and the random main effect is MSAB

This is contrary to the advice of some texts


The Anova table for the two factor model
(A fixed, B - random)
yijk i j ij ijk
Source SS df MS EMS F
nb a 2
a 1
A SSA a -1 MSA s 2 ns AB
2
i MSA/MSAB
i 1

B SSA b-1 MSB s 2 nas B2 MSB/MSError

AB SSAB (a -1)(b -1) MSAB s 2 ns AB


2
MSAB/MSError

Error SSError ab(n 1) MSError s2

Note: The divisor for testing the main effects of A is no longer


MSError but MSAB.
References Guenther, W. C. Analysis of Variance Prentice Hall, 1964
The Anova table for the two factor model
(A fixed, B - random)
yijk i j ij ijk
Source SS df MS EMS F
nb a 2
a 1
A SSA a -1 MSA s 2 ns AB
2
i MSA/MSAB
i 1

B SSA b-1 MSB s 2 ns AB


2
nas B2 MSB/MSAB

AB SSAB (a -1)(b -1) MSAB s 2 ns AB


2
MSAB/MSError

Error SSError ab(n 1) MSError s2

Note: In this case the divisor for testing the main effects of A is
MSAB . This is the approach used by SPSS.
References Searle Linear Models John Wiley, 1964
Crossed and Nested Factors
The factors A, B are called crossed if every level
of A appears with every level of B in the
treatment combinations.
Levels of B

Levels
of A
Factor B is said to be nested within factor A if the
levels of B differ for each level of A.

Levels of A

Levels of B
Example: A company has a = 4 plants for
producing paper. Each plant has 6 machines for
producing the paper. The company is interested
in how paper strength (Y) differs from plant to
plant and from machine to machine within plant

Plants

Machines
Machines (B) are nested within plants (A)

The model for a two factor experiment with B


nested within A.

yijk i j i ijk
overall mean effect of factor A effect of B within A random error
The ANOVA table

Source SS df MS F p - value

A SSA a-1 MSA MSA/MSError

B(A) SSB(A) a(b 1) MSB(A) MSB(A) /MSError

Error SSError ab(n 1) MSError

Note: SSB(A ) = SSB + SSAB and a(b 1) = (b 1) + (a - 1)(b 1)


Example: A company has a = 4 plants for
producing paper. Each plant has 6 machines for
producing the paper. The company is interested
in how paper strength (Y) differs from plant to
plant and from machine to machine within plant.
Also we have n = 5 measurements of paper
strength for each of the 24 machines
The Data

Plant 1 2
machine 1 2 3 4 5 6 7 8 9 10 11 12
98.7 59.2 84.1 72.3 83.5 60.6 33.6 44.8 58.9 63.9 63.7 48.1
93.1 87.8 86.3 110.3 89.3 84.8 48.2 57.3 51.6 62.3 54.6 50.6
100.0 84.1 83.4 81.6 86.1 83.6 68.9 66.5 45.2 61.1 55.3 39.9
Plant 3 4
machine 13 14 15 16 17 18 19 20 21 22 23 24
83.6 76.1 64.2 69.2 77.4 61.0 64.2 35.5 46.9 37.0 43.8 30.0
84.6 55.4 58.4 86.7 63.3 81.3 50.3 30.8 43.1 47.8 62.4 43.0
90.6 92.3 75.4 60.8 76.6 73.8 32.1 36.3 40.8 41.0 60.8 56.9
Anova Table Treating Factors (Plant, Machine) as
crossed

Tests of Between-Subjects Effects

Dependent Variable: STRENGTH


Type III
Sum of Mean
Source Squares df Square F Sig.
Corrected Model 21031.065 a 23 914.394 7.972 .000
Intercept 298531.4 1 298531.4 2602.776 .000
PLANT 18174.761 3 6058.254 52.820 .000
MACHINE 1238.379 5 247.676 2.159 .074
PLANT * MACHINE 1617.925 15 107.862 .940 .528
Error 5505.469 48 114.697
Total 325067.9 72
Corrected Total 26536.534 71
a. R Squared = .793 (Adjusted R Squared = .693)
Anova Table: Two factor experiment B(machine)
nested in A (plant)

Source Sum of Squares df Mean Square F p - value


Plant 18174.76119 3 6058.253731 52.819506 0.00000
Machine(Plant) 2856.303672 20 142.8151836 1.2451488 0.26171
Error 5505.469467 48 114.6972806

You might also like