/* Lesson 13-1 */ /* File Name = les1301.sas 07/11/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 chest; : 複数変量を指定 output out=outreg1 predicted=pred1 residual=resid1; : 結果項目の保存 run; : proc print data=outreg1(obs=15); run; proc plot data=outreg1; : 散布図を描く where weight^=. and height^=. and chest^=.; : 解析に使ったデータのみ plot weight*height; : plot weight*chest; : plot weight*pred1; : 観測値と予測値 plot resid1*pred1; : 残差と予測値(残差解析) plot resid1*height; : 残差と説明変量(残差解析) plot resid1*chest; : 残差と説明変量(残差解析) plot resid1*weight; : 残差と目的変量(残差解析) run; :
SAS システム 2 12:08 Wednesday, June 26, 2002 Model: MODEL1 Dependent Variable: WEIGHT Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 2 6850.08658 3425.04329 82.203 0.0001 Error 78 3249.91885 41.66563 C Total 80 10100.00543 Root MSE 6.45489 R-square 0.6782 Dep Mean 59.47654 Adj R-sq 0.6700 C.V. 10.85284 SAS システム 3 12:08 Wednesday, June 26, 2002 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -112.626022 14.35504905 -7.846 0.0001 HEIGHT 1 0.668327 0.09037923 7.395 0.0001 CHEST 1 0.689065 0.10023487 6.875 0.0001 SAS システム 4 12:08 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 . . . 2 F 148.0 42.0 . J 50000 . . . 3 F 148.0 43.0 80 J 50000 DoCoMo 4000 41.4116 1.5884 4 F 148.9 . . J 60000 . . . 5 F 149.0 45.0 . G 60000 . . . 6 F 150.0 46.0 86 40000 . 46.8826 -0.8826 7 F 151.7 41.5 80 J 35000 . 43.8844 -2.3844 8 F 152.0 35.0 77 J 60000 DoCoMo 2000 42.0177 -7.0177 9 F 153.0 41.0 . J 125000 No . . . 10 F 153.0 46.5 87 G 10000 . 49.5767 -3.0767 11 F 153.0 50.0 . G 70000 DoCoMo 10000 . . 12 F 153.0 55.0 78 J 30000 . 43.3751 11.6249 13 F 153.5 46.0 . J 30000 J-PHONE 8000 . . 14 F 154.0 46.0 . . . . . 15 F 155.0 48.0 83 G 180000 . 48.1571 -0.1571 SAS システム 6 12:08 Wednesday, June 26, 2002 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... 100 + A | A A WEIGHT | A A A | B AABAB A AA A A A AA | A A A A B BA BAEBC ABA AABA 50 + A A ABA AAB C BB CB A | A B A | | | 0 + --+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 7 12:08 Wednesday, June 26, 2002 プロット : WEIGHT*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ... 100 + A | A A WEIGHT | B A | A C ABE AA B A | A B C A ACBDBH AB A 50 + A A B A CCAHAAA | A B A | | | 0 + -+--------+--------+--------+--------+--------+--------+--------+ 50 60 70 80 90 100 110 120 CHEST SAS システム 8 12:08 Wednesday, June 26, 2002 プロット : WEIGHT*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... 100 + A | A A WEIGHT | AA A | A A CBBAA AA AB A | A A A AB AACA BEDBBAAAA 50 + A A BA DAABCCB B | AA A A | | | 0 + --+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 Predicted Value of WEIGHT SAS システム 9 12:08 Wednesday, June 26, 2002 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A d | A A A A A u | A A A AB A A BAB AA a 0 + A A BA D AAAA AACA BCBBA AA AB l | A AA ABBB B ABBABAAAA A A | -20 + ---+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 Predicted Value of WEIGHT SAS システム 10 12:08 Wednesday, June 26, 2002 プロット : RESID1*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A d | A A A A A u | B A A BBAAB AAA a 0 + A A A A AAA A A B BA CB A CAA BAB A A A A l | A A AA B AA BC BAB A AAABA A | -20 + ---+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 HEIGHT SAS システム 11 12:08 Wednesday, June 26, 2002 プロット : RESID1*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A d | A A A A A u | A A A A A B ABC B a 0 + B C ABBGBCAF A B B l | A B CA FABBC AAB A | -20 + -+--------+--------+--------+--------+--------+--------+--------+- 50 60 70 80 90 100 110 120 CHEST SAS システム 12 12:08 Wednesday, June 26, 2002 プロット : RESID1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A d | AA A A A u | A A AAB B AABA AA a 0 + AA BCBBB B AECBD A C l | A A BCABB B AEBAA A A | -20 + ---+------------+------------+------------+------------+-- 20 40 60 80 100 WEIGHT
/* Lesson 13-2 */ /* File Name = les1302.sas 07/11/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 corr data=gakusei; : 相関係数 where sex='M'; : 男性について run; : : proc reg data=gakusei; : 回帰分析 where sex='M'; : 男性について model weight=height chest; : output out=outreg1 predicted=pred1 residual=resid1; : run; : proc print data=outreg1(obs=15); run; proc plot data=outreg1; where sex='M' and weight^=. and height^=. and chest^=.; : 対象データについて plot weight*height; plot weight*chest; plot weight*pred1; plot resid1*pred1; plot resid1*height; plot resid1*chest; plot resid1*weight; run;
SAS システム 2 12:08 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 161 172.1 5.3864 27707.7 156.0 186.0 WEIGHT 161 62.1006 7.7575 9998.2 46.0000 100.0 CHEST 55 88.6545 8.4266 4876.0 56.0000 112.0 KODUKAI 152 51223.7 53478.7 7786000 0 300000 TSUUWA 16 8421.9 6457.4 134750 3000.0 30000.0 SAS システム 3 12:08 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.44864 0.23887 0.07003 -0.25384 0.0 0.0001 0.0790 0.3961 0.3428 161 161 55 149 16 WEIGHT 0.44864 1.00000 0.68177 -0.03517 -0.03971 0.0001 0.0 0.0001 0.6703 0.8839 161 161 55 149 16 CHEST 0.23887 0.68177 1.00000 -0.13803 . 0.0790 0.0001 0.0 0.3341 . 55 55 55 51 0 KODUKAI 0.07003 -0.03517 -0.13803 1.00000 0.03912 0.3961 0.6703 0.3341 0.0 0.8899 149 149 51 152 15 TSUUWA -0.25384 -0.03971 . 0.03912 1.00000 0.3428 0.8839 . 0.8899 0.0 16 16 0 15 16 SAS システム 6 12:08 Wednesday, June 26, 2002 Model: MODEL1 Dependent Variable: WEIGHT Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 2 2671.17575 1335.58787 29.980 0.0001 Error 52 2316.55407 44.54912 C Total 54 4987.72982 Root MSE 6.67451 R-square 0.5355 Dep Mean 64.60182 Adj R-sq 0.5177 C.V. 10.33177 SAS システム 7 12:08 Wednesday, June 26, 2002 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -69.594797 25.09753300 -2.773 0.0077 HEIGHT 1 0.417699 0.14842267 2.814 0.0069 CHEST 1 0.702950 0.11100078 6.333 0.0001 SAS システム 8 12:08 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 M 156 61.0 90 J 0 . 58.8318 2.16824 2 M 160 48.0 76 J 5000 No . 50.6613 -2.66126 3 M 160 55.0 . J 25000 . . . 4 M 160 55.0 . G 65000 . . . 5 M 162 60.0 . J 80000 . . . 6 M 162 62.0 100 J 0 . 68.3675 -6.36746 7 M 163 46.0 80 J 50000 . 54.7262 -8.72616 8 M 163 51.0 82 J 10000 . 56.1321 -5.13206 9 M 163 51.0 . G 75000 . . . 10 M 163 60.0 78 80000 . 53.3203 6.67974 11 M 163 62.0 . J 25000 . . . 12 M 164 62.5 . J 35000 . . . 13 M 165 53.0 . . DoCoMo 5000 . . 14 M 165 55.0 . J 4000 No . . . 15 M 165 64.0 . J 0 . . . SAS システム 10 12:08 Wednesday, June 26, 2002 プロット : WEIGHT*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ... WEIGHT | 100 + A | A A | 75 + AA C A A | A C AAF AA B | A A C A ACBCBE AA A 50 + A A A A | | 25 + -+--------+--------+--------+--------+--------+--------+--------+ 50 60 70 80 90 100 110 120 CHEST SAS システム 11 12:08 Wednesday, June 26, 2002 プロット : WEIGHT*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... WEIGHT | 100 + A | A A | 75 + B A B A A | AA A BBABB BA A | B A BAAABCBDBAAAA 50 + A A AA | | 25 + --+-----------+-----------+-----------+-----------+-----------+-- 40 50 60 70 80 90 Predicted Value of WEIGHT SAS システム 12 12:08 Wednesday, June 26, 2002 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... | R 20 + A e | A s | A A i 10 + A d | A A AA A A u | A AAA A A A a 0 + AAA A A A A A l | A A B AEAAB A A A | A A AAAAB A -10 + A AA ---+-----------+-----------+-----------+-----------+-----------+-- 40 50 60 70 80 90 Predicted Value of WEIGHT SAS システム 13 12:08 Wednesday, June 26, 2002 プロット : RESID1*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... | R 20 + A e | A s | A A i 10 + A d | A A A A A A u | A A B A A A a 0 + A A A AA A A A l | A A A A B A B B A A A B A | A A A B A A A A -10 + A A A ---+---------+---------+---------+---------+---------+---------+-- 155 160 165 170 175 180 185 HEIGHT SAS システム 14 12:08 Wednesday, June 26, 2002 プロット : RESID1*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ... | R 20 + A e | A s | A A i 10 + A d | A A B B u | A A B C a 0 + A AB A A A A l | A A BABAF A A A | A AA A AAB A -10 + A A A -+--------+--------+--------+--------+--------+--------+--------+- 50 60 70 80 90 100 110 120 CHEST SAS システム 15 12:08 Wednesday, June 26, 2002 プロット : RESID1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... | R 20 + A e | A s | A A i 10 + A d | A A A A AA u | A A B A AA a 0 + C A A A AA l | A A A DABAAC A A | A A C BA A -10 + A AA ---+---------+---------+---------+---------+---------+---------+-- 40 50 60 70 80 90 100 WEIGHT