* ch18eg1.sas; * SAS program to illustrate residual plots, * plus test of normality; options ls=76 nodate; ; data KFC; input y A j; * A=i; lines; 11 1 1 17 1 2 16 1 3 14 1 4 15 1 5 12 2 1 10 2 2 15 2 3 19 2 4 11 2 5 23 3 1 20 3 2 18 3 3 17 3 4 27 4 1 33 4 2 22 4 3 26 4 4 28 4 5 ; * Fit the ANOVA model and save info for residual plots; proc glm noprint; class A; model y = A; output out=B p=yhat r=e; title 'Kenton Food Company, (data from Table 16.1).'; ; * compute Blom's normal scores for the residuals; proc rank normal=Blom; var e; ranks nscore; ; proc print; title2 'KFC data, including normal scores.'; ; * Residual plots; proc plot; plot e*yhat / vpos=19 vref=0; plot e*nscore / vpos=19 vref=0 href=0; title2 'Residual Plots.'; ; * Normality test; proc corr nosimple; var e nscore; title2 'Testing Normality.'; Kenton Food Company, (data from Table 16.1). 1 KFC data, including normal scores. Obs y A j yhat e nscore 1 11 1 1 14.6 -3.6 -1.37597 2 17 1 2 14.6 2.4 0.88413 3 16 1 3 14.6 1.4 0.54695 4 14 1 4 14.6 -0.6 -0.13058 5 15 1 5 14.6 0.4 0.13058 6 12 2 1 13.4 -1.4 -0.40115 7 10 2 2 13.4 -3.4 -1.09680 8 15 2 3 13.4 1.6 0.70547 9 19 2 4 13.4 5.6 1.37597 10 11 2 5 13.4 -2.4 -0.70547 11 23 3 1 19.5 3.5 1.09680 12 20 3 2 19.5 0.5 0.26344 13 18 3 3 19.5 -1.5 -0.54695 14 17 3 4 19.5 -2.5 -0.88413 15 27 4 1 27.2 -0.2 0.00000 16 33 4 2 27.2 5.8 1.84570 17 22 4 3 27.2 -5.2 -1.84570 18 26 4 4 27.2 -1.2 -0.26344 19 28 4 5 27.2 0.8 0.40115 Kenton Food Company, (data from Table 16.1). 2 Residual Plots. Plot of e*yhat. Legend: A = 1 obs, B = 2 obs, etc. 10 + | | | | | A A 5 + | | A e | A | A A | A A 0 +------------A--------------------------------------------------A----- | A A | A A | A A | A A | -5 + A ---+-------+-------+-------+-------+-------+-------+-------+-------+-- 12 14 16 18 20 22 24 26 28 yhat Kenton Food Company, (data from Table 16.1). 3 Residual Plots. Plot of e*nscore. Legend: A = 1 obs, B = 2 obs, etc. 10 + | | | | | | | | | | | A A 5 + | | | | | A e | | A | | A A | | A A 0 +------------------------------A-A---------------------------- | A A | | A A | | A A | | A A | | | -5 + A | ---+-------------+-------------+-------------+-------------+-- -2 -1 0 1 2 Rank for Variable e Kenton Food Company, (data from Table 16.1). 4 Testing Normality. The CORR Procedure 2 Variables: e nscore Pearson Correlation Coefficients, N = 19 Prob > |r| under H0: Rho=0 e nscore e 1.00000 0.98824 <.0001 nscore 0.98824 1.00000 Rank for Variable e <.0001