/* Lesson 12-1 */ /* File Name = les1201.sas 07/05/01 */ data gakusei; infile 'all01.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 21:24 Thursday, June 28, 2001 プロット : HEIGHT*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 30 オブザベーションが欠損値です.) HEIGHT | 200 + | | B A 180 + A ACBCDBABA B A A | AABAHFNMFFCBCCB BA | C FFDDCBBBCAA A 160 + A BBAGCBAABB | A CC A A | A A A 140 + ---+-----------+-----------+-----------+-----------+-- 20 40 60 80 100 WEIGHT SAS システム 3 21:24 Thursday, June 28, 2001 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 30 オブザベーションが欠損値です.) WEIGHT | 100 + A | A | A 80 + A B A A | ABC B A A A A | A B ABCBA B CAB ABC A AA 60 + AA A B BA AB F IEG GFDC B BAA A | A A AD C DB CF DCADBA B A | AA AAAB AA A A AB 40 + A A A A --+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 5 21:24 Thursday, June 28, 2001 Correlation Analysis 4 'VAR' Variables: HEIGHT WEIGHT CHEST KODUKAI Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum HEIGHT 196 168.6 7.8736 33039.7 145.0 186.0 WEIGHT 175 59.9069 8.8533 10483.7 38.0000 100.0 CHEST 72 87.5556 7.8613 6304.0 56.0000 112.0 KODUKAI 185 52710.8 51890.1 9751500 0 300000 SAS システム 6 21:24 Thursday, June 28, 2001 Correlation Analysis Pearson Correlation Coefficients / Prob > |R| under Ho: Rho=0 / Number of Observations HEIGHT WEIGHT CHEST KODUKAI HEIGHT 1.00000 0.65673 0.34704 0.03445 0.0 0.0001 0.0028 0.6471 196 175 72 179 WEIGHT 0.65673 1.00000 0.65793 -0.08900 0.0001 0.0 0.0001 0.2615 175 175 72 161 CHEST 0.34704 0.65793 1.00000 -0.16051 0.0028 0.0001 0.0 0.1910 72 72 72 68 KODUKAI 0.03445 -0.08900 -0.16051 1.00000 0.6471 0.2615 0.1910 0.0 179 161 68 185
/* Lesson 12-2 */ /* File Name = les1202.sas 07/05/01 */ data gakusei; infile 'all01.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:24 Thursday, June 28, 2001 Model: MODEL1 Dependent Variable: WEIGHT Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 1 5882.22184 5882.22184 131.202 0.0001 Error 173 7756.14993 44.83324 C Total 174 13638.37177 Root MSE 6.69576 R-square 0.4313 Dep Mean 59.90686 Adj R-sq 0.4280 C.V. 11.17696 SAS システム 3 21:24 Thursday, June 28, 2001 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -69.548530 11.31317660 -6.148 0.0001 HEIGHT 1 0.763597 0.06666431 11.454 0.0001 SAS システム 4 21:24 Thursday, June 28, 2001 OBS SEIBETSU HEIGHT WEIGHT CHEST JITAKU KODUKAI PRED1 RESID1 1 F 145.0 38.0 . J 10000 41.1730 -3.1730 2 F 148.0 42.0 . J 50000 43.4638 -1.4638 3 F 148.9 . . J 60000 44.1510 . 4 F 149.0 45.0 . G 60000 44.2274 0.7726 5 F 150.0 46.0 86 40000 44.9910 1.0090 6 F 151.7 41.5 80 J 35000 46.2891 -4.7891 7 F 153.0 46.5 87 G 10000 47.2818 -0.7818 8 F 153.0 55.0 78 J 30000 47.2818 7.7182 9 F 154.0 46.0 . . 48.0454 -2.0454 10 F 155.0 48.0 83 G 180000 48.8090 -0.8090 11 F 155.0 . . J 20000 48.8090 . 12 F 156.0 48.0 70 J 30000 49.5726 -1.5726 13 F 156.0 49.0 85 J 25000 49.5726 -0.5726 14 M 156.0 61.0 90 J 0 49.5726 11.4274 15 F 156.0 . . J 30000 49.5726 . SAS システム 5 21:24 Thursday, June 28, 2001 プロット : HEIGHT*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 30 オブザベーションが欠損値です.) HEIGHT | 200 + | | B A 180 + A ACBCDBABA B A A | AABAHFNMFFCBCCB BA | C FFDDCBBBCAA A 160 + A BBAGCBAABB | A CC A A | A A A 140 + ---+-----------+-----------+-----------+-----------+-- 20 40 60 80 100 WEIGHT SAS システム 6 21:24 Thursday, June 28, 2001 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 30 オブザベーションが欠損値です.) WEIGHT | 100 + A | A | A 80 + A B A A | ABC B A A A A | A B ABCBA B CAB ABC A AA 60 + AA A B BA AB F IEG GFDC B BAA A | A A AD C DB CF DCADBA B A | AA AAAB AA A A AB 40 + A A A A --+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 7 21:24 Thursday, June 28, 2001 プロット : PRED1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 30 オブザベーションが欠損値です.) 80 + | PRED1 | A B A | A ACAAEAA C A A A | A ACAIDDD D A A BB 60 + BDBEEFEJBEBAADAA A | AD DHBD ADBAC | A BABABAA | A BBA A A | A AA 40 + A ---+------------+------------+------------+------------+-- 20 40 60 80 100 WEIGHT SAS システム 8 21:24 Thursday, June 28, 2001 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 30 オブザベーションが欠損値です.) | R 50 + e | s | A i 25 + A d | A AA A A u | A AA A BBAA BABCCCB A AAA A a 0 + A BA AAABAABCACD CFDDHGHGEGBBABD A AA l | A A AABACBCBADBB CB B ABBA | A -25 + ---+------------+------------+------------+------------+-- 40 50 60 70 80 Predicted Value of WEIGHT SAS システム 9 21:24 Thursday, June 28, 2001 プロット : RESID1*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 30 オブザベーションが欠損値です.) | R 50 + e | s | A i 25 + A d | A A A A A u | A AA A B BAA B ABCCC B A A B A a 0 + A AAA AAABA ABD C D CF FBIFH GFFBB ABD A AA l | A A A ABACB DAADBAA CB B BAB A | A -25 + ---+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 10 21:24 Thursday, June 28, 2001 プロット : RESID1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 30 オブザベーションが欠損値です.) | R 50 + e | s | A i 25 + A d | A BA A u | AAABCAFBBAFAA B A a 0 + A A ACBCCGCHDGONFJAF B l | AA AD DHBDDBDBAA | A -25 + ---+------------+------------+------------+------------+-- 20 40 60 80 100 WEIGHT