/* Lesson 10-1 */ /* File Name = les1001.sas 06/21/07 */ data gakusei; infile 'all07ae.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 10:45 Thursday, June 21, 2007 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=SHINTYOU Normal Probability Plot 172.5+ +*++* | *******+*+** | **********++ | *********+ | ********+ 147.5+*++*+*+** +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 15 10:45 Thursday, June 21, 2007 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=TAIJYUU Normal Probability Plot 62.5+ *+ | *****+*+*++ | **********+* | ***********+ | *+***+****++ 37.5++*++*++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 22 10:45 Thursday, June 21, 2007 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=KYOUI Normal Probability Plot 92.5+ ++++*+++ | **********+*+*+++* 82.5+ ********+**+*++++ | ++*++**+*++++ 72.5++++*+ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 29 10:45 Thursday, June 21, 2007 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=KODUKAI Normal Probability Plot 325000+ * | | * 175000+ * ** +++ | ******+++++ | +********** 25000+* * ** ******************* +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 36 10:45 Thursday, June 21, 2007 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=SHINTYOU Normal Probability Plot 187.5+ *+* | *********++ | ********++ 172.5+ ************ | **********+ | *********+ 157.5+*++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 43 10:45 Thursday, June 21, 2007 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=TAIJYUU Normal Probability Plot 105+ * | * * | ***+++ 75+ **********+++ | *************** | *****************+ 45+*++*++++++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 50 10:45 Thursday, June 21, 2007 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=KYOUI Normal Probability Plot 115+ * +*+ | +***+*++++ | ***********+* | ************++ | *+***+++++ |+++++++ | * 45+ * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 57 10:45 Thursday, June 21, 2007 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=KODUKAI Normal Probability Plot 375000+ * | * | | * | ***** ***+++ | ******+++++ | ++******+ 25000+* *************************** +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
/* Lesson 10-2 */ /* File Name = les1002.sas 06/21/07 */ data gakusei; infile 'all07ae.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 10:45 Thursday, June 21, 2007 TTEST PROCEDURE Variable: SHINTYOU SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 117 159.09145299 5.34921155 0.49453478 M 242 172.18760331 5.39094169 0.34654286 Variances T DF Prob>|T| --------------------------------------- Unequal -21.6871 231.1 0.0001 Equal -21.6283 357.0 0.0000 For H0: Variances are equal, F' = 1.02 DF = (241,116) Prob>F' = 0.9376 SAS システム 3 10:45 Thursday, June 21, 2007 TTEST PROCEDURE Variable: TAIJYUU SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 83 48.69879518 4.72299755 0.51841633 M 242 62.23884298 7.92773766 0.50961428 Variances T DF Prob>|T| --------------------------------------- Unequal -18.6257 240.6 0.0001 Equal -14.6829 323.0 0.0000 For H0: Variances are equal, F' = 2.82 DF = (241,82) Prob>F' = 0.0000 SAS システム 4 10:45 Thursday, June 21, 2007 TTEST PROCEDURE Variable: KYOUI SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 43 83.00000000 3.90360029 0.59529346 M 71 88.09859155 9.68526853 1.14942990 Variances T DF Prob>|T| --------------------------------------- Unequal -3.9389 100.5 0.0002 Equal -3.2894 112.0 0.0013 For H0: Variances are equal, F' = 6.16 DF = (70,42) Prob>F' = 0.0000 SAS システム 5 10:45 Thursday, June 21, 2007 TTEST PROCEDURE Variable: KODUKAI SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 114 48403.50877193 44706.80677090 4187.17609027 M 232 48637.93103448 52490.92216742 3446.19787366 Variances T DF Prob>|T| --------------------------------------- Unequal -0.0432 259.7 0.9656 Equal -0.0409 344.0 0.9674 For H0: Variances are equal, F' = 1.38 DF = (231,113) Prob>F' = 0.0553
/* Lesson 10-3 */ /* File Name = les1003.sas 06/21/07 */ data gakusei; infile 'all07ae.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 10:45 Thursday, June 21, 2007 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 117 8015.5000 21060.0 921.035482 68.508547 M 242 56604.5000 43560.0 921.035482 233.902893 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 3 10:45 Thursday, June 21, 2007 N P A R 1 W A Y P R O C E D U R E S = 8015.50 Z = -14.1623 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 200.59 DF = 1 Prob > CHISQ = 0.0001 SAS システム 4 10:45 Thursday, June 21, 2007 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 83 4424.0 13529.0 738.002845 53.301205 M 242 48551.0 39446.0 738.002845 200.623967 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 5 10:45 Thursday, June 21, 2007 N P A R 1 W A Y P R O C E D U R E S = 4424.00 Z = -12.3367 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 152.21 DF = 1 Prob > CHISQ = 0.0001 SAS システム 6 10:45 Thursday, June 21, 2007 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 43 1648.50000 2472.50000 170.162136 38.3372093 M 71 4906.50000 4082.50000 170.162136 69.1056338 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 7 10:45 Thursday, June 21, 2007 N P A R 1 W A Y P R O C E D U R E S = 1648.50 Z = -4.83950 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 23.449 DF = 1 Prob > CHISQ = 0.0001 SAS システム 8 10:45 Thursday, June 21, 2007 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 114 20755.5000 19779.0 870.131155 182.065789 M 232 39275.5000 40252.0 870.131155 169.290948 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 9 10:45 Thursday, June 21, 2007 N P A R 1 W A Y P R O C E D U R E S = 20755.5 Z = 1.12167 Prob > |Z| = 0.2620 T-Test Approx. Significance = 0.2628 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 1.2594 DF = 1 Prob > CHISQ = 0.2618
/* Lesson 10-4 */ /* File Name = les1004.sas 06/21/07 */ 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 10:45 Thursday, June 21, 2007 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 10:45 Thursday, June 21, 2007 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 10:45 Thursday, June 21, 2007 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 10:45 Thursday, June 21, 2007 Univariate Procedure Variable=DIF Normal Probability Plot 0.25+ *++++* | *++*+++ | *++++ -0.05+ *+++*++ | +++++ | ++++++ -0.35+ +++++ * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2