* ch24eg.sas, Example of a Three-Factor Study (p1005); options ls=78 nodate; ; data ExTol; input y G F S; lines; 24.1 1 1 1 1 29.2 1 1 1 2 24.6 1 1 1 3 20.0 2 1 1 1 21.9 2 1 1 2 17.6 2 1 1 3 14.6 1 2 1 1 15.3 1 2 1 2 12.3 1 2 1 3 16.1 2 2 1 1 9.3 2 2 1 2 10.8 2 2 1 3 17.6 1 1 2 1 18.8 1 1 2 2 23.2 1 1 2 3 14.8 2 1 2 1 10.3 2 1 2 2 11.3 2 1 2 3 14.9 1 2 2 1 20.4 1 2 2 2 12.8 1 2 2 3 10.1 2 2 2 1 14.4 2 2 2 2 6.1 2 2 2 3 ; proc glm; class G F S; model y = G | F | S; * Could easily generate all full-model means of interest as follows; * lsmeans G | F | S; * The following means are the one that EDA says are of interest here; lsmeans G F*S / pdiff=all cl adjust=Tukey alpha=0.05; output out=stats p=yhat r=e; lsmeans F*S*G; * for interpretation of first means plot below; title '24.3 Example of Three-Factor Study (p1005)'; ; * Means plot; proc plot; plot yhat*S=F / vpos=20; title2 'Means plot with level of G suppressed'; ; * Generate a 2-factor means plot for factors F and S; proc sort; by F S; proc means noprint; by F S; var y; output out=means mean=ybarFS; proc plot; plot ybarFS*S=F / vpos=20; title2 'Two-factor Means Plot'; ; data stats; set stats; * use data set with residuals; proc rank normal=Blom; var e; ranks nscore; proc plot; plot e*yhat / vpos=18 vref=0; plot e*nscore / vpos=18 vref=0 href=0; title2 'Residual Plots'; 24.3 Example of Three-Factor Study (p1005) 1 The GLM Procedure Class Level Information Class Levels Values G 2 1 2 F 2 1 2 S 2 1 2 Number of observations 24 24.3 Example of Three-Factor Study (p1005) 2 The GLM Procedure Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 7 588.5829167 84.0832738 9.01 0.0002 Error 16 149.3666667 9.3354167 Corrected Total 23 737.9495833 R-Square Coeff Var Root MSE y Mean 0.797592 18.77833 3.055391 16.27083 Source DF Type I SS Mean Square F Value Pr > F G 1 176.5837500 176.5837500 18.92 0.0005 F 1 242.5704167 242.5704167 25.98 0.0001 G*F 1 13.6504167 13.6504167 1.46 0.2441 S 1 70.3837500 70.3837500 7.54 0.0144 G*S 1 11.0704167 11.0704167 1.19 0.2923 F*S 1 72.4537500 72.4537500 7.76 0.0132 G*F*S 1 1.8704167 1.8704167 0.20 0.6604 Source DF Type III SS Mean Square F Value Pr > F G 1 176.5837500 176.5837500 18.92 0.0005 F 1 242.5704167 242.5704167 25.98 0.0001 G*F 1 13.6504167 13.6504167 1.46 0.2441 S 1 70.3837500 70.3837500 7.54 0.0144 G*S 1 11.0704167 11.0704167 1.19 0.2923 F*S 1 72.4537500 72.4537500 7.76 0.0132 G*F*S 1 1.8704167 1.8704167 0.20 0.6604 24.3 Example of Three-Factor Study (p1005) 3 The GLM Procedure Least Squares Means Adjustment for Multiple Comparisons: Tukey H0:LSMean1= LSMean2 G y LSMEAN Pr > |t| 1 18.9833333 0.0005 2 13.5583333 G y LSMEAN 95% Confidence Limits 1 18.983333 17.113544 20.853123 2 13.558333 11.688544 15.428123 Least Squares Means for Effect G Difference Simultaneous 95% Between Confidence Limits for i j Means LSMean(i)-LSMean(j) 1 2 5.425000 2.780718 8.069282 24.3 Example of Three-Factor Study (p1005) 4 The GLM Procedure Least Squares Means Adjustment for Multiple Comparisons: Tukey LSMEAN F S y LSMEAN Number 1 1 22.9000000 1 1 2 16.0000000 2 2 1 13.0666667 3 2 2 13.1166667 4 Least Squares Means for effect F*S Pr > |t| for H0: LSMean(i)=LSMean(j) Dependent Variable: y i/j 1 2 3 4 1 0.0061 0.0002 0.0002 2 0.0061 0.3740 0.3883 3 0.0002 0.3740 1.0000 4 0.0002 0.3883 1.0000 F S y LSMEAN 95% Confidence Limits 1 1 22.900000 20.255718 25.544282 1 2 16.000000 13.355718 18.644282 2 1 13.066667 10.422385 15.710948 2 2 13.116667 10.472385 15.760948 Least Squares Means for Effect F*S Difference Simultaneous 95% Between Confidence Limits for i j Means LSMean(i)-LSMean(j) 1 2 6.900000 1.853072 11.946928 1 3 9.833333 4.786405 14.880262 1 4 9.783333 4.736405 14.830262 2 3 2.933333 -2.113595 7.980262 2 4 2.883333 -2.163595 7.930262 3 4 -0.050000 -5.096928 4.996928 24.3 Example of Three-Factor Study (p1005) 5 The GLM Procedure Least Squares Means G F S y LSMEAN 1 1 1 25.9666667 1 1 2 19.8666667 1 2 1 14.0666667 1 2 2 16.0333333 2 1 1 19.8333333 2 1 2 12.1333333 2 2 1 12.0666667 2 2 2 10.2000000 24.3 Example of Three-Factor Study (p1005) 6 Means plot with level of G suppressed Plot of yhat*S. Symbol is value of F. yhat | | 30 + | | | 1 25 + | | | 20 + 1 1 | | | 2 15 + | 2 | 2 1 | 10 + 2 | ---+-----------------------------------------------+-- 1 2 S NOTE: 16 obs hidden. 24.3 Example of Three-Factor Study (p1005) 7 Two-factor Means Plot Plot of ybarFS*S. Symbol is value of F. ybarFS | 25 + | | | 1 | | 20 + | | | | | 1 15 + | | 2 2 | | | 10 + ---+----------------------------------------------+-- 1 2 S 24.3 Example of Three-Factor Study (p1005) 8 Residual Plots Plot of e*yhat. Legend: A = 1 obs, B = 2 obs, etc. e | 5 + | A A | A | A A | A | A | A | A 0 +--A-------------------------------------A--------------------------------- | A | A A A A | A A A | A B | A | | A -5 + --+---------+---------+---------+---------+---------+---------+---------+-- 10.0 12.5 15.0 17.5 20.0 22.5 25.0 27.5 yhat 24.3 Example of Three-Factor Study (p1005) 9 Residual Plots Plot of e*nscore. Legend: A = 1 obs, B = 2 obs, etc. e | | 5 + | | | A A | | A | | A A | | A | | A | | A | | A 0 +--------------------------------+-A-A---------------------------- | |A | A A AA| | A A A | | A A A | | A | | | | A | -5 + | ---+--------------+--------------+--------------+--------------+-- -2 -1 0 1 2 Rank for Variable e