/* Lesson 11-1 */ /* File Name = les1101.sas 10/07/99 */ data gakusei; infile 'all99.dat'; input seibetsu $ height weight chest jitaku $ kodukai; proc print data=gakusei(obs=10); run; : : proc plot data=gakusei; : 散布図を描く plot height*weight; : 散布図の変量を指定(縦軸、横軸の順) plot weight*height; : run; : : proc means data=gakusei; : 平均を求める run; : : proc corr data=gakusei; : 相関係数(相関行列)を計算 run; :
SAS システム 6 17:11 Wednesday, October 6, 1999 プロット : HEIGHT*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 24 オブザベーションが欠損値です.) HEIGHT | 200 + | | A 180 + A A A AAB AA A A | AB CDD JAFBACA A BA B B | A AACABAAAB A ABA A A 160 + A BAA A B | A A A | A 140 + --+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 WEIGHT SAS システム 7 17:11 Wednesday, October 6, 1999 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 24 オブザベーションが欠損値です.) WEIGHT | 100 + | A | 75 + AAA B B A | A A ABCAA B A B A B B A | A B A AD CAFFF DCBA A AA 50 + A A A A B BA BAA A A | A A | 25 + --+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 3 17:11 Wednesday, October 6, 1999 Correlation Analysis 4 'VAR' Variables: HEIGHT WEIGHT CHEST KODUKAI Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum HEIGHT 108 168.7 7.2619 18216.9 145.0 185.0 WEIGHT 91 60.6231 7.6859 5516.7 38.0000 88.5000 CHEST 33 89.8182 6.2071 2964.0 80.0000 110.0 KODUKAI 98 50219.4 50679.1 4921500 0 200000 SAS システム 4 17:11 Wednesday, October 6, 1999 Correlation Analysis Pearson Correlation Coefficients / Prob > |R| under Ho: Rho=0 / Number of Observations HEIGHT WEIGHT CHEST KODUKAI HEIGHT 1.00000 0.51949 0.13526 0.16220 0.0 0.0001 0.4530 0.1183 108 91 33 94 WEIGHT 0.51949 1.00000 0.59441 0.01705 0.0001 0.0 0.0003 0.8807 91 91 33 80 CHEST 0.13526 0.59441 1.00000 -0.19942 0.4530 0.0003 0.0 0.2997 33 33 33 29 KODUKAI 0.16220 0.01705 -0.19942 1.00000 0.1183 0.8807 0.2997 0.0 94 80 29 98
/* Lesson 11-2 */ /* File Name = les1102.sas 10/07/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; : 変量を指定 output out=o_reg1 predicted=pred1 residual=resid1; : 結果項目の保存 run; : : proc print data=o_reg1(obs=15); : まずは表示 run; : : proc plot data=o_reg1; : 散布図を描く plot weight*height; : 体重と身長 plot pred1*weight; : 予測値と観測値 plot resid1*pred1; : 残差と予測値 = 残差解析 plot resid1*height; : 残差と説明変数 = 残差解析 run; :
where weight^=. and height^=.;
SAS システム 2 19:29 Wednesday, October 6, 1999 Model: MODEL1 Dependent Variable: WEIGHT Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 1 1434.77603 1434.77603 32.895 0.0001 Error 89 3881.84551 43.61624 C Total 90 5316.62154 Root MSE 6.60426 R-square 0.2699 Dep Mean 60.62308 Adj R-sq 0.2617 C.V. 10.89397 SAS システム 3 19:29 Wednesday, October 6, 1999 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -46.059971 18.61350196 -2.475 0.0152 HEIGHT 1 0.626389 0.10921352 5.735 0.0001 SAS システム 4 19:29 Wednesday, October 6, 1999 OBS SEIBETSU HEIGHT WEIGHT CHEST JITAKU KODUKAI PRED1 RESID1 1 M 178 58.0 . J 20000 65.4373 -7.4373 2 M 170 63.0 90 J 30000 60.4262 2.5738 3 M 167 56.0 . J 30000 58.5470 -2.5470 4 M 172 61.5 . J 30000 61.6790 -0.1790 5 M 170 52.0 . J 30000 60.4262 -8.4262 6 F 156 . . J 30000 51.6568 . 7 M 172 72.0 89 G 150000 61.6790 10.3210 8 M 163 51.0 82 J 10000 56.0415 -5.0415 9 M 175 57.0 . G 70000 63.5582 -6.5582 10 M 171 66.0 . G 80000 61.0526 4.9474 11 M 173 60.0 . G 200000 62.3054 -2.3054 12 M 169 69.0 90 . 59.7998 9.2002 13 M 174 60.0 90 J 10000 62.9318 -2.9318 14 F 156 . . J 50000 51.6568 . 15 F 155 . . J 20000 51.0304 . SAS システム 5 19:29 Wednesday, October 6, 1999 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 24 オブザベーションが欠損値です.) WEIGHT | 100 + | A | 75 + AAA B B A | A A ABCAA B A B A B B A | A B A AD CAFFF DCBA A AA 50 + A A A A B BA BAA A A | A A | 25 + --+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 6 19:29 Wednesday, October 6, 1999 プロット : PRED1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 24 オブザベーションが欠損値です.) PRED1 | 70 + A | A A A AAA A A A | B ABB FADAAC A AA A B 60 + BABADCCAE CA CB AA A A A | A B AA B B A | A A 50 + A A A | | A 40 + ---+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 WEIGHT SAS システム 7 19:29 Wednesday, October 6, 1999 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 24 オブザベーションが欠損値です.) | R 40 + e | s | A i 20 + d | A A A B A u | A BA A AA BBB A a 0 + A A A ADBA GBE ECA BA A A A l | A A A B BABAAADC A BA A A B | A A -20 + ---+---------+---------+---------+---------+---------+---------+-- 40 45 50 55 60 65 70 Predicted Value of WEIGHT SAS システム 8 19:29 Wednesday, October 6, 1999 プロット : RESID1*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 24 オブザベーションが欠損値です.) | R 40 + e | s | A i 20 + d | A A A B A u | A B A A A ABBB A a 0 + A A A AD C GBE ECA B A A A A l | A A A B BA BBADC A BA A A B | A A -20 + ---+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT