week 5 introduction to factorial designspeople.stat.sfu.ca/~jtg3/unit4.pdf · outline basic...
TRANSCRIPT
Week 5Introduction to Factorial Designs
Joslin Goh
Simon Fraser University
Week 5Introduction to Factorial Designs – p. 1/35
Outline
Basic concepts
The two-factor factorial design
The general factorial design
Week 5Introduction to Factorial Designs – p. 2/35
Basic concepts
Factorial designs: Designs in which all possible combinations of the levels of thefactors appear.
Example: The yield of a chemical process is being studied. The two mostimportant variables are thought to be the pressure and the temperature. Three
levels of each factor are selected, and a factorial experiment with two replicates isperformed. The yield data follow:
Pressure(psi)
Temperature(0C) 200 215 230
150 90.4 90.7 90.2
90.2 90.6 90.4
160 90.1 90.5 89.9
90.3 90.6 90.1
170 90.5 90.8 90.4
90.7 90.9 90.1
Week 5Introduction to Factorial Designs – p. 3/35
Advantages
Advantage over one-factor-at-a-time design
Less runs
Allows the interactions to be detected and estimated
Week 5Introduction to Factorial Designs – p. 4/35
Simple model
yijk = µij + ǫijk ,
whereyijk is the k-th observation for the ij-th treatmentµij is the mean response given by the i-th level of A and thej-th level of factor B.
Week 5Introduction to Factorial Designs – p. 5/35
Simple Maths
µ =1
ab
a∑
i=1
b∑
j=1
µij
µi. =1
b
b∑
j=1
µij
µ.j =1
a
a∑
i=1
µij
αi = µi. − µ , βj = µ.j − µ
Week 5Introduction to Factorial Designs – p. 6/35
Main Effect
Main effect: The change in the average response produced by a change in the
level of the factor.
Example: Consider two factors A and B each at two levels.
A B Response
+ + 52
+ - 40
- + 30
- - 20
Week 5Introduction to Factorial Designs – p. 7/35
Interaction Effect
Interaction effect of AB: The average difference in two A effects, one at low
level of factor B and the other at high level of factor B
Example: Consider two factors A and B each at two levels.
A B Response
+ + 12
+ - 50
- + 40
- - 20
INT(AB) = 12−40−(50−20)2
= −28
Week 5Introduction to Factorial Designs – p. 8/35
Blank page for more notes
You might want to have extra papers and a calculator?
Week 5Introduction to Factorial Designs – p. 9/35
Two Factor Fractional Design
General arrangement for a two-factor factorial design
Factor B
1 2 · · · b
Factor A
1 y111, y112 y121, y122 · · · y1b1, y1b2
· · · , y11n · · · , y12n · · · · · · , y1bn2 y211, y212 y221, y222 · · · y2b1, y2b2
· · · , y21n · · · , y22n · · · · · · , y2bn... · · · · · · · · · · · ·
· · · · · · · · · · · ·i yi11, yi12 yi21, yi22 · · · yib1, yib2
· · · , yi1n · · · , yi2n · · · · · · , yibn... · · · · · · · · · · · ·
· · · · · · · · · · · ·a ya11, ya12 ya21, ya22 · · · yab1, yab2
· · · , ya1n · · · , ya2n · · · · · · , yabn
Week 5Introduction to Factorial Designs – p. 10/35
Randomization
How is this a randomized design? Or is it even arandomized design?
How about blocking?
Week 5Introduction to Factorial Designs – p. 11/35
Model
yijk = µ+ τi + βj + (τβ)ij + ǫijk
where
i = 1, . . . , a; j = 1, . . . , b; k = 1, . . . , n
µ: the overall mean
τi: i-th treatment effect of factor A,∑
i τi = 0
βj : j-th treatment effect of factor B,∑
j βj = 0
(τβ)ij : interaction effect between τi and βj ,∑
i(τβ)ij =∑
j(τβ)ij = 0
ǫijk: experimental error iid∼ N(0, σ2)
Week 5Introduction to Factorial Designs – p. 12/35
Estimation
Define:
yi.. =b
∑
j=1
n∑
k=1
yijk yi.. =yi..
bn
y.j. =a
∑
i=1
n∑
k=1
yijk y.j. =y.j.
an
yij. =n∑
k=1
yijk yij. =yij.
n
y... =
a∑
i=1
b∑
j=1
n∑
k=1
yijk y... =y...
abn
Week 5Introduction to Factorial Designs – p. 13/35
To obtain the estimate,
Normal equations:
µ : abnµ+ bna∑
i=1
τi + anb∑
j=1
βj + na∑
i=1
b∑
j=1
ˆ(τβ)ij = y...
τi : bnµ+ bnτi + n
b∑
j=1
βj + n
b∑
j=1
ˆ(τβ)ij = yi..
βj : anµ+ n
a∑
i=1
τi + anβj + n
a∑
i=1
ˆ(τβ)ij = y.j.
(τβ)ij : nµ+ nτi + nβj + n ˆ(τβ)ij = yij.
Constraints:∑ai=1 τi = 0
∑ai=1
ˆ(τβ)ij = 0 j = 1, . . . , b∑b
j=1 βj = 0∑b
j=1ˆ(τβ)ij = 0 i = 1, . . . , a
Week 5Introduction to Factorial Designs – p. 14/35
The estimates are
µ = y...
τi = yi.. − y...
βj = y.j. − y...
ˆ(τβ)ij = yij. − yi.. − y.j. + y...
yijk = µ+ τi + βj + ˆ(τβ)ij = yij.
Week 5Introduction to Factorial Designs – p. 15/35
Hypothesis test
Three hypothesis are of interest. They are.
H0 : τ1 = τ2 = · · · = τa = 0
H1 : τi 6= 0 ∃ i
H0 : β1 = β2 = · · · = βb = 0
H1 : βj 6= 0 ∃ j
H0 : (τβ)ij = 0 for all i, j
H1 : ∃ i 6= j, (τβ)ij 6= 0
Week 5Introduction to Factorial Designs – p. 16/35
Analysis of variance
Define:
SSTotal =a∑
i=1
b∑
j=1
n∑
k=1
(yijk − y...)2
=∑
i
∑
j
∑
k
y2ijk −
y2...
abn
SSA = bna∑
i=1
(yi.. − y...)2
=1
bn
∑
i
y2i.. −
y2...
abn
SSB = anb∑
j=1
(y.j. − y...)2
=1
an
∑
j
y2.j. −
y2...
abn
SSAB = n
a∑
i=1
b∑
j=1
(yij. − yi.. − y.j. + y...)2=
1
n
∑
i
∑
j
y2ij. −
y2...
abn− SSA − SSB
SSError =a∑
i=1
b∑
j=1
n∑
k=1
(yijk − yij.)2
We have
SSTotal = SSA + SSB + SSAB + SSError
Week 5Introduction to Factorial Designs – p. 17/35
ANOVA Table
Source Sum of Squares D.O.F. Mean Squares F
A Treatments SSA a− 1 MSA = SSAa−1
MSA
MSError
B Treatments SSB b− 1 MSB = SSBb−1
MSB
MSError
Interaction SSAB (a− 1)(b− 1) MSAB = SSAB(a−1)(b−1)
MSAB
MSError
Error SSError ab(n− 1) MSError = SSErrorab(n−1)
MSA
MSError
H0∼ Fa−1,ab(n−1)
MSB
MSError
H0∼ Fb−1,ab(n−1)
MSAB
MSError
H0∼ F(a−1)(b−1),ab(n−1)
Week 5Introduction to Factorial Designs – p. 18/35
More blanks!
Week 5Introduction to Factorial Designs – p. 19/35
Multiple comparisons
Case 1: The interactions are not significant, we can compare µ+ τi and µ+ τj
by using the statistics
tij =yi.. − yj..√2MSError
nb
Fisher LSD method claims µ+ τi and µ+ τj are significantly different atlevel α if |tij | > tα/2,ab(n−1)
Tukey method claims µ+ τi and µ+ τj are significantly different at level α if|tij | >
qα,a,ab(n−1)√2
Week 5Introduction to Factorial Designs – p. 20/35
Case 2: The interactions are significant. We can make comparison at fixed level of theother factor.For example: Fix the temperature at level 2 (700F )
y12. = 57.25 (Material type 1)
y22. = 119.75 (Material type 2)
y32. = 145.75 (Material type 3)
3 V S. 1 | y32. − y12.√
2MSError/n| = |145.75− 57.25
√
2 ∗ 675.21/4| = 4.817 >
qα,3,27√2
= 2.479
3 V S. 2 | y32. − y22.√
2MSError/n| = |145.75− 119.75
√
2 ∗ 675.21/4| = 1.415 <
qα,3,27√2
= 2.479
2 V S. 1 | y22. − y12.√
2MSError/n| = |119.75− 57.25
√
2 ∗ 675.21/4| = 3.402 >
qα,3,27√2
= 2.479
Week 5Introduction to Factorial Designs – p. 21/35
Model adequacy checking
Residuals: rijk = yijk − yijk = yijk − yij.
Week 5Introduction to Factorial Designs – p. 22/35
Example
An example
An engineer is designing a battery for use in a device that will be subjected to some extremevariations in temperature. The only design parameter that he can select at this point is theplate material for the battery, and he has three possible choices. When the devices ismanufactured and is shipped to the filed, the engineer has no control over the temperatureextremes that the device will encounter, and he knows from experience that temperature willprobably affect the effective battery life. However, temperature can be controlled in theproduct development laboratory for the purpose of a test. The engineer decides to test allthree plate materials at three temperature levels – 15, 90, and 1250F because thesetemperature levels are consistent with the product end-use environment.
The engineer wants to answer the following questions:
a. What effects do material type and temperature have on the life of the battery?
b. Is there a choice of material that would give uniformly long life regardless oftemperature?
Week 5Introduction to Factorial Designs – p. 23/35
All combinations of plate material and temperature are tested. Four batteries aretested at each combination of plate material and temperature. All 36 tests are run
in random order.
Material TypeTemperature(0F )
15 70 125
1 130 155 34 40 20 70
74 180 80 75 82 58
2 150 188 136 122 25 70
159 126 106 115 58 45
3 138 110 174 120 96 104
168 160 150 139 82 60
Week 5Introduction to Factorial Designs – p. 24/35
Useful Plots
M1 M2 M3
5010
015
0
material
resp
onse
125F 15F 70F
5010
015
0
temperature
resp
onse
6080
100
140
battery$material
mea
n of
bat
tery
$res
pons
e
M1 M2 M3
battery$temperature
70F15F125F
6080
100
140
battery$temperature
mea
n of
bat
tery
$res
pons
e
125F 15F 70F
battery$material
M3M2M1
Week 5Introduction to Factorial Designs – p. 25/35
# Fit the model
> g <- lm(response ˜ material * temperature, battery)
> anova(g)
Analysis of Variance Table
Response: response
Df Sum Sq Mean Sq F value Pr(>F)
material 2 10684 5342 7.9114 0.001976 **temperature 2 39119 19559 28.9677 1.909e-07 ***material:temperature 4 9614 2403 3.5595 0.018611 *Residuals 27 18231 675
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Note : You can also use the command
g <- lm(response ˜ material+temperature+material * temperature, battery)
Conclusion : Both factors and their interactions are statistically significant.
Week 5Introduction to Factorial Designs – p. 26/35
Useful Plots
−2 −1 0 1 2
−60
−20
20
Normal Q−Q Plot
Theoretical Quantiles
Sam
ple
Qua
ntile
s
0 5 10 15 20 25 30 35
−60
−20
20
run order
Res
idua
ls60 80 100 120 140 160
−60
−20
20
fitted vlaue
Res
idua
ls
1.0 1.5 2.0 2.5 3.0
−60
−20
20c(materials)
g$re
s
1.0 1.5 2.0 2.5 3.0
−60
−20
20
c(temperatures)
g$re
s
Week 5Introduction to Factorial Designs – p. 27/35
Check for interaction
a. Model
b. ANOVA table
> g <- lm(response ˜ material+temperature, battery)
> anova(g)
Analysis of Variance Table
Response: response
Df Sum Sq Mean Sq F value Pr(>F)
material 2 10684 5342 5.9472 0.006515 **temperature 2 39119 19559 21.7759 1.239e-06 ***Residuals 31 27845 898
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
c. Fitted value yijk = yi.. + y.j. − y...
Week 5Introduction to Factorial Designs – p. 28/35
Interaction?
40 60 80 100 120 140 160
−20
−10
010
20
fitted
diffe
renc
e
Week 5Introduction to Factorial Designs – p. 29/35
A Reasonable Design
One observation per cell (n = 1)
yij = µ+ τi + βj + (τβ)ij + ǫij
Problem :
Possible solution :
Week 5Introduction to Factorial Designs – p. 30/35
ANOVA Table
For a two-factor model with one observation per cell
Source Sum of Squares D.O.F. Mean Square Expected Mean Square
A∑a
i=1
y2i.
b−
y2..
aba− 1 MSA σ2 +
b∑
i τ2i
a−1
B∑b
j=1
y2.j
a−
y2..
abb− 1 MSB σ2 +
a∑
j β2j
b−1
Error or AB Subtraction (a− 1)(b− 1) MSError σ2 +∑
i
∑j(τβ)
2ij
(a−1)(b−1)
Total∑a
i=1
∑bj=1 y
2ij −
y2..
abab− 1
Week 5Introduction to Factorial Designs – p. 31/35
Tukey test is used for determining whether interaction is present.
Assumption: (τβ)ij = γτiβj where γ is an unknown parameter.
Procedure: Define
SSN =[∑a
i=1
∑bj=1 yijyi.y.j − y..(SSA + SSB +
y2..
ab)]2
abSSASSB
SS∗Error = SSError − SSN
and compute
F =SSN
SS∗Error/[(a− 1)(b− 1)− 1]
If F > Fα,1,(a−1)(b−1)−1 ,
Week 5Introduction to Factorial Designs – p. 32/35
Example: Tukey test of no interaction
TemperaturePressure
25 30 35 40 45 yi.
100 5 4 6 3 5 23
125 3 1 4 2 3 13
150 1 1 3 1 2 8
y.j 9 6 13 6 10 44 = y..
SSTotal = 166 − 129.07 = 36.93
SSA =1
5[23
2+ 13
2+ 8
2] −
442
3 ∗ 5= 23.33
SSB =1
3[9
2+ 6
2+ 13
2+ 6
102] −
442
3 ∗ 5= 11.60
SSError = SSTotal − SSA − SSB = 2.00
SSN =[7236 − 44 ∗ (23.33 + 11.60 + 129.07)]2
3 ∗ 5 ∗ 23.33 ∗ 11.60= 0.0985
SS∗
Error = SSError − SSN = 1.9015
Week 5Introduction to Factorial Designs – p. 33/35
The General Factorial Design
Design :
Consider p factors. Suppose that ith factor has mi levels and each treatment hasn replicates. A factorial design has n
∏pi=1 mi runs whose order is completely
random.
Analysis :Model, estimation, hypothesis test, multiple comparisons, and residual analysis
are similar to those for a two-factor factorial design.
Week 5Introduction to Factorial Designs – p. 34/35
Source Sum of Squares D.O.F
A∑a
i=1 nbc(αi)2 a− 1
B∑b
j=1 nac(βj)2 b− 1
C∑c
k=1 nab(δk)2 c− 1
A×B∑a
i=1
∑bj=1 nc((αβ)ij)
2 (a− 1)(b− 1)
A× C∑a
i=1
∑ck=1 nb((αδ)ik)
2 (a− 1)(c− 1)
B × C∑b
j=1
∑ck=1 na((βδ)jk)
2 (b− 1)(c− 1)
A×B × C∑a
i=1
∑bj=1
∑ck=1 n(
ˆ(γ)ijk)2 (a− 1)(b− 1)(c− 1)
Error∑a
i=1
∑bj=1
∑ck=1
∑nl=1(yijkl − yijk.)
2 abc(n− 1)
Total∑a
i=1
∑bj=1
∑ck=1
∑nl=1(yijkl − y....)
2 abcn− 1
Week 5Introduction to Factorial Designs – p. 35/35