/* arsenic1.sas */ options ls=72 ps=60; data arsenic; infile 'arsenic.dat'; input conc dist; proc print data=arsenic; title 'arsenic data'; proc plot data=arsenic; plot conc*dist; title 'arsenic data scatterplot'; proc glm data=arsenic; model conc = dist / ss1 ss2 p clm clparm ; output out=new predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; estimate 'intercept' intercept 1; estimate 'slope' dist 1; estimate 'mean' intercept 1 dist 16.1; estimate 'meanresp20' intercept 1 dist 20 / e; title 'regression of conc on dist (1)'; proc print data=new; var conc dist clml clmu clpl clpu yhat resid; proc plot data=new; plot resid*dist / vref=0; title 'residual plot: regression of conc on dist'; proc univariate data=new plot; var resid; title 'descriptive statistics for residuals'; proc rank data=new normal=blom out=new1; var resid; ranks nscore; proc plot data=new1; plot nscore*resid; title 'normal probability plot for residuals'; /* append x=20 to get prediction interval */ data dist20; input conc dist; cards; . 20 ; data combine1; set arsenic dist20; proc glm data=combine1; model conc = dist; output out=new1a predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; title 'regression of conc on dist (2)'; proc print data=new1a; var conc dist clml clmu clpl clpu yhat resid; /* get the ANOVA with the uncorrected total SS */ proc glm data=arsenic; model conc = dist / ss1 ss2 p intercept; title 'regression of conc on dist (3)'; run;