/* Lesson 10-1 */ /* File Name = anke08.sas 06/26/97 */ data gakusei; infile 'taikaku.dat'; input seibetsu $ shintyou taijyuu kyoui; proc format; value clshin low-<150=' -149' 150-<160='150-159' 160-<170='160-169' 170-high='170- ' other ='missing'; run; proc print data=gakusei(obs=10); run; : proc tabulate data=gakusei; : 帳票の作成 class shintyou seibetsu; : 特性変数であることの宣言 var taijyuu; : 集計する変量名 tables taijyuu*(n mean std),shintyou*seibetsu; : 表示内容、分類変量名 format shintyou clshin.; : 身長のクラス分けの定義 run; :
SAS システム 2 23:06 Wednesday, June 25, 1997 ---------------------------------------------------------------------- | | SHINTYOU | | |---------------------------------------------------| | | -149 | 150-159 | 160-169 | | |------------+-------------------------+------------| | | SEIBETSU | SEIBETSU | SEIBETSU | | |------------+-------------------------+------------| | | F | F | M | F | |----------------+------------+------------+------------+------------| |TAIJYUU|N | 0.00| 1.00| 1.00| 0.00| | |--------+------------+------------+------------+------------| | |MEAN | .| 43.00| 61.00| .| | |--------+------------+------------+------------+------------| | |STD | .| .| .| .| ---------------------------------------------------------------------- (CONTINUED) SAS システム 3 23:06 Wednesday, June 25, 1997 --------------------------------------------------------- | | SHINTYOU | | |--------------------------------------| | | 160-169 | 170- | | |------------+-------------------------| | | SEIBETSU | SEIBETSU | | |------------+-------------------------| | | M | F | M | |----------------+------------+------------+------------| |TAIJYUU|N | 9.00| 0.00| 16.00| | |--------+------------+------------+------------| | |MEAN | 58.89| .| 63.71| | |--------+------------+------------+------------| | |STD | 4.11| .| 7.25| ---------------------------------------------------------
/* Lesson 10-2 */ /* File Name = ttest01.sas 06/26/97 */ data gakusei; infile 'taikaku.dat'; input seibetsu $ shintyou taijyuu kyoui; proc print data=gakusei(obs=10); run; : proc ttest data=gakusei; : t検定 class seibetsu; : 分類したい特性変数の指定 var shintyou; : 比較したい変量名 run; :
SAS システム 2 23:14 Wednesday, June 25, 1997 TTEST PROCEDURE Variable: SHINTYOU SEIBETSU N Mean Std Dev Std Error ---------------------------------------------------------------------- F 12 160.52500000 5.74584830 1.65868353 M 26 170.95000000 5.54914408 1.08827669 Variances T DF Prob>|T| --------------------------------------- Unequal -5.2550 20.8 0.0001 Equal -5.3248 36.0 0.0000 For H0: Variances are equal, F' = 1.07 DF = (11,25) Prob>F' = 0.8402
SAS システム 8 15:45 Thursday, November 21, 1996 TTEST PROCEDURE Variable: SHINTYOU SEIBETSU N Mean Std Dev Std Error ---------------------------------------------------------------------- F 180 157.55277778 4.71964195 0.35178134 M 37 170.92162162 5.29460601 0.87042787 Variances T DF Prob>|T| --------------------------------------- Unequal -14.2400 48.5 0.0001 Equal -15.3635 215.0 0.0000 For H0: Variances are equal, F' = 1.26 DF = (36,179) Prob>F' = 0.3334 SAS システム 9 15:45 Thursday, November 21, 1996 TTEST PROCEDURE Variable: TAIJYUU SEIBETSU N Mean Std Dev Std Error ---------------------------------------------------------------------- F 53 48.54716981 4.83169041 0.66368372 M 37 63.51081081 7.69479564 1.26501661 Variances T DF Prob>|T| --------------------------------------- Unequal -10.4747 55.6 0.0001 Equal -11.3283 88.0 0.0000 For H0: Variances are equal, F' = 2.54 DF = (36,52) Prob>F' = 0.0022 SAS システム 10 15:45 Thursday, November 21, 1996 TTEST PROCEDURE Variable: KYOUI SEIBETSU N Mean Std Dev Std Error ---------------------------------------------------------------------- F 26 81.96153846 3.13024944 0.61389242 M 14 92.57142857 6.83558884 1.82688796 Variances T DF Prob>|T| --------------------------------------- Unequal -5.5051 16.0 0.0001 Equal -6.7578 38.0 0.0000 For H0: Variances are equal, F' = 4.77 DF = (13,25) Prob>F' = 0.0008 SAS システム 11 15:45 Thursday, November 21, 1996 TTEST PROCEDURE Variable: KOZUKAI SEIBETSU N Mean Std Dev Std Error --------------------------------------------------------------------- F 142 48598.59154930 44311.12756826 3718.50722204 M 27 55925.92592593 50019.93904429 9626.34175736 Variances T DF Prob>|T| --------------------------------------- Unequal -0.7100 34.2 0.4825 Equal -0.7713 167.0 0.4416 For H0: Variances are equal, F' = 1.27 DF = (26,141) Prob>F' = 0.3727
/* Lesson 10-3 */ /* File Name = wilco01.sas 06/26/97 */ data gakusei; infile 'taikaku.dat'; input seibetsu $ shintyou taijyuu kyoui; proc print data=gakusei(obs=10); run; : proc npar1way data=gakusei wilcoxon; : wilcoxon 検定 class seibetsu; : 分類したい特性変数の指定 var shintyou; : 比較したい変量名 run; :
SAS システム 2 23:18 Wednesday, June 25, 1997 N P A R 1 W A Y P R O C E D U R E Wilcoxon Scores (Rank Sums) for Variable SHINTYOU Classified by Variable SEIBETSU Sum of Expected Std Dev Mean SEIBETSU N Scores Under H0 Under H0 Score F 12 110.0 234.0 31.7753494 9.1666667 M 26 631.0 507.0 31.7753494 24.2692308 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) S = 110.000 Z = -3.88666 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0004 SAS システム 3 23:18 Wednesday, June 25, 1997 N P A R 1 W A Y P R O C E D U R E Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 15.229 DF = 1 Prob > CHISQ = 0.0001
/* Lesson 10-4 */ /* File Name = scat01.sas 06/26/97 */ data gakusei; infile 'taikaku.dat'; input seibetsu $ shintyou taijyuu kyoui; proc print data=gakusei(obs=10); run; proc means data=gakusei; run; : proc plot data=gakusei; : 散布図を描く plot taijyuu*shintyou; : 散布図の変量を指定(縦軸、横軸の順) run; :
SAS システム 2 13:07 Thursday, June 26, 1997 Variable N Mean Std Dev Minimum Maximum -------------------------------------------------------------------- SHINTYOU 38 167.6578947 7.3985255 148.9000000 182.0000000 TAIJYUU 27 61.2370370 7.3472731 43.0000000 77.0000000 KYOUI 11 88.8181818 6.0633024 80.0000000 100.0000000 -------------------------------------------------------------------- SAS システム 3 13:07 Thursday, June 26, 1997 プロット : TAIJYUU*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... 80 + | A A | A TAIJYUU | A | A A A A | A A A 60 + A AA A AA A | A A A B | AA A | | | A 40 + --+-----------+-----------+-----------+-----------+-----------+- 140 150 160 170 180 190 SHINTYOU NOTE: 14 オブザベーションが欠損値です.
/* Lesson 10-5 */ /* File Name = reg01.sas 06/26/97 */ data gakusei; infile 'taikaku.dat'; input seibetsu $ shintyou taijyuu kyoui; proc print data=gakusei(obs=10); run; proc reg data=gakusei; : 回帰分析 model shintyou=taijyuu; : 変量を指定 output out=o_reg1 predicted=pred1 residual=resid1; : 結果項目の保存 where seibetsu='M'; : 男性について run; : : proc print data=o_reg1(obs=15); : まず表示 run; : proc plot data=o_reg1; : 散布図の表示 plot taijyuu*shintyou; : 体重と身長 plot pred1*shintyou; : 予測値と観測値 plot resid1*shintyou; : 残差と観測値 run; :
SAS システム 2 23:24 Wednesday, June 25, 1997 Model: MODEL1 Dependent Variable: SHINTYOU Analysis of Variance Sum of Mean Source DF Squares Square F Value Prob>F Model 1 73.16753 73.16753 2.521 0.1255 Error 24 696.65747 29.02739 C Total 25 769.82500 Root MSE 5.38771 R-square 0.0950 Dep Mean 170.95000 Adj R-sq 0.0573 C.V. 3.15163 SAS システム 3 23:24 Wednesday, June 25, 1997 Parameter Estimates Parameter Standard T for H0: Variable DF Estimate Error Parameter=0 Prob > |T| INTERCEP 1 154.662906 10.31287967 14.997 0.0001 TAIJYUU 1 0.262956 0.16562582 1.588 0.1255 SAS システム 4 23:24 Wednesday, June 25, 1997 OBS SEIBETSU SHINTYOU TAIJYUU KYOUI PRED1 RESID1 1 M 156.0 61.0 90 170.703 -14.7032 2 M 162.0 62.0 100 170.966 -8.9662 3 M 166.0 60.0 88 170.440 -4.4403 4 M 167.0 60.0 94 170.440 -3.4403 5 M 167.0 58.0 . 169.914 -2.9144 6 M 168.0 57.0 . 169.651 -1.6514 7 M 168.0 62.0 80 170.966 -2.9662 8 M 168.0 65.0 85 171.755 -3.7551 9 M 168.0 52.0 . 168.337 -0.3366 10 M 169.0 54.0 . 168.863 0.1375 11 M 170.0 58.0 88 169.914 0.0856 12 M 170.0 60.0 . 170.440 -0.4403 13 M 170.0 65.0 . 171.755 -1.7551 14 M 170.2 61.9 . 170.940 -0.7399 15 M 172.0 58.0 . 169.914 2.0856 SAS システム 5 23:24 Wednesday, June 25, 1997 プロット : TAIJYUU*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... 80 + | A A | A | 70 + A | TAIJYUU | A A A A | A A A 60 + A A A A A A A | A A A A | A A | A A 50 + --+---------+---------+---------+---------+---------+---------+- 155 160 165 170 175 180 185 SHINTYOU NOTE: 2 オブザベーションが欠損値です. SAS システム 6 23:24 Wednesday, June 25, 1997 プロット : PRED1*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... 175.0 + A A | A | | A 172.5 + | A A A A PRED1 | A A A | A A A A A A A 170.0 + A A A | A A | A A | A 167.5 + ---+---------+---------+---------+---------+---------+---------+-- 155 160 165 170 175 180 185 SHINTYOU NOTE: 2 オブザベーションが欠損値です. SAS システム 7 23:24 Wednesday, June 25, 1997 プロット : RESID1*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... 20 + | R | e | B s | A A i | B A A d 0 + B A C AA B u | A B B A a | l | A | A | -20 + ---+---------+---------+---------+---------+---------+---------+-- 155 160 165 170 175 180 185 SHINTYOU NOTE: 2 オブザベーションが欠損値です.