Two Factor Factorial Example An experiment was run to investigate the effect of the type of glass and the type of phosphor on the brightness of a TV tube. The response variable is the current necessary (in microamps) to obtain a specified brightness level. The data follow: --------------------------------------------- Phosphor Type ------------------- Glass 1 2 3 Type --------------------------------------------- 280 300 290 1 290 310 285 285 295 290 230 260 220 2 235 240 225 240 235 230 --------------------------------------------- Does either factor influence brightness? Do the factors interact to influence brightness? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% title 'Two-Factor Factorial Design: TV Brightness'; options linesize=79; data TV; infile 'fact.dat'; input Glass Phosphor Bright; PROC PRINT; PROC ANOVA; CLASS Glass Phosphor; MODEL Bright = Glass Phosphor Glass*Phosphor; MEANS Glass/tukey alpha = 0.05; # compare levels of factor glass PROC SORT; BY Glass Phosphor; # sort by increasing glass and phosphor PROC MEANS mean; VAR Bright; # telling SAS we'll find means of Bright variable BY Glass Phosphor; # finding means for each glass-phosphor combo. OUTPUT out = cell mean = cellmean; # saving results in SAS PROC PLOT data = cell; PLOT cellmean*Glass = Phosphor; # plot treatment means vs. Glass RUN; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 If you wanted to obtain residual plots, you would use the following commands, based on PROC GLM: PROC GLM; CLASS Glass Phosphor; MODEL Bright = Glass Phosphor Glass*Phosphor; OUTPUT out=resstuff predicted=brightpred residual=resid; PROC PLOT data = resstuff; plot resid*brightpred; PROC UNIVARIATE plot data = resstuff; var resid; %%%%%%%%%%%%%%%%%%%%%%%%%%%% Two-Factor Factorial Design: TV Brightness Obs Glass Phosphor Bright 1 1 1 280 2 1 1 290 3 1 1 285 4 1 2 300 5 1 2 310 6 1 2 295 7 1 3 290 8 1 3 285 9 1 3 290 10 2 1 230 11 2 1 235 12 2 1 240 13 2 2 260 14 2 2 240 15 2 2 235 16 2 3 220 17 2 3 225 18 2 3 230 Two-Factor Factorial Design: TV Brightness The ANOVA Procedure Class Level Information Class Levels Values Glass 2 1 2 Phosphor 3 1 2 3 Number of observations 18 Two-Factor Factorial Design: TV Brightness The ANOVA Procedure Dependent Variable: Bright Sum of Source DF Squares Mean Square F Value Pr > F Model 5 15516.66667 3103.33333 58.80 <.0001 Error 12 633.33333 52.77778 Corrected Total 17 16150.00000 R-Square Coeff Var Root MSE Bright Mean 0.960784 2.758797 7.264832 263.3333 Source DF Anova SS Mean Square F Value Pr > F Glass 1 14450.00000 14450.00000 273.79 <.0001 Phosphor 2 933.33333 466.66667 8.84 0.0044 Glass*Phosphor 2 133.33333 66.66667 1.26 0.3178 Two-Factor Factorial Design: TV Brightness The ANOVA Procedure Tukey's Studentized Range (HSD) Test for Bright NOTE: This test controls the Type I experimentwise error rate, but it generally has a higher Type II error rate than REGWQ. Alpha 0.05 Error Degrees of Freedom 12 Error Mean Square 52.77778 Critical Value of Studentized Range 3.08132 Minimum Significant Difference 7.4618 Means with the same letter are not significantly different. Tukey Grouping Mean N Glass A 291.667 9 1 B 235.000 9 2 Two-Factor Factorial Design: TV Brightness ----------------------------- Glass=1 Phosphor=1 ------------------------------ The MEANS Procedure Analysis Variable : Bright Mean ------------ 285.0000000 ------------ ----------------------------- Glass=1 Phosphor=2 ------------------------------ Analysis Variable : Bright Mean ------------ 301.6666667 ------------ ----------------------------- Glass=1 Phosphor=3 ------------------------------ Analysis Variable : Bright Mean ------------ 288.3333333 ------------ ----------------------------- Glass=2 Phosphor=1 ------------------------------ Analysis Variable : Bright Mean ------------ 235.0000000 ------------ ----------------------------- Glass=2 Phosphor=2 ------------------------------ Analysis Variable : Bright Mean ------------ 245.0000000 ------------ # Final value deleted to save space. Plot of cellmean*Glass. Symbol is value of Phosphor. cellmean | 301.67 + 2 | 298.33 + | 295.00 + | 291.67 + | 288.33 + 3 | 285.00 + 1 | 281.67 + | 278.33 + | 275.00 + | 271.67 + | 268.33 + | 265.00 + | 261.67 + | 258.33 + | 255.00 + | 251.67 + | 248.33 + | 245.00 + 2 | 241.67 + | 238.33 + | 235.00 + 1 | 231.67 + | 228.33 + | 225.00 + 3 | ---+---------------------------------------------+-- 1 2 Glass