2k Factorial Lesson 2
2k Factorial Lesson 2
2k Factorial Lesson 2
Fall , 2005
Page 1
Statistics 514: 2k Factorial Design
2k Factorial Design
• Involving k factors
• Each factor has two levels (often labeled + and −)
• Factor screening experiment (preliminary study)
• Identify important factors and their interactions
• Interaction (of any order) has ONE degree of freedom
• Factors need not be on numeric scale
• Ordinary regression model can be employed
y = β0 + β1 x1 + β2 x2 + β12 x1 x2 +
Where β1 , β2 and β12 are related to main effects, interaction effects defined
later.
Fall , 2005
Page 2
Statistics 514: 2k Factorial Design
22 Factorial Design
Example:
factor replicate
A B treatment 1 2 3 mean
− − (1) 28 25 27 80/3
+ − a 36 32 32 100/3
− + b 18 19 23 60/3
+ + ab 31 30 29 90/3
• Let ȳ(A+ ), ȳ(A− ), ȳ(B+ ) and ȳ(B− ) be the level means of A and B.
• Let ȳ(A− B− ), ȳ(A+ B− ), ȳ(A− B+ ) and ȳ(A+ B+ ) be the treatment
means
Fall , 2005
Page 3
Statistics 514: 2k Factorial Design
• Notice that
Main effect is defined in a different way than Chapter 5. But they are
connected and equivalent.
Fall , 2005
Page 4
Statistics 514: 2k Factorial Design
• Similarly
1 1
= (ȳ(A+ | B+ ) − ȳ(A− | B+ )) − (ȳ(A+ | B− ) − ȳ(A− | B− ))
2 2
= 12 (ȳ(A− B− ) − ȳ(A+ B− ) − ȳ(A− B+ ) + ȳ(A+ B+ )) =1.67
Let CAB = (1, −1, −1, 1), a contrast on treatment means, then
AB =Int(AB )= 12 ĈAB
Fall , 2005
Page 5
Statistics 514: 2k Factorial Design
A B total mean I A B AB
− − 80 80/3 1 -1 -1 1
+ − 100 100/3 1 1 -1 -1
− + 60 60/3 1 -1 1 -1
+ + 90 90/3 1 1 1 1
where i is an index for treatments and the summation is over all treatments.
Fall , 2005
Page 6
Statistics 514: 2k Factorial Design
• Because effects are defined using contrasts, their sum of squares can also be
calculated through contrasts.
Fall , 2005
Page 7
Statistics 514: 2k Factorial Design
P 2
2
y...
• Total sum of squares: SST = i,j,k yijk − N
• ANOVA Table
Source of Sum of Degrees of Mean
Fall , 2005
Page 8
k
Statistics 514: 2 Factorial Design
Fall , 2005
Page 9
Statistics 514: 2k Factorial Design
model resp=A|B;
run;
---------------------------------------------------
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 3 291.6666667 97.2222222 24.82 0.0002
Error 8 31.3333333 3.9166667
Cor Total 11 323.0000000
Fall , 2005
Page 10
Statistics 514: 2k Factorial Design
A x1 B x2
- -1 - -1
+ 1 + 1
y = β0 + β1 x1 + β2 x2 + β12 x1 x2 +
A B AB
y = ȳ.. + x1 + x2 + x1 x2
2 2 2
i.e. the estimated coefficients are half of the effects, respectively.
Fall , 2005
Page 11
k
Statistics 514: 2 Factorial Design
Fall , 2005
Page 12
Statistics 514: 2k Factorial Design
Analysis of Variance
Sum of Mean
Source DF Squares Square F Value Pr > F
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Fall , 2005
Page 13
Statistics 514: 2k Factorial Design
23 Factorial Design
Bottling Experiment:
factor response
A B C treatment 1 2 total
− − − (1) -3 -1 -4
+ − − a 0 1 1
− + − b -1 0 -1
+ + − ab 2 3 5
− − + c -1 0 -1
+ − + ac 2 1 3
− + + bc 1 1 2
+ + + abc 6 5 11
Fall , 2005
Page 14
Statistics 514: 2k Factorial Design
Main effects:
2-factor interactions:
AB : A × B componentwise, AB=.75
AC : A × C componentwise, AC=.25
BC : B × C componentwise, BC=.50
Fall , 2005
Page 15
Statistics 514: 2k Factorial Design
3-factor interaction:
1
ABC = int(ABC) = (int(AB | C+) − int(AB | C−))
2
= 14 (−ȳ(− − −) + ȳ(+ − −) + ȳ(− + −) − ȳ(+ + −)
+ȳ(− − +) − ȳ(+ − +) − ȳ(− + +) + ȳ(+ + +))
=.50
Fall , 2005
Page 16
Statistics 514: 2k Factorial Design
factorial effects
A B C treatment I A B AB C AC BC ABC
− − − (1) 1 -1 -1 1 -1 1 1 -1
+ − − a 1 1 -1 -1 -1 -1 1 1
− + − b 1 -1 1 -1 -1 1 -1 -1
+ + − ab 1 1 1 1 -1 -1 -1 1
− − + c 1 -1 -1 1 1 -1 -1 1
+ − + ac 1 1 -1 -1 1 1 -1 -1
− + + bc 1 -1 1 -1 1 -1 1 -1
+ + + abc 1 1 1 1 1 1 1 1
Fall , 2005
Page 17
Statistics 514: 2k Factorial Design
Estimates:
P
ȳi.
grand mean:
23
P
ci ȳi.
effect :
23−1
Contrast Sum of Squares:
P
( ci ȳi. )2 2
SSeffect = = 2n(effect)
23 /n
Variance of Estimate
σ2
Var(effect) =
n23−2
t-test for effects (confidence interval approach)
Fall , 2005
Page 18
Statistics 514: 2k Factorial Design
Regresson Model
Code the levels of factor A and B as follows
A x1 B x2 C x3
- -1 - -1 - -1
+ 1 + 1 + 1
A B C AB AC BC ABC
y = ȳ.. + x1 + x2 + x3 + x1 x2 + x1 x3 + x2 x3 + x1 x2 x3
2 2 2 2 2 2 2
i.e. β̂ = effect
2
, and
σ2 σ2
Var(β̂) = =
n2k n23
Fall , 2005
Page 19
k
Statistics 514: 2 Factorial Design
Fall , 2005
Page 20
Statistics 514: 2k Factorial Design
;
proc glm;
class A B C; model devi=A|B|C;
output out=botone r=res p=pred;
run;
proc univariate data=botone pctldef=4;
var res; qqplot res / normal (L=1 mu=est sigma=est);
histogram res / normal; run;
proc gplot; plot res*pred/frame; run;
data bottlenew;
set bottle;
x1=A; x2=B; x3=C; x1x2=x1*x2; x1x3=x1*x3; x2x3=x2*x3;
x1x2x3=x1*x2*x3; drop A B C;
Fall , 2005
Page 21
Statistics 514: 2k Factorial Design
ANOVA Model:
Fall , 2005
Page 22
Statistics 514: 2k Factorial Design
Regression Model:
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Fall , 2005
Page 23
Statistics 514: 2k Factorial Design
General 2k Design
Fall , 2005
Page 24
Statistics 514: 2k Factorial Design
Fall , 2005
Page 25
Statistics 514: 2k Factorial Design
• Estimates:
P
ȳi
grand mean :
2k
For effect with constrast C = (c1 , c2 , . . . , c2k ), its estimate is
P
ci ȳi
effect = (k−1)
2
• Variance
σ2
Var(effect) =
n2k−2
what is the standard error of the effect?
Fall , 2005
Page 26
Statistics 514: 2k Factorial Design
• SST and SSE can be calculated as before and a ANOVA table including SS due to
the effests and SSE can be constructed and the effects can be tested by F -tests.
Using regression:
• Introducing variables x1 , . . . , xk for main effects, their products are used for
interactsions, the following regression model can be fitted
y = β0 + β1 x1 + . . . + βk xk + . . . + β12···k x1 x2 · · · xk +
The coefficients are estimated by half of effects they represent, that is,
effect
β̂ =
2
Fall , 2005
Page 27
Statistics 514: 2k Factorial Design
Unreplicated 2k Design
Filtration Rate Experiment
Fall , 2005
Page 28
Statistics 514: 2k Factorial Design
factor
A B C D filtration
− − − − 45
+ − − − 71
− + − − 48
+ + − − 65
− − + − 68
+ − + − 60
− + + − 80
+ + + − 65
− − − + 43
+ − − + 100
− + − + 45
+ + − + 104
− − + + 75
+ − + + 86
− + + + 70
+ + + + 96
Fall , 2005
Page 29
Statistics 514: 2k Factorial Design
Unreplicated 2k Design
• No error sum of squares available, cannot estimate σ 2 and test effects in both
the ANOVA and Regression approaches.
Fall , 2005
Page 30
Statistics 514: 2k Factorial Design
Unreplicated 2k Design
• Approach 2: Using the normal probability plot (QQ plot) to identify significant
effects.
– Recall
σ2
Var(effect) =
2(k−2)
If the effect is not significant (=0), then the effect estimate follows
σ2
N (0, 2(k−2) )
– Assume all effects not significant, their estimates can be considered as a
σ2
random sample from N (0, 2(k−2) )
Fall , 2005
Page 31
k
Statistics 514: 2 Factorial Design
goption colors=(none);
data filter;
do D = -1 to 1 by 2;do C = -1 to 1 by 2;
do B = -1 to 1 by 2;do A = -1 to 1 by 2;
input y @@; output;
end; end; end; end;
datalines;
45 71 48 65 68 60 80 65 43 100 45 104 75 86 70 96
;
Fall , 2005
Page 32
Statistics 514: 2k Factorial Design
Fall , 2005
Page 33
k
Statistics 514: 2 Factorial Design
Ranked Effects
Fall , 2005
Page 35
Statistics 514: 2k Factorial Design
QQ plot
Fall , 2005
Page 36
Statistics 514: 2k Factorial Design
Fit a linear line based on small effects, identify the effects which are potentially
significant, then use ANOVA or regression fit a sub-model with those effects.
Fall , 2005
Page 37
Statistics 514: 2k Factorial Design
proc sort; by A C;
proc means noprint;
var y; by A C;
output out=ymeanac mean=mn;
Fall , 2005
Page 38
Statistics 514: 2k Factorial Design
Fall , 2005
Page 39
Statistics 514: 2k Factorial Design
Fall , 2005
Page 40
Statistics 514: 2k Factorial Design
Fall , 2005
Page 41
k
Statistics 514: 2 Factorial Design
Regression Model
* the same date step
===========================
Dependent Variable: y
Analysis of Variance
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 5 5535.81250 1107.16250 56.74 <.0001
Error 10 195.12500 19.51250
Corrected Total 15 5730.93750
Fall , 2005
Page 42
Statistics 514: 2k Factorial Design
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Fall , 2005
Page 43
Statistics 514: 2k Factorial Design
Contour plot
goption colors=(none);
data one;
do x1 = -1 to 1 by .1;
do x3 = -1 to 1 by .1;
y=77.37+19.12*x1 +4.94*x3 -9.06*x1*x3 ; output;
end; end;
proc gcontour data=one; plot x3*x1=y;
run; quit;
Fall , 2005
Page 44
Statistics 514: 2k Factorial Design
Fall , 2005
Page 45
Statistics 514: 2k Factorial Design
Residual Plot
Fall , 2005
Page 46
Statistics 514: 2k Factorial Design
Half normal plot can also be used for identifying important factorial effects
Fall , 2005
Page 47
Statistics 514: 2k Factorial Design
measurements
Fall , 2005
Page 48