/* Lesson 13-1 */ /* File Name = les1301.sas 07/12/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 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 15:45 Wednesday, July 4, 2001 Model: MODEL1 Dependent Variable: WEIGHT Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 2 5269.53613 2634.76807 61.604 0.0001 Error 69 2951.09706 42.76952 C Total 71 8220.63319 Root MSE 6.53984 R-square 0.6410 Dep Mean 60.95972 Adj R-sq 0.6306 C.V. 10.72813 SAS システム 3 15:45 Wednesday, July 4, 2001 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -104.150636 16.16517150 -6.443 0.0001 HEIGHT 1 0.631337 0.09981401 6.325 0.0001 CHEST 1 0.669473 0.10527150 6.359 0.0001 SAS システム 4 15:45 Wednesday, July 4, 2001 OBS SEIBETSU HEIGHT WEIGHT CHEST JITAKU KODUKAI PRED1 RESID1 1 F 145.0 38.0 . J 10000 . . 2 F 148.0 42.0 . J 50000 . . 3 F 148.9 . . J 60000 . . 4 F 149.0 45.0 . G 60000 . . 5 F 150.0 46.0 86 40000 48.1246 -2.1246 6 F 151.7 41.5 80 J 35000 45.1810 -3.6810 7 F 153.0 46.5 87 G 10000 50.6881 -4.1881 8 F 153.0 55.0 78 J 30000 44.6628 10.3372 9 F 154.0 46.0 . . . . 10 F 155.0 48.0 83 G 180000 49.2729 -1.2729 11 F 155.0 . . J 20000 . . 12 F 156.0 48.0 70 J 30000 41.2011 6.7989 13 F 156.0 49.0 85 J 25000 51.2431 -2.2431 14 M 156.0 61.0 90 J 0 54.5905 6.4095 15 F 156.0 . . J 30000 . . SAS システム 5 15:45 Wednesday, July 4, 2001 プロット : WEIGHT*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... WEIGHT | 100 + A | A | A 80 + A A A | AAB A A A | B AAA AA B AA 60 + A A A A AA B EAC ABA AA | A A A A AB AA AA A A | A A AB AA A A B 40 + A ---+-----------+-----------+-----------+-----------+-- 150 160 170 180 190 HEIGHT SAS システム 6 15:45 Wednesday, July 4, 2001 プロット : WEIGHT*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ... WEIGHT | 100 + A | A | A 80 + B A | BC A A | A C A C AA A 60 + A C AABDAF AB A | A A A BAAD B | A A BB CAA 40 + A -+--------+--------+--------+--------+--------+--------+--------+ 50 60 70 80 90 100 110 120 CHEST SAS システム 7 15:45 Wednesday, July 4, 2001 プロット : WEIGHT*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... WEIGHT | 100 + A | A | A 80 + A A A | BAA AB | AA C AAAAA A 60 + A BA ABAADDBAAAA | A A A AAAC B A A | A AA BAAAAB 40 + A --+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 Predicted Value of WEIGHT SAS システム 8 15:45 Wednesday, July 4, 2001 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | A A A A u | A A B AA CAA A A a 0 + AA B AA A AABA DBAAA A AB l | A AAAABE A ABBBAABAA A A | -20 + ---+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 Predicted Value of WEIGHT SAS システム 9 15:45 Wednesday, July 4, 2001 プロット : RESID1*HEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | A A A A u | B A B AAA B AB a 0 + A AAA A AA BBA ABA AB AB A A A l | A A A AA BAB BB CA B A A BB A A | -20 + ---+------------+------------+------------+------------+-- 150 160 170 180 190 HEIGHT SAS システム 10 15:45 Wednesday, July 4, 2001 プロット : RESID1*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | A A A A u | A A A A B BC B a 0 + A A AABEACAD A B B l | C CB DBCBD AAB A | -20 + -+--------+--------+--------+--------+--------+--------+--------+- 50 60 70 80 90 100 110 120 CHEST SAS システム 11 15:45 Wednesday, July 4, 2001 プロット : RESID1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | AA A A u | A AAA B A AB A AA a 0 + A AA A A AA AAD DA C A AB l | A ABBBABAA AA A EAAAAA A A | -20 + ---+---------+---------+---------+---------+---------+---------+-- 40 50 60 70 80 90 100 WEIGHT
/* Lesson 13-2 */ /* File Name = les1302.sas 07/12/01 */ data gakusei; infile 'all01.prn'; input seibetsu $ height weight chest jitaku $ kodukai; proc print data=gakusei(obs=10); run; proc corr data=gakusei; : 相関係数 where seibetsu='M'; : 男性について run; : : proc reg data=gakusei; : 回帰分析 where seibetsu='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 seibetsu='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 15:45 Wednesday, July 4, 2001 Correlation Analysis 4 'VAR' Variables: HEIGHT WEIGHT CHEST KODUKAI Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum HEIGHT 141 172.1 5.3748 24271.3 156.0 186.0 WEIGHT 141 62.4092 7.7602 8799.7 46.0000 100.0 CHEST 53 88.9623 8.3849 4715.0 56.0000 112.0 KODUKAI 133 52842.1 50334.3 7028000 0 200000 SAS システム 3 15:45 Wednesday, July 4, 2001 Correlation Analysis Pearson Correlation Coefficients / Prob > |R| under Ho: Rho=0 / Number of Observations HEIGHT WEIGHT CHEST KODUKAI HEIGHT 1.00000 0.42306 0.20816 0.00597 0.0 0.0001 0.1347 0.9463 141 141 53 130 WEIGHT 0.42306 1.00000 0.66420 -0.11640 0.0001 0.0 0.0001 0.1872 141 141 53 130 CHEST 0.20816 0.66420 1.00000 -0.15971 0.1347 0.0001 0.0 0.2730 53 53 53 49 KODUKAI 0.00597 -0.11640 -0.15971 1.00000 0.9463 0.1872 0.2730 0.0 130 130 49 133 SAS システム 5 15:45 Wednesday, July 4, 2001 Model: MODEL1 Dependent Variable: WEIGHT Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 2 2399.15565 1199.57783 26.269 0.0001 Error 50 2283.29416 45.66588 C Total 52 4682.44981 Root MSE 6.75765 R-square 0.5124 Dep Mean 65.00189 Adj R-sq 0.4929 C.V. 10.39609 SAS システム 6 15:45 Wednesday, July 4, 2001 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -68.937938 26.75338254 -2.577 0.0130 HEIGHT 1 0.422744 0.15644453 2.702 0.0094 CHEST 1 0.687410 0.11426592 6.016 0.0001 SAS システム 7 15:45 Wednesday, July 4, 2001 OBS SEIBETSU HEIGHT WEIGHT CHEST JITAKU KODUKAI PRED1 RESID1 1 M 156 61.0 90 J 0 58.8771 2.12285 2 M 160 55.0 . J 25000 . . 3 M 160 55.0 . G 65000 . . 4 M 162 60.0 . J 80000 . . 5 M 162 62.0 100 J 0 68.2877 -6.28772 6 M 163 46.0 80 J 50000 54.9623 -8.96225 7 M 163 51.0 82 J 10000 56.3371 -5.33707 8 M 163 51.0 . G 75000 . . 9 M 163 60.0 78 80000 53.5874 6.41257 10 M 163 62.0 . J 25000 . . 11 M 164 62.5 . J 35000 . . 12 M 165 64.0 . J 0 . . 13 M 166 54.0 . J 0 . . 14 M 166 55.0 85 100000 59.6675 -4.66754 15 M 166 60.0 88 G 150000 61.7298 -1.72977 SAS システム 8 15:45 Wednesday, July 4, 2001 プロット : 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 ABBCBE AA A 50 + A A A | | 25 + -+--------+--------+--------+--------+--------+--------+--------+ 50 60 70 80 90 100 110 120 CHEST SAS システム 9 15:45 Wednesday, July 4, 2001 プロット : WEIGHT*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... WEIGHT | 100 + A | A A | 75 + B A B A A | AAA BBAAC BA A | AA A ABAABCBCABAAA 50 + A A A | | 25 + --+-----------+-----------+-----------+-----------+-----------+-- 40 50 60 70 80 90 Predicted Value of WEIGHT SAS システム 10 15:45 Wednesday, July 4, 2001 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... | R 20 + A e | A s | A A i 10 + A d | A AA A A u | A A A AAA A A a 0 + AA A A A A A l | A AB ADAAB A A | A A BAAC A -10 + A AA ---+-----------+-----------+-----------+-----------+-----------+-- 40 50 60 70 80 90 Predicted Value of WEIGHT SAS システム 11 15:45 Wednesday, July 4, 2001 プロット : 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 u | A B B A A A a 0 + A A AA A A A l | B A A B A B B A A A A | A A A B A A A A A -10 + A A A ---+---------+---------+---------+---------+---------+---------+-- 155 160 165 170 175 180 185 HEIGHT SAS システム 12 15:45 Wednesday, July 4, 2001 プロット : RESID1*CHEST. 凡例: A = 1 OBS, B = 2 OBS, ... | R 20 + A e | A s | A A i 10 + A d | A B B u | A A A B C a 0 + A AB A A A l | A AACAE A A A | A AA B AAB A -10 + A A A -+--------+--------+--------+--------+--------+--------+--------+- 50 60 70 80 90 100 110 120 CHEST SAS システム 13 15:45 Wednesday, July 4, 2001 プロット : RESID1*WEIGHT. 凡例: A = 1 OBS, B = 2 OBS, ... | R 20 + A e | A s | A A i 10 + A d | A A A AA u | A AA B A AA a 0 + B A A A AA l | A A DABA C A A | A A C BAA A -10 + A AA ---+---------+---------+---------+---------+---------+---------+-- 40 50 60 70 80 90 100 WEIGHT