/* Lesson 12-1 */ /* File Name = les1201.sas 07/04/02 */ data gakusei; infile 'all02.prn' firstobs=2; input sex $ height weight chest jitaku $ kodukai carrier $ tsuuwa; proc print data=gakusei(obs=10); run; : : proc plot data=gakusei; : 散布図を描く plot height*weight; : 散布図の変量を指定(縦軸、横軸の順) plot weight*height; : run; : : proc corr data=gakusei; : 相関係数(相関行列)を計算 run; :
SAS システム 2 11:52 Wednesday, June 26, 2002 プロット : HEIGHT*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 32 オブザベーションが欠損値です.) HEIGHT | 200 + | | B A 180 + A ADBCDCACA A B A A | AABCJHPMGFCCCCB BA | AD FHEDDCBBCAA A A 160 + ADBCAGCCAABB | A D DCAA A A | A AAA 140 + ---+-----------+-----------+-----------+-----------+-- 20 40 60 80 100 WEIGHT SAS システム 3 11:52 Wednesday, June 26, 2002 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 32 オブザベーションが欠損値です.) 100 + A | A A WEIGHT | A A B A A | B BBDDC CADAC BBD B AA | A AA C B CABBF GBLHKBHFECB BACBB A 50 + AA CABBA BBE E EBBEE DAAAA A | A B B A BA | | | 0 + --+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 4 11:52 Wednesday, June 26, 2002 Correlation Analysis 5 'VAR' Variables: HEIGHT WEIGHT CHEST KODUKAI TSUUWA Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum HEIGHT 234 168.1 8.0546 39343.6 145.0 186.0 WEIGHT 211 58.9014 9.2295 12428.2 35.0000 100.0 CHEST 81 86.9383 7.7852 7042.0 56.0000 112.0 KODUKAI 221 51436.7 52821.5 11367500 0 300000 TSUUWA 31 8121.0 5186.1 251750 2000.0 30000.0 SAS システム 5 11:52 Wednesday, June 26, 2002 Correlation Analysis Pearson Correlation Coefficients / Prob > |R| under Ho: Rho=0 / Number of Observations HEIGHT WEIGHT CHEST KODUKAI TSUUWA HEIGHT 1.00000 0.70376 0.38040 0.04934 0.01218 0.0 0.0001 0.0005 0.4717 0.9482 234 211 81 215 31 WEIGHT 0.70376 1.00000 0.67279 -0.02472 0.10303 0.0001 0.0 0.0001 0.7315 0.5880 211 211 81 195 30 CHEST 0.38040 0.67279 1.00000 -0.11563 0.55031 0.0005 0.0001 0.0 0.3166 0.2579 81 81 81 77 6 KODUKAI 0.04934 -0.02472 -0.11563 1.00000 -0.04318 0.4717 0.7315 0.3166 0.0 0.8240 215 195 77 221 29 TSUUWA 0.01218 0.10303 0.55031 -0.04318 1.00000 0.9482 0.5880 0.2579 0.8240 0.0 31 30 6 29 31
/* Lesson 12-2 */ /* File Name = les1202.sas 07/04/02 */ data gakusei; infile 'all02.prn' firstobs=2; input sex $ height weight chest jitaku $ kodukai carrier $ tsuuwa; proc print data=gakusei(obs=10); run; : proc reg data=gakusei; : 回帰分析 model weight=height; : 変量を指定 output out=outreg1 predicted=pred1 residual=resid1; : 結果項目の保存 run; : : proc print data=outreg1(obs=15); : まずは表示 run; : : proc plot data=outreg1; : 散布図を描く plot height*weight; : 身長と体重 plot weight*height; : 体重と身長 plot pred1*weight; : 予測値と観測値 plot resid1*pred1; : 残差と予測値(残差解析) plot resid1*height; : 残差と説明変数(残差解析) plot resid1*weight; : 残差と目的変数(残差解析) run; :
where weight^=. and height^=.;
SAS システム 2 11:50 Wednesday, June 26, 2002 Model: MODEL1 Dependent Variable: WEIGHT Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 1 8859.83634 8859.83634 205.094 0.0001 Error 209 9028.59323 43.19901 C Total 210 17888.42957 Root MSE 6.57260 R-square 0.4953 Dep Mean 58.90142 Adj R-sq 0.4929 C.V. 11.15864 SAS システム 3 11:50 Wednesday, June 26, 2002 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -79.000323 9.63990492 -8.195 0.0001 HEIGHT 1 0.816529 0.05701588 14.321 0.0001 SAS システム 4 11:50 Wednesday, June 26, 2002 K C H W J O A T R E E C I D R S P E I I H T U R U R S O S G G E A K I U E I B E H H S K A E W D D S X T T T U I R A 1 1 1 F 145.0 38.0 . J 10000 . 39.3964 -1.3964 2 F 148.0 42.0 . J 50000 . 41.8460 0.1540 3 F 148.0 43.0 80 J 50000 DoCoMo 4000 41.8460 1.1540 4 F 148.9 . . J 60000 . 42.5809 . 5 F 149.0 45.0 . G 60000 . 42.6625 2.3375 6 F 150.0 46.0 86 40000 . 43.4791 2.5209 7 F 151.7 41.5 80 J 35000 . 44.8672 -3.3672 8 F 152.0 35.0 77 J 60000 DoCoMo 2000 45.1121 -10.1121 9 F 153.0 41.0 . J 125000 No . 45.9287 -4.9287 10 F 153.0 46.5 87 G 10000 . 45.9287 0.5713 11 F 153.0 50.0 . G 70000 DoCoMo 10000 45.9287 4.0713 12 F 153.0 55.0 78 J 30000 . 45.9287 9.0713 13 F 153.5 46.0 . J 30000 J-PHONE 8000 46.3369 -0.3369 14 F 154.0 46.0 . . . 46.7452 -0.7452 15 F 155.0 48.0 83 G 180000 . 47.5617 0.4383 SAS システム 7 11:50 Wednesday, June 26, 2002 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 32 オブザベーションが欠損値です.) 100 + A | A A WEIGHT | A A B A A | B BBDDC CADAC BBD B AA | A AA C B CABBF GBLHKBHFECB BACBB A 50 + AA CABBA BBE E EBBEE DAAAA A | A B B A BA | | | 0 + --+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 8 11:50 Wednesday, June 26, 2002 プロット : PRED1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 32 オブザベーションが欠損値です.) 80 + | PRED1 | A B A | A ADAAEAA D A A A A | A BBBIEDD F A A BB 60 + BDBGGGGJBFBAADAB A | AE DGBF BCAAC | BBBBADAB AAA | BA BBAAA A A | A B AB A A 40 + A AA ---+------------+------------+------------+------------+-- 20 40 60 80 100 WEIGHT SAS システム 9 11:50 Wednesday, June 26, 2002 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 32 オブザベーションが欠損値です.) | R 50 + e | s | A A i 25 + d | A A A A AA A u | A A A BBAA BABCDCBAA AB A A a 0 + A BAA ABBBBAABE CEBBCGGBKHHGFFBCABE AAA l | AA BAA B BA ADDDABCDB CD BBAABA | A -25 + ---+-----------+-----------+-----------+-----------+-----------+-- 30 40 50 60 70 80 Predicted Value of WEIGHT SAS システム 10 11:50 Wednesday, June 26, 2002 プロット : RESID1*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 32 オブザベーションが欠損値です.) | R 50 + e | s | A A i 25 + d | A A A A A A A u | A A A B BAA B ABCDC BAA A B A A a 0 + A BAA A CABBA ABE C EBBCG GBKFIAGFFBC ABE A AA l | A A BA A B B A ADD DABCCAB CBB BABAB A | A -25 + ---+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 11 11:50 Wednesday, June 26, 2002 プロット : RESID1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 32 オブザベーションが欠損値です.) | R 50 + e | s | A A i 25 + d | A B BA A u | AAABBAGBCAFAB B A a 0 + A BAADCCGHCJFIQNFJAG C l | A CABCF BIBGCCECAA | A -25 + ---+------------+------------+------------+------------+-- 20 40 60 80 100 WEIGHT