STA 6167, Two-Factor Experiment, Example 1

An engineer is designing a battery for use in a device that will be subjected to some extreme variations in temperature. The only design parameter that he can select at this point is the plate material for the battery, and he has three possible choices. When the device is manufactured and shipped to the field, the engineer has no control over the temperature extremes that the device will encounter, and he knows from experience that the temperature will probably impact the effective battery life. However, temperature can be controlled in the product development laboratory for the purposes of a test.

The engineer decides to test all three plate materials at three temperature levels -- 15F, 70F, and 125 -- as these temperature levels are consistent with the product end-use environment. Four batteries are tested at each combination of plate material and temperature, and all 36 tests are run in random order. (Example from Design and Analysis of Experiments, by D. C. Montgomery).

The SAS program below includes all relevant means, plots, appropriate tests for effects, a residual plot, and a normal probability plot.

procformat;

value Afmt 1 = "1st Material"

2 = "2nd Material"

3 = "3rd Material";

value Bfmt 1 = " 15 d F"

2 = " 70 d F"

3 = "125 d F";

value ABfmt 1 = "Type 1, 15 d F"

2 = "Type 1, 70 d F"

3 = "Type 1, 125 d F"

4 = "Type 2, 15 d F"

5 = "Type 2, 70 d F"

6 = "Type 2, 125 d F"

7 = "Type 3, 15 d F"

8 = "Type 3, 70 d F"

9 = "Type 3, 125 d F";

;

data one;

input A B y;

label A = "Material Type"

B = "Temperature (degrees F"

y = "Lifetime (hrs.)";

if A = 1 and B = 1then AB = 1;

elseif A = 1 and B = 2then AB = 2;

elseif A = 1 and B = 3then AB = 3;

elseif A = 2 and B = 1then AB = 4;

elseif A = 2 and B = 2then AB = 5;

elseif A = 2 and B = 3then AB = 6;

elseif A = 3 and B = 1then AB = 7;

elseif A = 3 and B = 2then AB = 8;

else AB = 9;

format A Afmt. B Bfmt.ABABfmt.;

cards;

1 1 130

1 1 74

1 1 155

1 1 180

1 2 34

1 2 80

1 2 40

1 2 75

1 3 20

1 3 82

1 3 70

1 3 58

2 1 150

2 1 159

2 1 188

2 1 126

2 2 136

2 2 106

2 2 122

2 2 115

2 3 25

2 3 58

2 3 70

2 3 45

3 1 138

3 1 168

3 1 110

3 1 160

3 2 174

3 2 150

3 2 120

3 2 139

3 3 96

3 3 82

3 3 104

3 3 60

;

procprint;

;

procsort;by A B;

;

procmeans;by A B;

outputout=cellmean mean=cm;

var y;

;

procplotdata=cellmean;

plot cm*B=A;

title"Interaction Plot";

;

procboxplotdata=one;

plot y*AB;

title"Side-by-Side Boxplots, Battery Life Experiment";

title2"for Each Combination of Material and Temperature";

;

procglmdata=one;

class A B;

model y = A|B;

outputout=resids r=res;

means A|B;

title"Two-Factor Experiment to Compare Battery Life";

title2"for Different Materials and Temperatures";

;

procplot;

plot res*(AB);

;

data two;set resids;

/* The following statement creates a dummy variable with value 1 for every */

/* observation in the data set. This variable will be used to merge the sample */

/* statistics with every observation in the original data set. */

dum = 1;

;

procsort;by res;

;

procmeans;

var res;

outputout=meanr mean=mu std=s n=size;

title;

title2;

;

data three;set meanr;dum = 1;

;

data three;merge two three;by dum;

p = (_n_ - 0.5)/size;

/* The following equation would need to be changed for q-q plots for other */

/* probability distributions. For example, for an exponential(mu) distribution, */

/* the statement would be Q = -mu*log(1-p). */

Q = probit(p);

;

procplot;

plot res*AB;

title'Plot of Residuals vs. Factor Levels';

;

procreg;

model res = Q;

plot (res predicted.)*Q / overlay;

title'Normal Probability Plot';

title2'For Residuals from ANOVA';

;

run;