/* Lesson 11-1 */ /* File Name = les1101.sas 06/30/05 */ data gakusei; infile 'all05a.prn' firstobs=2; input sex $ shintyou taijyuu kyoui jitaku $ kodukai carryer $ tsuuwa; if sex^='M' & sex^='F' then delete; proc print data=gakusei(obs=10); run; proc plot data=gakusei; : 散布図を描く plot shintyou*taijyuu; : 散布図の変量を指定(縦軸、横軸の順) plot taijyuu*shintyou; : run: : proc corr data=gakusei; : 相関係数(相関行列)を計算 run: :
SAS システム 2 15:55 Wednesday, June 29, 2005 プロット : SHINTYOU*TAIJYUU. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 42 オブザベーションが欠損値です.) SHINTYOU | 200 + | | B A 180 + A BDCFDDBEA B B A A A | BAFDKHTOHHCFECB BA | AEAGIIFEBBCEAA AA A A 160 + ADCFDIDDBABB | A ECAEDDA A A | A BAA 140 + ---+-----------+-----------+-----------+-----------+-- 20 40 60 80 100 TAIJYUU SAS システム 3 15:55 Wednesday, June 29, 2005 プロット : TAIJYUU*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 42 オブザベーションが欠損値です.) 100 + B | A A TAIJYUU | A A A A B A A | A B CBDDC DCGAD CCF B AA | A AA E B CBDBG JBQHLBJFFDC CBDCB A 50 + AAA CACEC DCI G EBCGF DAABB BB | A A B D BA BA | | | 0 + --+-----------+-----------+-----------+-----------+-----------+- 140 150 160 170 180 190 SHINTYOU SAS システム 4 15:55 Wednesday, June 29, 2005 Correlation Analysis 5 'VAR' Variables: SHINTYOU TAIJYUU KYOUI KODUKAI TSUUWA Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum SHINTYOU 312 167.7 8.2164 52318.7 145.0 186.0 TAIJYUU 281 58.5587 9.3804 16455.0 35.0000 100.0 KYOUI 104 86.4904 7.6425 8995.0 56.0000 112.0 KODUKAI 300 48471.7 48971.1 14541500 0 300000 TSUUWA 103 7073.3 4622.0 728548 200.0 30000.0 SAS システム 5 15:55 Wednesday, June 29, 2005 Correlation Analysis Pearson Correlation Coefficients / Prob > |R| under Ho: Rho=0 / Number of Observations SHINTYOU TAIJYUU KYOUI KODUKAI TSUUWA SHINTYOU 1.00000 0.71196 0.37528 0.04822 0.09182 0.0 0.0001 0.0001 0.4117 0.3636 312 281 104 292 100 TAIJYUU 0.71196 1.00000 0.65722 -0.00876 0.05141 0.0001 0.0 0.0001 0.8873 0.6265 281 281 104 264 92 KYOUI 0.37528 0.65722 1.00000 -0.08511 0.03612 0.0001 0.0001 0.0 0.3998 0.8552 104 104 104 100 28 KODUKAI 0.04822 -0.00876 -0.08511 1.00000 0.14982 0.4117 0.8873 0.3998 0.0 0.1368 292 264 100 300 100 TSUUWA 0.09182 0.05141 0.03612 0.14982 1.00000 0.3636 0.6265 0.8552 0.1368 0.0 100 92 28 100 103
[注意] 相関行列は細切れに表示されるので、 不要部分を削除することによって整形しレポート等に使うこと。
/* Lesson 11-2 */ /* File Name = les1102.sas 06/30/05 */ data gakusei; infile 'all05a.prn' firstobs=2; input sex $ shintyou taijyuu kyoui jitaku $ kodukai carryer $ tsuuwa; if sex^='M' & sex^='F' then delete; proc print data=gakusei(obs=10); run; proc reg data=gakusei; : 回帰分析 model taijyuu=shintyou; : 変量を指定 output out=outreg1 predicted=pred1 residual=resid1; : 結果項目の保存 run; : : proc print data=outreg1(obs=15); : 表示してみる run; : : proc plot data=outreg1; : 散布図を描く plot taijyuu*shintyou/vaxis=20 to 100 by 20; : 体重と身長(縦軸指定) plot pred1*taijyuu; : 予測値と観測値 plot resid1*pred1 /vref=0; : 残差と予測値(残差解析)(水平軸指定) plot resid1*shintyou/vref=0; : 残差と説明変数(残差解析) plot resid1*taijyuu /vref=0; : 残差と目的変数(残差解析) run; : : proc univariate data=outreg1 plot normal; : 残差を正規プロットして確かめる var resid1; : run; :[補足] proc plot の下に以下の行を追加した方がより正確ではある。 欠損値を含むデータを解析対象から除外する事を指示する命令文である。 「欠損値です」の表示が無くなるだけで、得られる図は同じ(欠損値は描画できないから)。 試しに追加する/しないの両方で実行してみよ。
where shintyou^=. and taijyuu^=.;
SAS システム 2 15:55 Wednesday, June 29, 2005 Model: MODEL1 Dependent Variable: TAIJYUU Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 1 12488.43725 12488.43725 286.788 0.0001 Error 279 12149.30389 43.54589 C Total 280 24637.74114 Root MSE 6.59893 R-square 0.5069 Dep Mean 58.55872 Adj R-sq 0.5051 C.V. 11.26891 SAS システム 3 15:55 Wednesday, June 29, 2005 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -79.426466 8.15752248 -9.737 0.0001 SHINTYOU 1 0.819164 0.04837162 16.935 0.0001 SAS システム 4 15:55 Wednesday, June 29, 2005 S H T K C I A J O A T R N I K I D R S P E T J Y T U R U R S O S Y Y O A K Y U E I B E O U U K A E W D D S X U U I U I R A 1 1 1 F 145.0 38.0 . J 10000 . 39.3524 -1.3524 2 F 146.7 41.0 85 J 10000 Vodafone 6000 40.7450 0.2550 3 F 148.0 42.0 . J 50000 . 41.8099 0.1901 4 F 148.0 43.0 80 J 50000 DoCoMo 4000 41.8099 1.1901 5 F 148.9 . . J 60000 . 42.5471 . 6 F 149.0 45.0 . G 60000 . 42.6290 2.3710 7 F 150.0 46.0 86 40000 . 43.4482 2.5518 8 F 151.0 50.0 . G 60000 J-PHONE . 44.2674 5.7326 9 F 151.7 41.5 80 J 35000 . 44.8408 -3.3408 10 F 152.0 35.0 77 J 60000 DoCoMo 2000 45.0865 -10.0865 11 F 152.0 43.0 . J 20000 au 3500 45.0865 -2.0865 12 F 152.0 44.0 . 45000 DoCoMo 4000 45.0865 -1.0865 13 F 153.0 41.0 . J 125000 No . 45.9057 -4.9057 14 F 153.0 42.0 . G 0 Vodafone 1000 45.9057 -3.9057 15 F 153.0 46.5 87 G 10000 . 45.9057 0.5943 SAS システム 6 15:55 Wednesday, June 29, 2005 プロット : TAIJYUU*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 42 オブザベーションが欠損値です.) TAIJYUU | 100 + B | A A 80 + A A A A B A A | A B CBDDC DCGAD CCF B AA 60 + A AA E B CBDBG JBQHLBJFFDC CBDCB A | AAA CACEC DCI G EBCGF DAABB BB 40 + A A B D BA BA | 20 + | --+-----------+-----------+-----------+-----------+-----------+- 140 150 160 170 180 190 SHINTYOU SAS システム 7 15:55 Wednesday, June 29, 2005 プロット : PRED1*TAIJYUU. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 42 オブザベーションが欠損値です.) 80 + | PRED1 | A B A | A BDACFAB F B A A A A | AABBBBLGDDBHBB A BB 60 + BECLHGGKBIBAADABA A | AF EHCH CCAAE A | BBDCEFACAAAA | BABCDACA A A | A CABB B A 40 + A BA ---+------------+------------+------------+------------+-- 20 40 60 80 100 TAIJYUU SAS システム 8 15:55 Wednesday, June 29, 2005 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 42 オブザベーションが欠損値です.) | R 50 + e | s | A A i 25 + A A d | A B A A AA A u | A A A B BBBB BBBDDCCBB ABA A A a 0 +-------------A-ABAA-CCCCECCBJ-EEBECHJBNHIIGIBEBBH-A-AA----------- l | AA BAAAB BA AGDDACDEBBCE CBBBBA | A A -25 + ---+-----------+-----------+-----------+-----------+-----------+-- 30 40 50 60 70 80 Predicted Value of TAIJYUU SAS システム 9 15:55 Wednesday, June 29, 2005 プロット : RESID1*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 42 オブザベーションが欠損値です.) | R 50 + e | s | A A i 25 + A A d | A B A A A A A u | A A A B B BBB B BBDDC CBB A BA A A a 0 +--------A-A-BAA-C-DBCEC-CBJ-E-EBECH-JBNFJAIGIBE-BBH-A--AA-------- l | A A BA AAB B A AFE DACDDABBCCB CBBBB A | A A -25 + ---+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 SHINTYOU SAS システム 10 15:55 Wednesday, June 29, 2005 プロット : RESID1*TAIJYUU. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 42 オブザベーションが欠損値です.) | R 50 + e | s | A A i 25 + A A d | A BABA A u | A ABABBAKBCCGAC B A a 0 +--------------A-DBDEFDMJDQGJSQFLCJ-E--------------------- l | A CABCH CKEHCDFCCA | A A -25 + ---+------------+------------+------------+------------+-- 20 40 60 80 100 TAIJYUU SAS システム 11 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Moments N 281 Sum Wgts 281 Mean 0 Sum 0 Std Dev 6.587137 Variance 43.39037 Skewness 1.485699 Kurtosis 4.475282 USS 12149.3 CSS 12149.3 CV . Std Mean 0.392956 T:Mean=0 0 Pr>|T| 1.0000 Num ^= 0 281 Num > 0 121 M(Sign) -19.5 Pr>=|M| 0.0232 Sgn Rank -2455.5 Pr>=|S| 0.0716 W:Normal 0.913143 Pr<W 0.0001 SAS システム 15 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Histogram # Boxplot 35+* 1 * .* 4 0 .*** 12 0 .************************** 104 +--+--+ .*************************************** 155 *-----* -15+** 5 | ----+----+----+----+----+----+----+---- * may represent up to 4 counts SAS システム 16 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Normal Probability Plot 35+ * | ** ** | ******++++ | ++************** | ************************ -15+**+**+++++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
[注意] 誤差は「説明変量」の軸と垂直に取ることに注意せよ。 誤差は測定時に混入していると考えてモデルが構築されているから。
[注意] 「正規性を乱している者は何でも除外してかまわない」というわけではない。 今回の場合は、元データに戻ったところ、体育会系のずんぐりした者であったため、 普通の大学生とは異なる性質を有していると判断し除外対象とした。 除外する場合にはその根拠を明確にしないと、「恣意的な解析」と言われかねないことに注意せよ。
/* Lesson 11-3 */ /* File Name = les1103.sas 06/30/05 */ data gakusei; infile 'all05a.prn' firstobs=2; input sex $ shintyou taijyuu kyoui jitaku $ kodukai carryer $ tsuuwa; if sex^='M' & sex^='F' then delete; if shintyou=. | taijyuu=. then delete; : 欠損値データを除外 proc print data=gakusei(obs=10); run; proc corr data=gakusei; where taijyuu<85; : 対象データを絞る run; proc reg data=gakusei; model taijyuu=shintyou; where taijyuu<85; : 対象データを絞る output out=outreg1 predicted=pred1 residual=resid1; run; proc print data=outreg1(obs=15); run; proc plot data=outreg1; where taijyuu<85; : 対象データを絞る plot taijyuu*shintyou; plot taijyuu*pred1; plot resid1*(pred1 shintyou taijyuu)/vref=0; : まとめて指定することも可 run; proc univariate data=outreg1 plot normal; var resid1; run;
SAS システム 2 15:55 Wednesday, June 29, 2005 Correlation Analysis 5 'VAR' Variables: SHINTYOU TAIJYUU KYOUI KODUKAI TSUUWA Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum SHINTYOU 277 168.3 8.1293 46626.1 145.0 186.0 TAIJYUU 277 58.0560 8.4350 16081.5 35.0000 82.0000 KYOUI 101 86.0297 7.1449 8689.0 56.0000 110.0 KODUKAI 260 49142.3 50778.4 12777000 0 300000 TSUUWA 92 7319.0 4605.3 673348 500.0 30000.0 SAS システム 3 15:55 Wednesday, June 29, 2005 Correlation Analysis Pearson Correlation Coefficients / Prob > |R| under Ho: Rho=0 / Number of Observations SHINTYOU TAIJYUU KYOUI KODUKAI TSUUWA SHINTYOU 1.00000 0.74146 0.33653 0.05755 0.04857 0.0 0.0001 0.0006 0.3554 0.6457 277 277 101 260 92 TAIJYUU 0.74146 1.00000 0.58868 0.01740 0.05141 0.0001 0.0 0.0001 0.7800 0.6265 277 277 101 260 92 KYOUI 0.33653 0.58868 1.00000 -0.07849 0.03612 0.0006 0.0001 0.0 0.4448 0.8552 101 101 101 97 28 KODUKAI 0.05755 0.01740 -0.07849 1.00000 0.20416 0.3554 0.7800 0.4448 0.0 0.0550 260 260 97 260 89 TSUUWA 0.04857 0.05141 0.03612 0.20416 1.00000 0.6457 0.6265 0.8552 0.0550 0.0 92 92 28 89 92 SAS システム 6 15:55 Wednesday, June 29, 2005 Model: MODEL1 Dependent Variable: TAIJYUU Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 1 10795.99934 10795.99934 335.797 0.0001 Error 275 8841.34333 32.15034 C Total 276 19637.34267 Root MSE 5.67013 R-square 0.5498 Dep Mean 58.05596 Adj R-sq 0.5481 C.V. 9.76666 SAS システム 7 15:55 Wednesday, June 29, 2005 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -71.444313 7.07515732 -10.098 0.0001 SHINTYOU 1 0.769345 0.04198389 18.325 0.0001 SAS システム 10 15:55 Wednesday, June 29, 2005 プロット : TAIJYUU*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... TAIJYUU | 100 + | | A 75 + A B AAA B B B BA A | BB B BBGCCADCGBD BCIAB AA | A AA E B C CBG JBMHKAIFECC CAABA A 50 + AA CACEB CCG F EBCGF DAABB BB | A A BA C BA BB A B A | A 25 + --+-----------+-----------+-----------+-----------+-----------+- 140 150 160 170 180 190 SHINTYOU SAS システム 11 15:55 Wednesday, June 29, 2005 プロット : TAIJYUU*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... TAIJYUU | 100 + | | A 75 + A B AAAB BAABA A | BBBBBFDCECGBDBLAB AA | A AA E BC CIHDMHLHGEEACACAA 50 + AA DCEBCBH FEBCMCBABB BB | A ABA ABBABBA B A | A 25 + ---+-----------+-----------+-----------+-----------+-- 40 50 60 70 80 Predicted Value of TAIJYUU SAS システム 12 15:55 Wednesday, June 29, 2005 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | A AAAAA AB BA A u | A B B E BBBBABDAFDBDBD B A a 0 +--A-ABAA-BABCEACBDAEE-EBHFDJEJIGFBEBCH-A-AA-------------- l | AB ABBA E BABAFECBDDDBCBCBCABBBA | A A B A -20 + ---+------------+------------+------------+------------+-- 40 50 60 70 80 Predicted Value of TAIJYUU SAS システム 13 15:55 Wednesday, June 29, 2005 プロット : RESID1*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | A AAAAA A B B A A u | A B B E B BBBAB DAGCB DBD AA A a 0 +--------A-A-BAA-B-BACEA-CBE-E-E-EBH-HBJEJAHGFBE-BCH-A--AA-------- l | A BA BB AAD B ABAFE DADDDABBBCB CABBB A | A A B A -20 + ---+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 SHINTYOU SAS システム 14 15:55 Wednesday, June 29, 2005 プロット : RESID1*TAIJYUU. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | A A AA C BC A u | B A D B AC DCDIBAEAEB AA a 0 +----------A--AABAADADDFDFCDIEDIBRFJDDFCCD-E---------------------- l | ADAACCCG ABFEEDFCCAFC BA | A B A A -20 + ---+---------+---------+---------+---------+---------+---------+-- 30 40 50 60 70 80 90 TAIJYUU SAS システム 15 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Moments N 277 Sum Wgts 277 Mean 0 Sum 0 Std Dev 5.659846 Variance 32.03385 Skewness 0.722003 Kurtosis 0.805367 USS 8841.343 CSS 8841.343 CV . Std Mean 0.340067 T:Mean=0 0 Pr>|T| 1.0000 Num ^= 0 277 Num > 0 118 M(Sign) -20.5 Pr>=|M| 0.0161 Sgn Rank -1536.5 Pr>=|S| 0.2503 W:Normal 0.963203 Pr<W 0.0001 SAS システム 18 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Histogram # Boxplot 22.5+* 1 0 .* 2 0 .**** 12 0 .************ 34 | .*********************** 69 +--+--+ .*************************************** 116 *-----* .************* 38 | -12.5+** 5 | ----+----+----+----+----+----+----+---- * may represent up to 3 counts SAS システム 19 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Normal Probability Plot 22.5+ * | * * | *******+++ | ********+ | ++******** | ************* | ***********+ -12.5+*+***+++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
/* Lesson 11-4 */ /* File Name = les1104.sas 06/30/05 */ data gakusei; infile 'all05a.prn' firstobs=2; input sex $ shintyou taijyuu kyoui jitaku $ kodukai carryer $ tsuuwa; if sex^='M' & sex^='F' then delete; proc print data=gakusei(obs=10); run; proc reg data=gakusei; : 回帰分析 model taijyuu=shintyou kyoui; : 複数変量を指定 output out=outreg1 predicted=pred1 residual=resid1; : 結果項目の保存 run; : proc print data=outreg1(obs=15); run; : proc plot data=outreg1; : 散布図を描く where shintyou^=. and taijyuu^=. and kyoui^=.; : 解析に使ったデータのみ plot taijyuu*shintyou; : plot taijyuu*kyoui; : plot taijyuu*pred1; : 観測値と予測値 plot resid1*pred1 /vref=0; : 残差と予測値(残差解析) plot resid1*shintyou/vref=0; : 残差と説明変量(残差解析) plot resid1*kyoui /vref=0; : 残差と説明変量(残差解析) plot resid1*taijyuu /vref=0; : 残差と目的変量(残差解析) run; : : proc univariate data=outreg1 plot normal; : 残差を正規プロットして確かめる var resid1; : run; :
SAS システム 2 15:55 Wednesday, June 29, 2005 Model: MODEL1 Dependent Variable: TAIJYUU Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 2 8613.47634 4306.73817 123.577 0.0001 Error 101 3519.92213 34.85071 C Total 103 12133.39846 Root MSE 5.90345 R-square 0.7099 Dep Mean 58.69615 Adj R-sq 0.7042 C.V. 10.05764 SAS システム 3 15:55 Wednesday, June 29, 2005 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -112.792941 11.34884743 -9.939 0.0001 SHINTYOU 1 0.699313 0.07108825 9.837 0.0001 KYOUI 1 0.630221 0.08211341 7.675 0.0001 SAS システム 4 15:55 Wednesday, June 29, 2005 S H T K C I A J O A T R N I K I D R S P E T J Y T U R U R S O S Y Y O A K Y U E I B E O U U K A E W D D S X U U I U I R A 1 1 1 F 145.0 38.0 . J 10000 . . . 2 F 146.7 41.0 85 J 10000 Vodafone 6000 43.3651 -2.36515 3 F 148.0 42.0 . J 50000 . . . 4 F 148.0 43.0 80 J 50000 DoCoMo 4000 41.1231 1.87685 5 F 148.9 . . J 60000 . . . 6 F 149.0 45.0 . G 60000 . . . 7 F 150.0 46.0 86 40000 . 46.3031 -0.30310 8 F 151.0 50.0 . G 60000 J-PHONE . . . 9 F 151.7 41.5 80 J 35000 . 43.7106 -2.21061 10 F 152.0 35.0 77 J 60000 DoCoMo 2000 42.0297 -7.02974 11 F 152.0 43.0 . J 20000 au 3500 . . 12 F 152.0 44.0 . 45000 DoCoMo 4000 . . 13 F 153.0 41.0 . J 125000 No . . . 14 F 153.0 42.0 . G 0 Vodafone 1000 . . 15 F 153.0 46.5 87 G 10000 . 49.0313 -2.53126 SAS システム 6 15:55 Wednesday, June 29, 2005 プロット : TAIJYUU*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... 100 + A | A A TAIJYUU | A A A | B BABAB AACAA A B A AA | A A B A B BBA BAFBC ABA AABBA 50 + A A ADB BBE C BBACB A | A A B A A | | | 0 + --+-----------+-----------+-----------+-----------+-----------+- 140 150 160 170 180 190 SHINTYOU SAS システム 7 15:55 Wednesday, June 29, 2005 プロット : TAIJYUU*KYOUI. 凡例: A = 1 OBS, B = 2 OBS, ... 100 + A | A A TAIJYUU | AA A | A A C BBF BABA A A | A A C C AAE FBJ AAA A 50 + A A AA C ICHBBA | A A B B | | | 0 + ---+-------+-------+-------+-------+-------+-------+-------+-- 50 60 70 80 90 100 110 120 KYOUI SAS システム 8 15:55 Wednesday, June 29, 2005 プロット : TAIJYUU*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... 100 + A | A A TAIJYUU | A A A | A B ADAB BA ABABAA A | A B BAAAAAA CBAADEBABAA AB 50 + B CABBBAEC CDB B | AAAB A | | | 0 + --+-----------+-----------+-----------+-----------+-----------+- 40 50 60 70 80 90 Predicted Value of TAIJYUU SAS システム 9 15:55 Wednesday, June 29, 2005 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | A i 20 + A d | A A A A u | A B BAAA A B CAA A A A a 0 +---A-AB---CABBB-DB-AABAA-BBAACEB-AA--B-BAA---------A------------- l | A AAAA BCA B A AA A BAAAAC A | A -20 + ---+-----------+-----------+-----------+-----------+-----------+-- 40 50 60 70 80 90 Predicted Value of TAIJYUU SAS システム 10 15:55 Wednesday, June 29, 2005 プロット : RESID1*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | A i 20 + A d | A A A A u | B B A BBBAB ABAA a 0 +----------A-A-A-A-AAACB-BAD-B-BABBC-A-CAB-BAC-A-C-A-A--A--------- l | A A AA B AAACB A BAA A ACAA A | A -20 + ---+-----------+-----------+-----------+-----------+-----------+-- 140 150 160 170 180 190 SHINTYOU SAS システム 11 15:55 Wednesday, June 29, 2005 プロット : RESID1*KYOUI. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | A i 20 + A d | A A A A u | B A A B A C ABD B a 0 +-----------------------B-A-E-CCDKCBAG-A-BC---B--------A---------- l | AA B BA FACBD A B A | A -20 + -+--------+--------+--------+--------+--------+--------+--------+- 50 60 70 80 90 100 110 120 KYOUI SAS システム 12 15:55 Wednesday, June 29, 2005 プロット : RESID1*TAIJYUU. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | A i 20 + A d | AA A A u | A BAAAB B BBBA AA a 0 +----------------BABCCBFCAB-CFDBCAA-E----A---------------- l | A A BDABB B ADAAD A | A -20 + ---+------------+------------+------------+------------+-- 20 40 60 80 100 TAIJYUU SAS システム 17 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Stem Leaf # Boxplot 2 4 1 * 1 8 1 0 1 01224 5 0 0 5567777788888 13 | 0 00011111122223334444 20 +--+--+ -0 4444444333333333322222222222222211111110000 43 *-----* -0 99877777666666555555 20 | -1 0 1 | ----+----+----+----+----+----+----+----+--- Multiply Stem.Leaf by 10**+1 SAS システム 18 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Normal Probability Plot 22.5+ * | * | ***+*+++++ | *******++ | +++******* | ************* | * * *********+ -12.5+*+++++++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
/* Lesson 11-5 */ /* File Name = les1105.sas 06/30/05 */ data gakusei; infile 'all05a.prn' firstobs=2; input sex $ shintyou taijyuu kyoui jitaku $ kodukai carryer $ tsuuwa; if sex^='M' & sex^='F' then delete; : 性別不明は除外 if shintyou=. | taijyuu=. | kyoui=. then delete; : 欠損のあるデータは除外 proc print data=gakusei(obs=10); run; proc corr data=gakusei; : 相関係数 where sex='M'; : 男性について run; : : proc reg data=gakusei; : 回帰分析 model taijyuu=shintyou kyoui; : where sex='M'; : 男性について output out=outreg1 predicted=pred1 residual=resid1; : run; : proc print data=outreg1(obs=15); run; proc plot data=outreg1; where sex='M'; : 対象データについて plot taijyuu*shintyou; plot taijyuu*kyoui; plot taijyuu*pred1; plot resid1*(pred1 shintyou kyoui taijyuu)/vref=0; : まとめて記述 /* plot resid1*pred1 /vref=0; plot resid1*shintyou/vref=0; plot resid1*kyoui /vref=0; plot resid1*taijyuu /vref=0; */ run; proc univariate data=outreg1 plot normal; var resid1; run;
SAS システム 2 15:55 Wednesday, June 29, 2005 Correlation Analysis 5 'VAR' Variables: SHINTYOU TAIJYUU KYOUI KODUKAI TSUUWA Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum SHINTYOU 65 172.4 6.1412 11206.1 156.0 185.0 TAIJYUU 65 64.5338 9.1006 4194.7 46.0000 100.0 KYOUI 65 88.5231 8.5533 5754.0 56.0000 112.0 KODUKAI 61 54360.7 57528.0 3316000 0 300000 TSUUWA 9 9000.0 3316.6 81000.0 5000.0 15000.0 SAS システム 3 15:55 Wednesday, June 29, 2005 Correlation Analysis Pearson Correlation Coefficients / Prob > |R| under Ho: Rho=0 / Number of Observations SHINTYOU TAIJYUU KYOUI KODUKAI TSUUWA SHINTYOU 1.00000 0.42245 0.18792 0.11868 0.05579 0.0 0.0005 0.1339 0.3623 0.8866 65 65 65 61 9 TAIJYUU 0.42245 1.00000 0.65243 -0.04587 0.25053 0.0005 0.0 0.0001 0.7256 0.5156 65 65 65 61 9 KYOUI 0.18792 0.65243 1.00000 -0.12281 -0.20000 0.1339 0.0001 0.0 0.3457 0.6059 65 65 65 61 9 KODUKAI 0.11868 -0.04587 -0.12281 1.00000 0.44259 0.3623 0.7256 0.3457 0.0 0.2329 61 61 61 61 9 TSUUWA 0.05579 0.25053 -0.20000 0.44259 1.00000 0.8866 0.5156 0.6059 0.2329 0.0 9 9 9 9 9 SAS システム 6 15:55 Wednesday, June 29, 2005 Model: MODEL1 Dependent Variable: TAIJYUU Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 2 2750.23021 1375.11510 33.431 0.0001 Error 62 2550.25533 41.13315 C Total 64 5300.48554 Root MSE 6.41351 R-square 0.5189 Dep Mean 64.53385 Adj R-sq 0.5033 C.V. 9.93822 SAS システム 7 15:55 Wednesday, June 29, 2005 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 -70.823844 22.89744419 -3.093 0.0030 SHINTYOU 1 0.460606 0.13291031 3.466 0.0010 KYOUI 1 0.632022 0.09542833 6.623 0.0001 SAS システム 10 15:55 Wednesday, June 29, 2005 プロット : TAIJYUU*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... TAIJYUU | 100 + A | A A | 75 + A A A A A AA | B B A C A A A C A A D A A A | A A A A B A B A D B C A AAA A A AA A 50 + A B A | | 25 + --+---------+---------+---------+---------+---------+---------+- 155 160 165 170 175 180 185 SHINTYOU SAS システム 11 15:55 Wednesday, June 29, 2005 プロット : TAIJYUU*KYOUI. 凡例: A = 1 OBS, B = 2 OBS, ... TAIJYUU | 100 + A | A A | 75 + AA BA A A | A A C BAH BAAB A | A A B C AAC EBF AA A 50 + A A A A | | 25 + ---+-------+-------+-------+-------+-------+-------+-------+-- 50 60 70 80 90 100 110 120 KYOUI SAS システム 12 15:55 Wednesday, June 29, 2005 プロット : TAIJYUU*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... TAIJYUU | 100 + A | A A | 75 + AA AAB A | BA A DABBBABB AAA | A AA B AABBACDDBA B 50 + A A AA | | 25 + --+-----------+-----------+-----------+-----------+-----------+- 40 50 60 70 80 90 Predicted Value of TAIJYUU SAS システム 13 15:55 Wednesday, June 29, 2005 プロット : RESID1*PRED1. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | A A u | A A BA A CBA AA a 0 +---------------AA--A---A--ABA-BBBABB--B-C----------A------------- l | AA A AAADBBA CB AA | -20 + ---+-----------+-----------+-----------+-----------+-----------+-- 40 50 60 70 80 90 Predicted Value of TAIJYUU SAS システム 14 15:55 Wednesday, June 29, 2005 プロット : RESID1*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | A A u | A B A B A B A B AA a 0 +----A-------A-----------A-B---A-C-A-A-A--AC---A-BA--B-A-A---A---- l | A B A A A B C A B A A A BA A A | -20 + ---+---------+---------+---------+---------+---------+---------+-- 155 160 165 170 175 180 185 SHINTYOU SAS システム 15 15:55 Wednesday, June 29, 2005 プロット : RESID1*KYOUI. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | A A u | A B A B BD B a 0 +------------------A----B-A-B---ABABAE-A-AC---A--------A---------- l | A B BBBAF AAB A A | -20 + -+--------+--------+--------+--------+--------+--------+--------+- 50 60 70 80 90 100 110 120 KYOUI SAS システム 16 15:55 Wednesday, June 29, 2005 プロット : RESID1*TAIJYUU. 凡例: A = 1 OBS, B = 2 OBS, ... | R 40 + e | s | i 20 + A A d | A A u | A A B AAAC A A AA a 0 +----------A------AA--ADACA-DA-A-CB------A------------------------ l | A A CA B FABABA A | -20 + ---+---------+---------+---------+---------+---------+---------+-- 40 50 60 70 80 90 100 TAIJYUU SAS システム 17 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Moments N 65 Sum Wgts 65 Mean 0 Sum 0 Std Dev 6.312507 Variance 39.84774 Skewness 1.210762 Kurtosis 1.816118 USS 2550.255 CSS 2550.255 CV . Std Mean 0.78297 T:Mean=0 0 Pr>|T| 1.0000 Num ^= 0 65 Num > 0 26 M(Sign) -6.5 Pr>=|M| 0.1360 Sgn Rank -131.5 Pr>=|S| 0.3943 W:Normal 0.91253 Pr<W 0.0001 SAS システム 20 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Stem Leaf # Boxplot 2 2 1 0 1 8 1 0 1 024 3 | 0 5555667778 10 | 0 00001233344 11 +--+--+ -0 4444433333322111111100 22 *-----* -0 99887766655555555 17 +-----+ ----+----+----+----+-- Multiply Stem.Leaf by 10**+1 SAS システム 21 15:55 Wednesday, June 29, 2005 Univariate Procedure Variable=RESID1 Residual Normal Probability Plot 22.5+ * | * ++ | **++++++ 7.5+ +******* | +++******* | *********** -7.5+ * * ********** +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
where sex='M' and taijyuu<85;