/* Exercise 5.2a Statistical Methods in Biology: Design and Analysis of Experiments and Regression by S.J. Welham, S.A. Gezan, S.J. Clark & A. Mead (2014) Chapman & Hall/CRC Press, Boca Raton, Florida. ISBN: 978-1-4398-0878-8 Data from K. Hammond-Kosack, Rothamsted Research Version 1, 26/09/2014 */ ods graphics on; * Read data - change directory to location of your data file; data GRAINS; infile 'C:\stats4biol\data\GRAINS.DAT' firstobs=2 expandtabs; input DEar Treatment $ Grains; run; proc print data=GRAINS;run; * One-way ANOVA with default Diagnostic plots (and save residuals); proc glm data=GRAINS plots=DIAGNOSTICS; class Treatment; model Grains = Treatment; output out=RESID p=Pred r=SimpleRes student=StdRes; run; * Plot of standardized residuals against fitted (predicted) values; axis1 label=('Standardized residual'); axis2 label=('Fitted value'); symbol value=dot interpol=none; proc gplot data=RESID; plot StdRes*Pred / vaxis=axis1 haxis=axis2 vref=0; run; * Plot of absolute standardized residuals against fitted values; data RESID; set RESID; AbsRes=abs(StdRes); * Absolute residuals; run; axis1 label=('|Standardized residual|'); axis2 label=('Fitted value'); symbol value=dot interpol=none; proc gplot data=RESID; plot AbsRes*Pred / vaxis=axis1 haxis=axis2; run; * Plot Histogram and Normal Plot of standardized residuals; proc univariate data=RESID noprint; histogram StdRes / normal; qqplot StdRes / normal href=0 vref=0; run;