/* Lesson 12-1 */ /* File Name = les1201.sas 10/14/99 */ data gakusei; infile 'all99.dat'; input seibetsu $ height weight chest jitaku $ kodukai; proc print data=gakusei(obs=10); run; proc reg data=gakusei; : 回帰分析 model weight=height chest; : 複数変量を指定 output out=o_reg1 predicted=pred1 residual=resid1; : 結果項目の保存 run; : proc print data=o_reg1(obs=15); run; proc plot data=o_reg1; : 散布図を描く where weight^=. and height^=. and chest^=.; : 解析に使ったデータのみ plot weight*height; : plot weight*chest; : plot pred1*weight; : 予測値と観測値 plot resid1*pred1; : 残差と予測値 = 残差解析 plot resid1*height; : 残差と説明変数 = 残差解析 plot resid1*chest; : 残差と説明変数 = 残差解析 run; :
SAS システム 2 11:12 Thursday, October 14, 1999 Model: MODEL1 Dependent Variable: WEIGHT Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 2 934.48171 467.24085 10.812 0.0003 Error 30 1296.48799 43.21627 C Total 32 2230.96970 Root MSE 6.57391 R-square 0.4189 Dep Mean 63.46970 Adj R-sq 0.3801 C.V. 10.35755 SAS システム 3 11:12 Thursday, October 14, 1999 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -60.856307 33.14966755 -1.836 0.0763 HEIGHT 1 0.331950 0.18045631 1.840 0.0758 CHEST 1 0.752573 0.18895898 3.983 0.0004 SAS システム 4 11:12 Thursday, October 14, 1999 OBS SEIBETSU HEIGHT WEIGHT CHEST JITAKU KODUKAI PRED1 RESID1 1 M 178 58.0 . J 20000 . . 2 M 170 63.0 90 J 30000 63.3068 -0.30677 3 M 167 56.0 . J 30000 . . 4 M 172 61.5 . J 30000 . . 5 M 170 52.0 . J 30000 . . 6 F 156 . . J 30000 . . 7 M 172 72.0 89 G 150000 63.2181 8.78190 8 M 163 51.0 82 J 10000 54.9625 -3.96253 9 M 175 57.0 . G 70000 . . 10 M 171 66.0 . G 80000 . . 11 M 173 60.0 . G 200000 . . 12 M 169 69.0 90 . 62.9748 6.02518 13 M 174 60.0 90 J 10000 64.6346 -4.63457 14 F 156 . . J 50000 . . 15 F 155 . . J 20000 . . SAS システム 5 11:12 Thursday, October 14, 1999 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... WEIGHT | 100 + | | A 80 + A A | A A A A | A A A A A 60 + A A A A A C A C A A A A | A A A | A A 40 + --+---------+---------+---------+---------+---------+---------+-- 155 160 165 170 175 180 185 HEIGHT SAS システム 6 11:12 Thursday, October 14, 1999 プロット : WEIGHT*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ... WEIGHT | 100 + | | A 80 + A A | A B A | A B A A 60 + B A B B A E A A A | B A | A A 40 + --+---------+---------+---------+---------+---------+---------+-- 80 85 90 95 100 105 110 CHEST SAS システム 7 11:12 Thursday, October 14, 1999 プロット : PRED1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... PRED1 | 80 + A | | A 70 + A A | B B A A A | A A BAB A A A A A 60 + A BA A | A A A | A A 50 + ---+-----------+-----------+-----------+-----------+-----------+-- 40 50 60 70 80 90 WEIGHT SAS システム 8 11:12 Thursday, October 14, 1999 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A d | A u | A A B A a 0 + A AA A A ABA A AA A A A l | B A A A A AAA AA | -20 + ---+---------+---------+---------+---------+---------+---------+-- 55 60 65 70 75 80 85 Predicted Value of WEIGHT SAS システム 9 11:12 Thursday, October 14, 1999 プロット : RESID1*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A d | A u | B A A A a 0 + A A A B A B B B A A A l | A A A A A A A A A A A | -20 + ---+---------+---------+---------+---------+---------+---------+-- 155 160 165 170 175 180 185 HEIGHT SAS システム 10 11:12 Thursday, October 14, 1999 プロット : RESID1*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A d | A u | A A A A A a 0 + A A A A A F A A A A l | C A A A A A A A A | -20 + ---+---------+---------+---------+---------+---------+---------+-- 80 85 90 95 100 105 110 CHEST
/* Lesson 12-2 */ /* File Name = les1202.sas 10/14/99 */ data gakusei; infile 'all99.dat'; input seibetsu $ height weight chest jitaku $ kodukai; proc print data=gakusei(obs=10); run; proc corr data=gakusei; : 相関係数 where seibetsu='M'; : 男性について run; : proc reg data=gakusei; : 回帰分析 where seibetsu='M'; : 男性について model weight=height chest; : output out=o_reg1 predicted=pred1 residual=resid1; : run; : proc print data=o_reg1(obs=15); run; proc plot data=o_reg1; where seibetsu='M' and weight^=. and height^=. and chest^=.; : 対象データについて plot weight*height; plot weight*chest; plot pred1*weight; plot resid1*pred1; plot resid1*height; plot resid1*chest; run;
《 略 》