chapter 5 factorial experiments

51
Chapter 5 Factorial Experiments ( .@) &5² Design and Analysis of Experiments (Douglas C. Montgomery) hsuhl (NUK) DAE Chap. 5 1 / 51

Upload: khangminh22

Post on 20-Feb-2023

5 views

Category:

Documents


0 download

TRANSCRIPT

Chapter 5 Factorial Experiments

(因因因子子子實實實驗驗驗)

許湘伶

Design and Analysis of Experiments(Douglas C. Montgomery)

hsuhl (NUK) DAE Chap. 5 1 / 51

Basic definitions

study if the effects of two or more factors

factorial design are most efficient for experiments with morefactors

main effect: the change in response produced by a change in thelevel of the factor

hsuhl (NUK) DAE Chap. 5 2 / 51

Basic definitions (cont.)

factor at two levels: {low level: −

high level: +

a factor effect: The change in the mean response when the factoris changed from low to high

hsuhl (NUK) DAE Chap. 5 3 / 51

Basic definitions (cont.)

A =yA+ − yA− =40 + 52

2− 20 + 30

2= 21(= 2β1)

B =yB+ − yB− =30 + 52

2− 20 + 40

2= 11(= 2β2)

AB =52 + 20

2− 30 + 40

2= 1(= 2β12)

hsuhl (NUK) DAE Chap. 5 4 / 51

Basic definitions (cont.)

Regression Model:

y = β0 + β1x1 + β2x2 + β12x1x2

= 35.5 + 10.5x1 + 5.5x2 + 0.5x1x2

β0 = the average of all for responses =20 + 40 + 30 + 52

4

hsuhl (NUK) DAE Chap. 5 5 / 51

Basic definitions (cont.)

Regression Model with interaction:

y = 35.5 + 10.5x1 + 5.5x2 + 8x1x2

Interaction is actually a form of curvature

hsuhl (NUK) DAE Chap. 5 6 / 51

Basic definitions (cont.)

A =yA+ − yA− =50 + 12

2− 20 + 40

2= 1(= 2β1)

B =yB+ − yB− =40 + 12

2− 20 + 50

2= −9(= 2β2)

AB =12 + 20

2− 40 + 50

2= −29(= 2β12)

hsuhl (NUK) DAE Chap. 5 7 / 51

Advantages of factorial designs

more efficient than one-factor-at-a-time experimentnecessary when the interactions may be present to avoidmisleading conclusionsfactorial designs allow the effects of a factor to be estimated atseveral levels of the other factors

hsuhl (NUK) DAE Chap. 5 8 / 51

Two factor factorial design

Battery Life Experiment

Two factors: A=Material type; B=Temperature (quantitativevariable)

32 factorial design: each factor has three levels

hsuhl (NUK) DAE Chap. 5 9 / 51

Two factor factorial design (cont.)

Questions

1 What effects do material type and temperature have on thelife of the battery?

2 Is there a choice of material that would give uniformly longlife regardless of temperature? (robust design)

robust product design: a very important engineering problem

hsuhl (NUK) DAE Chap. 5 10 / 51

Two factor factorial design (cont.)

Notations:yijk: observed responseA=Material type; a levels; i = 1, . . . , aB=Temperature; b levels; j = 1, . . . , bn replicates; k = 1, . . . , n

hsuhl (NUK) DAE Chap. 5 11 / 51

Two factor factorial design (cont.)

a completely randomized design

the effects model:

yijk = µ+ τi + βj + (τβ)ij + εijk

i = 1, 2, . . . , aj = 1, . . . , bk = 1, . . . , n

Restrictions:∑i

τi = 0;∑

j

βj = 0;∑

i

(τβ)ij =∑

j

(τβ)ij = 0

abn total observations

hsuhl (NUK) DAE Chap. 5 12 / 51

Two factor factorial design (cont.)

normal equations: (the method of Section 3.10)

µ : abnµ+ bna∑

i=1

τi + anb∑

j=1

βj + na∑

i=1

b∑j=1

(τβ)ij = y···

τi : bnµ+ bnτi + nb∑

j=1

βj + nb∑

j=1

(τβ)ij = yi··, i = 1, . . . , a

βj : anµ+ na∑

i=1

τi + anβj + na∑

i=1

(τβ)ij = y·j·, j = 1, . . . , b

(τβ)ij : nµ+ nτi + nβj + n(τβ)ij = yij·, i = 1, . . . , a; j = 1, . . . , b

hsuhl (NUK) DAE Chap. 5 13 / 51

Two factor factorial design (cont.)

Estimating:

µ = y···τi = yi·· − y···

βj = y·j· − y···

(τβ)ij= yij· − yi·· − y·j· + y···

{i = 1, . . . , aj = 1, . . . , b

yijk = µ+ τi + βj + (τβ)ij = yij·

hsuhl (NUK) DAE Chap. 5 14 / 51

Two factor factorial design (cont.)

Hypotheses:

the equality of row treatment effects:

H0 : τ1 = τ2 = . . . = τa = 0 vs. H1 : at least one τi 6= 0

the equality of column treatment effects:

H0 : β1 = β2 = . . . = βb = 0 vs. H1 : at least one βj 6= 0

the equality of row and column treatments interact:

H0 : (τβ)ij for all i, j vs. H1 : at least one (τβ)ij 6= 0

hsuhl (NUK) DAE Chap. 5 15 / 51

Two factor factorial design (cont.)

total corrected sum of squares:

a∑i=1

b∑j=1

n∑k=1

(yijk − y···)2 =bna∑

i=1

(yi·· − y···)2 + anb∑

j=1

(y·j· − y···)2

+ na∑

i=1

b∑j=1

(yij· − yi·· − y·j· + y···)2

+a∑

i=1

b∑j=1

n∑k=1

(yijk − yij·)2

SSTabn−1

=SSAa−1

+ SSBb−1

+ SSAB(a−1)(b−1)

+ SSEab(n−1)

at least two replicates (n ≥ 2)

hsuhl (NUK) DAE Chap. 5 16 / 51

Two factor factorial design (cont.)

E(MSA) = σ2 +bn∑a

i=1 τ2i

a− 1E(MEB) = σ2 +

an∑b

i=1 β2i

n− 1

E(MSAB) = σ2 +n∑a

i=1

∑bj=1(τβ)2

ij

(a− 1)(b− 1)E(MSE) = σ2

If the null hypotheses of no row treatment effects, no columntreatment effects, and no interaction are true, then the MSA, MSB,MSAB, and MSE all estimate σ2.

hsuhl (NUK) DAE Chap. 5 17 / 51

Two factor factorial design (cont.)

hsuhl (NUK) DAE Chap. 5 18 / 51

Two factor factorial design (cont.)

hsuhl (NUK) DAE Chap. 5 19 / 51

Two factor factorial design (cont.)

> battery<-read.table("battery.txt",header=T)> battery$Material<-as.factor(battery$Material)> battery$Temperature<-as.factor(battery$Temperature)> battery.aov <- aov(Life˜Material*Temperature,data=battery)> summary( battery.aov)

Df Sum Sq Mean Sq F value Pr(>F)Material 2 10684 5342 7.911 0.00198 **Temperature 2 39119 19559 28.968 1.91e-07 ***Material:Temperature 4 9614 2403 3.560 0.01861 *Residuals 27 18231 675---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

hsuhl (NUK) DAE Chap. 5 20 / 51

Two factor factorial design (cont.)

hsuhl (NUK) DAE Chap. 5 21 / 51

Two factor factorial design (cont.)

some mild tendency for the variance of the residuals to increase asthe battery life increasesmild inequality of variance

hsuhl (NUK) DAE Chap. 5 22 / 51

Two factor factorial design (cont.)

Homogeneity variance> ## Homogeneous variance test> #1. Bartlett Test of Homogeneity of Variances> battery.Maov <- aov(Life˜Material,data=battery)> bartlett.test(battery.Maov $residuals ˜ Material, data = battery)

Bartlett test of homogeneity of variances

data: battery.Maov$residuals by MaterialBartlett’s K-squared = 1.2961, df = 2, p-value = 0.5231

> battery.Taov <- aov(Life˜Temperature,data=battery)> bartlett.test( battery.Taov$residuals ˜ Temperature, data = battery)

Bartlett test of homogeneity of variances

data: battery.Taov$residuals by TemperatureBartlett’s K-squared = 2.8321, df = 2, p-value = 0.2427

hsuhl (NUK) DAE Chap. 5 23 / 51

Two factor factorial design (cont.)

Homogeneity of variance for Two-Way ANOVA> split(battery.aov$residuals,list(battery$Temperature,battery$Material))$‘15.1‘

1 2 3 4-4.75 -60.75 20.25 45.25

$‘70.1‘13 14 15 16

-23.25 22.75 -17.25 17.75

$‘125.1‘25 26 27 28

-37.5 24.5 12.5 0.5

$‘15.2‘5 6 7 8

-5.75 3.25 32.25 -29.75

$‘70.2‘17 18 19 20

16.25 -13.75 2.25 -4.75

hsuhl (NUK) DAE Chap. 5 24 / 51

Two factor factorial design (cont.)

# the first kind of codes for two-way anova> bartlett.test(split(battery.aov$residuals,list(battery$Temperature,battery$Material)))

Bartlett test of homogeneity of variances

data: split(battery.aov$residuals, list(battery$Temperature, battery$Material))Bartlett’s K-squared = 5.2354, df = 8, p-value = 0.7321

# the second kind of codes for two-way anova> bartlett.test(battery.aov$residuals˜ interaction(battery$Material,battery$Temperature))

Bartlett test of homogeneity of variances

data: battery.aov$residuals by interaction(battery$Material, battery$Temperature)Bartlett’s K-squared = 5.2354, df = 8, p-value = 0.7321

hsuhl (NUK) DAE Chap. 5 25 / 51

Two factor factorial design (cont.)

> #2. Levene’s Test of Equality of Variances> library(lawstat)> levene.test(battery.Maov$residuals, battery$Material, location="median")

modified robust Brown-Forsythe Levene-type test based on the absolute deviations from the median

data: battery.Maov$residualsTest Statistic = 0.2796, p-value = 0.7578

> levene.test(battery.Taov$residuals, battery$Temperature, location="median")

modified robust Brown-Forsythe Levene-type test based on the absolute deviations from the median

data: battery.Taov$residualsTest Statistic = 1.0445, p-value = 0.3632

hsuhl (NUK) DAE Chap. 5 26 / 51

Two factor factorial design (cont.)

> ## For two-way ANOVA> library(car) # car package version> levene.test(battery.aov$residuals˜battery$Material*battery$Temperature)Levene’s Test for Homogeneity of Variance (center = median)

Df F value Pr(>F)group 8 0.7996 0.6081

27

> #3. For two-way ANOVA> fligner.test(battery.aov$residuals˜interaction(battery$Material,battery$Temperature))

Fligner-Killeen test of homogeneity of variances

data: battery.aov$residuals by interaction(battery$Material, battery$Temperature)Fligner-Killeen:med chi-squared = 5.8934, df = 8, p-value = 0.6592

hsuhl (NUK) DAE Chap. 5 27 / 51

Two factor factorial design (cont.)

> ## Homogeneity of Variance Plot> library(HH)> hov(battery.Maov$residuals ˜ Material, data=battery)

hov: Brown-Forsyth

data: battery.Maov$residualsF = 0.2796, df:Material = 2, df:Residuals = 33, p-value = 0.7578alternative hypothesis: variances are not identical

> hovPlot(battery.Maov$residuals ˜ Material, data=battery)> hov(battery.Taov$residuals ˜ Temperature, data=battery)

hov: Brown-Forsyth

data: battery.Taov$residualsF = 1.0445, df:Temperature = 2, df:Residuals = 33, p-value = 0.3632alternative hypothesis: variances are not identical

> hovPlot(battery.Taov$residuals ˜ Temperature, data=battery)

hsuhl (NUK) DAE Chap. 5 28 / 51

Two factor factorial design (cont.)

hsuhl (NUK) DAE Chap. 5 29 / 51

Two factor factorial design (cont.)

> ## Two-way> hov(battery.aov$residuals ˜ interaction(battery$Material,battery$Temperature),+ data=battery) ## results is the same as levene.test given in line 42

hov: Brown-Forsyth

data: battery.aov$residualsF = 0.7996, df:interaction(battery$Material, battery$Temperature) = 8,df:Residuals = 27, p-value = 0.6081alternative hypothesis: variances are not identical

> hovPlot(battery.aov$residuals ˜interaction(battery$Material,battery$Temperature),+ group.name="Temperature vs. Material",y.name ="residuals",data=battery)

hsuhl (NUK) DAE Chap. 5 30 / 51

Two factor factorial design (cont.)

hsuhl (NUK) DAE Chap. 5 31 / 51

Two factor factorial design (cont.)

> ## Tukey’s Test> TukeyHSD(battery.aov,which="Material")Tukey multiple comparisons of means

95% family-wise confidence level

Fit: aov(formula = Life ˜ Material * Temperature, data = battery)

$Materialdiff lwr upr p adj

2-1 25.16667 -1.135677 51.46901 0.06275713-1 41.91667 15.614323 68.21901 0.00141623-2 16.75000 -9.552344 43.05234 0.2717815

hsuhl (NUK) DAE Chap. 5 32 / 51

Two factor factorial design (cont.)

> ## for at temperature=70> temp70=which(battery$Temperature==70)> battery.aov70 <- aov(Life˜Material,data=battery[temp70,])> TukeyHSD(battery.aov70,which="Material")Tukey multiple comparisons of means

95% family-wise confidence level

Fit: aov(formula = Life ˜ Material, data = battery[temp70, ])

$Materialdiff lwr upr p adj

2-1 62.5 22.59911 102.40089 0.00456703-1 88.5 48.59911 128.40089 0.00042093-2 26.0 -13.90089 65.90089 0.2177840

hsuhl (NUK) DAE Chap. 5 33 / 51

Two factor factorial design (cont.)

Anova table without interaction term> battery.aov2 <- aov(Life˜Material+Temperature,data=battery)> summary( battery.aov2)

Df Sum Sq Mean Sq F value Pr(>F)Material 2 10684 5342 5.947 0.00651 **Temperature 2 39119 19559 21.776 1.24e-06 ***Residuals 31 27845 898---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

hsuhl (NUK) DAE Chap. 5 34 / 51

one observation per cell

a single replicate

yij = µ+ τi + βj + (τβ)ij + εij

{i = 1, 2, . . . , aj = 1, . . . , b

Problem:

the error variance σ2 is not estimable

the two-factor interaction effect (τβ)ij and the experimental errorcannot be separated

no tests on main effect unless the interaction effect is zero

hsuhl (NUK) DAE Chap. 5 35 / 51

one observation per cell (cont.)

hsuhl (NUK) DAE Chap. 5 36 / 51

one observation per cell (cont.)

Test: determining whether interaction is present (Tukey (1994a):non-additivity, or curvature test)

separating the residual SS into a single degree of freedomcomponent due to non-additivity, or interaction, and a componentfor error with (a− 1)(b− 1)− 1 degrees of freedom

Assume

(τβ)ij = γτiβj, γ is an unknown constant

hsuhl (NUK) DAE Chap. 5 37 / 51

one observation per cell (cont.)

Test:

F0 =SSN

SSError/[(a− 1)(b− 1)− 1]

SSN(d.f .=1)

=

[∑ai=1

∑bj=1 yijyi·y·j − y··

(SSA + SSB + y2

··ab

)]2

abSSASSB

SSError(d.f .=(a−1)(b−1)−1)

= SSResiduals − SSN

F0 > Fα,1,(a−1)(b−1)−1 ⇒ H0 must be rejected

hsuhl (NUK) DAE Chap. 5 38 / 51

one observation per cell (cont.)

Example 5.2

there is no evidence of interaction in these data

hsuhl (NUK) DAE Chap. 5 39 / 51

one observation per cell (cont.)

> ## impurity data analysis: single replicate> impurity<-read.table("impurity.txt",header=T)> impu<-impurity$N> Temp<-as.factor(impurity$Temperature)> Press<-as.factor(impurity$Pressure)> impu<-data.frame(Temp,Press,N=impu)> impurity.aov<-aov(N˜Temp +Press,data=impu)> summary(impurity.aov)

Df Sum Sq Mean Sq F value Pr(>F)Temp 2 23.33 11.67 46.67 3.88e-05 ***Press 4 11.60 2.90 11.60 0.00206 **Residuals 8 2.00 0.25---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1> impurity.aov2<-aov(N˜Temp *Press,data=impu)> summary(impurity.aov2)

Df Sum Sq Mean SqTemp 2 23.33 11.67Press 4 11.60 2.90Temp:Press 8 2.00 0.25

hsuhl (NUK) DAE Chap. 5 40 / 51

one observation per cell (cont.)

> #Tukey’s one-degree-of-freedom-test-for-nonadditivity> ## Method 1> library(agricolae)> model<-lm(N ˜ Temp + Press,data=impu)> df<-df.residual(model)> MSerror<-deviance(model)/df> nonadd<-nonadditivity(impu$N,impu$Temp,impu$Press, df, MSerror)

Tukey’s test of nonadditivityimpu$N

P : 2.666667Q : 72.17778

Analysis of Variance Table

Response: residualDf Sum Sq Mean Sq F value Pr(>F)

Nonadditivity 1 0.09852 0.098522 0.3627 0.566Residuals 7 1.90148 0.271640

hsuhl (NUK) DAE Chap. 5 41 / 51

one observation per cell (cont.)

> ## Method 2> library(dae)> impurity.aov3<-aov(N˜Temp +Press+ Error(Temp/Press),data=impu)> tukey.1df(impurity.aov3, impu, error.term= "Temp:Press")$Tukey.SS[1] 0.09852217

$Tukey.F[1] 0.3626943

$Tukey.p[1] 0.5660026

$Devn.SS[1] 1.901478

hsuhl (NUK) DAE Chap. 5 42 / 51

The General Factorial Design

Three-factor ANOVA model:

yijk` = µ+ τi + βj + γk + (τβ)ij + (τγ)ik + (βγ)jk + (τβγ)ijk + εijk`

If the factorial experiment involves one or more random factors,the test statistic construction is not always done this way.

hsuhl (NUK) DAE Chap. 5 43 / 51

The General Factorial Design (cont.)

hsuhl (NUK) DAE Chap. 5 44 / 51

Fitting Response Curves and Surfaces

involve at least one quantitative factor

fit response curve or response surface

linear regression methods are used to fit these models to theexperimental data

hsuhl (NUK) DAE Chap. 5 45 / 51

Fitting Response Curves and Surfaces (cont.)

Material Type1 2 3

B[1] 1 0 -1B[2] 0 1 -1

hierarchy principle: if a modelcontains a high-order term(Ex: A2B), it should alsocontain all of the lower orderterms (Ex: A2, AB) thatcompose it

hsuhl (NUK) DAE Chap. 5 46 / 51

Fitting Response Curves and Surfaces (cont.)

hsuhl (NUK) DAE Chap. 5 47 / 51

Fitting Response Curves and Surfaces (cont.)

hsuhl (NUK) DAE Chap. 5 48 / 51

Fitting Response Curves and Surfaces (cont.)

hsuhl (NUK) DAE Chap. 5 49 / 51

Blocking in a Factorial Design

blocking can be incorporated in a factorial

The effect model:

yijk = µ+ τi + βj + (τβ)ij + δk + εijk

hsuhl (NUK) DAE Chap. 5 50 / 51

Blocking in a Factorial Design (cont.)

interaction between blocks and treatments is negligible

If these interactions do exist, they cannot be separated from theerror component.

factors:fixed

block: random

σ2δ =

MSBlocks −MSE

ab

hsuhl (NUK) DAE Chap. 5 51 / 51