/* Lesson 14-02 */ /* File Name = les1402.sas 01/26/21 */ options nocenter linesize=78 pagesize=30; options locale='en_US'; /* options locale='ja_JP'; */ proc printto print = 'StatM20/les1402-Results.txt' new; ods listing gpath='StatM20/SAS_ODS14'; data air; infile 'StatM20/usair2.txt'; input id $ y x1 x2 x3 x4 x5 x6; /* label y='SO2 of air in micrograms per cubic metre' x1='Average annual temperature in F' x2='Number of manufacturing enterprises employing 20 or more workers' x3='Population size (1970 census); in thousands' x4='Average annual wind speed in miles per hour' x5='Average annual precipitation in inches' x6='Average number of days with precipitation per year' ; */ proc print data=air(obs=10); run; proc corr data=air; run; title "*** フルモデル ***"; proc reg data=air; model y=x1 x2 x3 x4 x5 x6; output out=out_reg1 predicted=pred1 residual=resid1; run; proc plot data=out_reg1; plot resid1*pred1 /vref=0; plot resid1*x1 /vref=0; plot resid1*x2 /vref=0; plot resid1*x3 /vref=0; plot resid1*x4 /vref=0; plot resid1*x5 /vref=0; plot resid1*x6 /vref=0; plot resid1*y /vref=0; run; title "*** 逐次増減法 ***"; proc reg data=air; model y=x1-x6 / selection=stepwise; output out=out_reg2 predicted=pred2 residual=resid2; run; proc print data=out_reg2(obs=15); run; proc plot data=out_reg2; plot resid2*pred2 /vref=0; plot resid2*(x1 x2 x3 x4 x5 x6) /vref=0; plot resid2*(x1-x6) /vref=0; plot resid2*y /vref=0; run; title "*** 総当たり法 ***"; proc reg data=air; model y=x1-x6 / selection=rsquare; /* output out=out_reg3 predicted=pred1 residual=resid1; */ run;