/* Lesson 09-1 */ /* File Name = les0901.sas 11/29/06 */ data gakusei; infile 'all06be.prn' firstobs=2; input sex $ shintyou taijyuu kyoui jitaku $ kodukai carryer $ tsuuwa; if sex^='M' & sex^='F' then delete; : 性別不明は除外する proc print data=gakusei(obs=5); run; proc sort data=gakusei; by sex; run; proc univariate data=gakusei plot; var shintyou taijyuu kyoui kodukai; by sex; run;
SAS システム 8 17:16 Tuesday, November 28, 2006 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=SHINTYOU Normal Probability Plot 172.5+ +*++* | *******+*+** | *********++ | *********+ | ********+ 147.5+*++*+*++* +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 15 17:16 Tuesday, November 28, 2006 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=TAIJYUU Normal Probability Plot 62.5+ *+ | ******++*++ | ************+ | ***********+ | ****+****++ 37.5++*++*++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 22 17:16 Tuesday, November 28, 2006 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=KYOUI Normal Probability Plot 92.5+ ++++*+++ | **********+*+*+++* 82.5+ *******+*+**+++++ | ++*++**+*++++ 72.5++++*+ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 29 17:16 Tuesday, November 28, 2006 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=KODUKAI Normal Probability Plot 325000+ * | | * 175000+ ** * +++ | *****++++++ | +********** 25000+* * * ******************** +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 36 17:16 Tuesday, November 28, 2006 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=SHINTYOU Normal Probability Plot 187.5+ +* | *******+**+ | *********+ 172.5+ ************ | *********+ | *********+ 157.5+*++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 43 17:16 Tuesday, November 28, 2006 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=TAIJYUU Normal Probability Plot 105+ * | * * | **+++ 75+ *******+**++ | *************** | *****************+ 45+*++*++++++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 50 17:16 Tuesday, November 28, 2006 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=KYOUI Normal Probability Plot 115+ * * | ***+*+++++++ | ************+*+ 85+ *************++ | ++*+*+**++++ |+++ 55+ * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 57 17:16 Tuesday, November 28, 2006 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=KODUKAI Normal Probability Plot 325000+ * | | * 175000+ **** **+*++ | ******+++++++ | ++*******+ 25000+* * ************************* +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
/* Lesson 09-2 */ /* File Name = les0902.sas 11/29/06 */ data gakusei; infile 'all06be.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 ttest data=gakusei; : t検定 class sex; : 分類したい特性変数の指定 var shintyou taijyuu kyoui kodukai; : 比較したい変量名 run; :
SAS システム 2 17:16 Tuesday, November 28, 2006 TTEST PROCEDURE Variable: SHINTYOU SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 114 159.12456140 5.38450023 0.50430465 M 238 172.16974790 5.35281076 0.34697119 Variances T DF Prob>|T| --------------------------------------- Unequal -21.3109 221.6 0.0001 Equal -21.3554 350.0 0.0000 For H0: Variances are equal, F' = 1.01 DF = (113,237) Prob>F' = 0.9266 SAS システム 3 17:16 Tuesday, November 28, 2006 TTEST PROCEDURE Variable: TAIJYUU SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 81 48.71604938 4.77774677 0.53086075 M 238 62.14201681 7.83199643 0.50767292 Variances T DF Prob>|T| --------------------------------------- Unequal -18.2781 228.7 0.0001 Equal -14.5268 317.0 0.0000 For H0: Variances are equal, F' = 2.69 DF = (237,80) Prob>F' = 0.0000 SAS システム 4 17:16 Tuesday, November 28, 2006 TTEST PROCEDURE Variable: KYOUI SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 42 82.95238095 3.93825751 0.60768633 M 70 88.70000000 8.31333833 0.99363398 Variances T DF Prob>|T| --------------------------------------- Unequal -4.9347 105.4 0.0001 Equal -4.2011 110.0 0.0001 For H0: Variances are equal, F' = 4.46 DF = (69,41) Prob>F' = 0.0000 SAS システム 5 17:16 Tuesday, November 28, 2006 TTEST PROCEDURE Variable: KODUKAI SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 111 49081.08108108 44989.87464573 4270.24992479 M 228 47385.96491228 48771.06616283 3229.94276106 Variances T DF Prob>|T| --------------------------------------- Unequal 0.3166 234.7 0.7518 Equal 0.3079 337.0 0.7584 For H0: Variances are equal, F' = 1.18 DF = (227,110) Prob>F' = 0.3410
/* Lesson 09-3 */ /* File Name = les0903.sas 11/29/06 */ data gakusei; infile 'all06be.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 npar1way data=gakusei wilcoxon; : wilcoxon 検定 class sex; : 分類したい特性変数の指定 var shintyou taijyuu kyoui kodukai; : 比較したい変量名 run; :
SAS システム 2 17:16 Tuesday, November 28, 2006 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 SEX Sum of Expected Std Dev Mean SEX N Scores Under H0 Under H0 Score F 114 7643.0 20121.0 892.777760 67.043860 M 238 54485.0 42007.0 892.777760 228.928571 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 3 17:16 Tuesday, November 28, 2006 N P A R 1 W A Y P R O C E D U R E S = 7643.00 Z = -13.9760 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 195.35 DF = 1 Prob > CHISQ = 0.0001 SAS システム 4 17:16 Tuesday, November 28, 2006 N P A R 1 W A Y P R O C E D U R E Wilcoxon Scores (Rank Sums) for Variable TAIJYUU Classified by Variable SEX Sum of Expected Std Dev Mean SEX N Scores Under H0 Under H0 Score F 81 4247.0 12960.0 716.287812 52.432099 M 238 46793.0 38080.0 716.287812 196.609244 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 5 17:16 Tuesday, November 28, 2006 N P A R 1 W A Y P R O C E D U R E S = 4247.00 Z = -12.1634 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 147.97 DF = 1 Prob > CHISQ = 0.0001 SAS システム 6 17:16 Tuesday, November 28, 2006 N P A R 1 W A Y P R O C E D U R E Wilcoxon Scores (Rank Sums) for Variable KYOUI Classified by Variable SEX Sum of Expected Std Dev Mean SEX N Scores Under H0 Under H0 Score F 42 1544.0 2373.0 165.545627 36.7619048 M 70 4784.0 3955.0 165.545627 68.3428571 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 7 17:16 Tuesday, November 28, 2006 N P A R 1 W A Y P R O C E D U R E S = 1544.00 Z = -5.00466 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 25.077 DF = 1 Prob > CHISQ = 0.0001 SAS システム 8 17:16 Tuesday, November 28, 2006 N P A R 1 W A Y P R O C E D U R E Wilcoxon Scores (Rank Sums) for Variable KODUKAI Classified by Variable SEX Sum of Expected Std Dev Mean SEX N Scores Under H0 Under H0 Score F 111 19982.5000 18870.0 842.637279 180.022523 M 228 37647.5000 38760.0 842.637279 165.120614 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 9 17:16 Tuesday, November 28, 2006 N P A R 1 W A Y P R O C E D U R E S = 19982.5 Z = 1.31967 Prob > |Z| = 0.1869 T-Test Approx. Significance = 0.1878 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 1.7431 DF = 1 Prob > CHISQ = 0.1867
/* Lesson 09-4 */ /* File Name = les0904.sas 11/29/06 */ data pair; : input x y @@; : @@ は 1行に複数のデータがあることを示す dif=x-y; : 差(difference)を計算する cards; : データをプログラム内に記述する 3.51 3.39 3.07 3.39 3.29 3.20 3.03 3.11 : x1,y1, x2,y2, x3,y3, x4,y4, 3.38 3.17 3.30 3.09 3.15 3.17 3.25 3.09 : x5,y5, x6,y6, x7,y7, x8,y8 ; : : proc print data=pair; : run; : proc univariate data=pair plot; : var dif; : 差について run; :
SAS システム 1 17:16 Tuesday, November 28, 2006 OBS X Y DIF 1 3.51 3.39 0.12 2 3.07 3.39 -0.32 3 3.29 3.20 0.09 4 3.03 3.11 -0.08 5 3.38 3.17 0.21 6 3.30 3.09 0.21 7 3.15 3.17 -0.02 8 3.25 3.09 0.16 SAS システム 2 17:16 Tuesday, November 28, 2006 Univariate Procedure Variable=DIF Moments N 8 Sum Wgts 8 Mean 0.04625 Sum 0.37 Std Dev 0.180629 Variance 0.032627 Skewness -1.31523 Kurtosis 1.511099 USS 0.2455 CSS 0.228388 CV 390.5489 Std Mean 0.063862 T:Mean=0 0.724218 Pr>|T| 0.4924 Num ^= 0 8 Num > 0 5 M(Sign) 1 Pr>=|M| 0.7266 Sgn Rank 7 Pr>=|S| 0.3594 SAS システム 5 17:16 Tuesday, November 28, 2006 Univariate Procedure Variable=DIF Stem Leaf # Boxplot 2 11 2 | 1 26 2 +-----+ 0 9 1 | + | -0 82 2 +-----+ -1 | -2 | -3 2 1 | ----+----+----+----+ Multiply Stem.Leaf by 10**-1 SAS システム 6 17:16 Tuesday, November 28, 2006 Univariate Procedure Variable=DIF Normal Probability Plot 0.25+ *++++* | *++*+++ | *++++ -0.05+ *+++*++ | +++++ | ++++++ -0.35+ +++++ * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2