* residanalysis.sas: Example residual analyses on the hsb example. *; options ls=80 noovp; * Required libname statement. Note: The "libref" here is called hlmhsb. This libref is defined by the libname statement and must be used in the rest of the command file as the first part of the two-part SAS data set name. *; libname hlmhsb '.'; title "HSB data"; * Short ouput descriptive statistics for all variables *; proc means maxdec=3 data=hlmhsb.resfil1; run; * SAS graphics options and symbols *; goptions targetdevice=pscolor; goptions border htext=0.25in; symbol value=dot height=0.1 i=none; * Proc Univariate, include histogram, probability plot, Q-Q plot and check for normality *; proc univariate plot normal data=hlmhsb.resfil1; var l1resid ; histogram l1resid ; probplot l1resid ; qqplot l1resid ; run; symbol value=dot height=0.1 i=rl; proc gplot data=hlmhsb.resfil1; plot l1resid*fitval / frame hminor=0 vminor=0; run; quit; title "Generated data: Normal error"; data xy; do n=1 to 7185; x1=normal(0); x2=0.45*x1+sqrt(1-0.45**2)*normal(0); y=-2+0.35*x1-0.44*x2+normal(0); output; end; run; proc means data=xy maxdec=3; var x1 x2 y; run; proc reg data=xy; model y = x1 x2; output out=xy p=yhat r=err; run; * Proc Univariate, include histogram, probability plot, Q-Q plot and check for normality *; options nolabel; proc univariate plot normal data=xy; var err; histogram err ; probplot err ; qqplot err ; run; proc gplot data=xy; plot err*yhat / frame hminor=0 vminor=0; run; quit;