/* Lesson 12-1 */ /* File Name = les1201.sas 10/07/99 */ data gakusei; infile 'all00.prn'; 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 corr data=gakusei; : 相関係数(相関行列)を計算 run; :
SAS システム 2 16:34 Tuesday, October 3, 2000 プロット : HEIGHT*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 29 オブザベーションが欠損値です.) HEIGHT | 200 + | | A A 180 + A A CA ABD AA BA A | AB DDE MDHDAEAAB BBA B BA | C ABBCACBAAB BAABA A A 160 + A BABCAAB A B | A A A | A A 140 + --+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 WEIGHT SAS システム 3 16:34 Tuesday, October 3, 2000 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 29 オブザベーションが欠損値です.) WEIGHT | 100 + | A | A 75 + AAA B B A B | AA A ABEBB C CAB AAE B A | A B B A AD EBGHGAEECB B ABA 50 + A A ABB B CAACB CAA A A | A A A | 25 + --+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 5 16:34 Tuesday, October 3, 2000 Correlation Analysis 4 'VAR' Variables: HEIGHT WEIGHT CHEST KODUKAI Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum HEIGHT 157 169.1 7.3845 26546.0 145.0 186.0 WEIGHT 137 60.3847 7.7886 8272.7 38.0000 88.5000 CHEST 52 88.9038 5.9549 4623.0 75.0000 110.0 KODUKAI 147 52642.9 52967.3 7738500 0 300000 SAS システム 6 16:34 Tuesday, October 3, 2000 Correlation Analysis Pearson Correlation Coefficients / Prob > |R| under Ho: Rho=0 / Number of Observations HEIGHT WEIGHT CHEST KODUKAI HEIGHT 1.00000 0.61811 0.16914 0.09854 0.0 0.0001 0.2306 0.2450 157 137 52 141 WEIGHT 0.61811 1.00000 0.59632 -0.07028 0.0001 0.0 0.0001 0.4380 137 137 52 124 CHEST 0.16914 0.59632 1.00000 -0.29786 0.2306 0.0001 0.0 0.0398 52 52 52 48 KODUKAI 0.09854 -0.07028 -0.29786 1.00000 0.2450 0.4380 0.0398 0.0 141 124 48 147
/* Lesson 12-2 */ /* File Name = les1202.sas 10/07/99 */ data gakusei; infile 'all00.prn'; input seibetsu $ height weight chest jitaku $ kodukai; 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 21:53 Wednesday, October 4, 2000 Model: MODEL1 Dependent Variable: WEIGHT Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 1 3152.06893 3152.06893 83.469 0.0001 Error 135 5098.04888 37.76333 C Total 136 8250.11781 Root MSE 6.14519 R-square 0.3821 Dep Mean 60.38467 Adj R-sq 0.3775 C.V. 10.17673 SAS システム 3 21:53 Wednesday, October 4, 2000 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -60.171446 13.20596064 -4.556 0.0001 HEIGHT 1 0.707674 0.07745874 9.136 0.0001 SAS システム 4 21:53 Wednesday, October 4, 2000 OBS SEIBETSU HEIGHT WEIGHT CHEST JITAKU KODUKAI PRED1 RESID1 1 F 145.0 38 . J 10000 42.4413 -4.4413 2 F 148.0 42 . J 50000 44.5643 -2.5643 3 F 148.9 . . J 60000 45.2012 . 4 F 154.0 46 . . 48.8103 -2.8103 5 F 155.0 . . J 20000 49.5180 . 6 F 156.0 49 85 J 25000 50.2257 -1.2257 7 M 156.0 61 90 J 0 50.2257 10.7743 8 F 156.0 . . J 30000 50.2257 . 9 F 156.0 . . J 50000 50.2257 . 10 F 156.0 . . G . 50.2257 . 11 F 156.5 . . J 20000 50.5795 . 12 F 157.0 43 . J 20000 50.9334 -7.9334 13 F 158.0 49 85 J 0 51.6410 -2.6410 14 F 159.0 49 88 J 30000 52.3487 -3.3487 15 F 159.0 52 . J 50000 52.3487 -0.3487 SAS システム 5 21:53 Wednesday, October 4, 2000 プロット : HEIGHT*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 29 オブザベーションが欠損値です.) HEIGHT | 200 + | | A A 180 + A A CA ABD AA BA A | AB DDE MDHDAEAAB BBA B BA | C ABBCACBAAB BAABA A A 160 + A BABCAAB A B | A A A | A A 140 + --+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 WEIGHT SAS システム 6 21:53 Wednesday, October 4, 2000 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 29 オブザベーションが欠損値です.) WEIGHT | 100 + | A | A 75 + AAA B B A B | AA A ABEBB C CAB AAE B A | A B B A AD EBGHGAEECB B ABA 50 + A A ABB B CAACB CAA A A | A A A | 25 + --+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 7 21:53 Wednesday, October 4, 2000 プロット : PRED1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 29 オブザベーションが欠損値です.) 80 + | PRED1 | A A | A BA ABC BA | A BB IBBB D BB A A BB 60 + CCB GDEAFBHBADB AABAA A A | C CBAAA B BAA | A CA A AB A | A | A A 40 + ---+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 WEIGHT SAS システム 8 21:53 Wednesday, October 4, 2000 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 29 オブザベーションが欠損値です.) | R 40 + e | s | A i 20 + d | A A AA A B AA A u | BA AA A ABC BAB A a 0 + A A A AA D BA BD E I DEFDADABA AD A A l | A A A B AABB CCA EDA BB B BA B | A A -20 + -+--------+--------+--------+--------+--------+--------+--------+- 40 45 50 55 60 65 70 75 Predicted Value of WEIGHT SAS システム 9 21:53 Wednesday, October 4, 2000 プロット : RESID1*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 29 オブザベーションが欠損値です.) | R 40 + e | s | A i 20 + d | A AAA A B A A A u | B AAA A ABCBA B A a 0 + A A A AAD B A BD E IDE FEDAB AAD A A l | A A A BAABB CCADDAA BB B BAB | A A -20 + ---+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 10 21:53 Wednesday, October 4, 2000 プロット : RESID1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 29 オブザベーションが欠損値です.) | R 40 + e | s | A i 20 + d | A AA B BB A u | A BAADB BABB a 0 + A A BA CABCABCAMDJDBG BB B l | A A CA CCCB FDD EA AA | A A -20 + ---+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 WEIGHT