/* Lesson 07-1 */ /* File Name = les0701.sas 11/20/03 */ data gakusei; infile 'all03b.prn' firstobs=2; input sex $ height weight chest jitaku $ kodukai carrier $ tsuuwa; proc print data=gakusei(obs=10); run; proc sort data=gakusei; by sex; run; proc univariate data=gakusei plot; var height weight chest kodukai; by sex; run;
SAS システム 26 21:59 Wednesday, November 19, 2003 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=HEIGHT Normal Probability Plot 172.5+ +*++*+ | ***+**+**+ | ***********+ | ********++ | +*******+ 147.5++*++*+++** +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 33 21:59 Wednesday, November 19, 2003 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=WEIGHT Normal Probability Plot 57.5+ +*+*+*+++*+ | *******+*+*+* 47.5+ **********+++ | +*+**+**+++ 37.5+++*+++* +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 40 21:59 Wednesday, November 19, 2003 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=CHEST Normal Probability Plot 92.5+ ++++*+++++ | ********++**++++* 82.5+ * **+**+*+*++++ | ++*++*+*+++ 72.5++++++*+ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 47 21:59 Wednesday, November 19, 2003 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=KODUKAI Normal Probability Plot 325000+ * | | * 175000+ * **+++++++ | +*****++++ | +********* 25000+ * * ** ***************** +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 54 21:59 Wednesday, November 19, 2003 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=HEIGHT Normal Probability Plot 187.5+ ** | ******+*+*++ | ********++ 172.5+ ************ | **********+ | * *+***+**+ 157.5+*++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 61 21:59 Wednesday, November 19, 2003 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=WEIGHT Normal Probability Plot 105+ * | * | * * ++ 75+ ********+++++ | **************** | *****************+ 45+**++++++++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 68 21:59 Wednesday, November 19, 2003 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=CHEST Normal Probability Plot 115+ * * + | ***+*+++++++ | ********+*+*++ 85+ *************++ | ++*+*+**++++ |++++ 55+ * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 75 21:59 Wednesday, November 19, 2003 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=KODUKAI Normal Probability Plot 325000+ * | | * 175000+ ***** ***++++ | ******+++++ | +++*****++ 25000+* * ************************* +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
/* Lesson 07-2 */ /* File Name = les0702.sas 11/20/03 */ data gakusei; infile 'all03b.prn' firstobs=2; input sex $ height weight chest jitaku $ kodukai carrier $ tsuuwa; proc print data=gakusei(obs=10); run; proc ttest data=gakusei; : t検定 class sex; : 分類したい特性変数の指定 var height weight chest kodukai; : 比較したい変量名 run; :
SAS システム 2 21:59 Wednesday, November 19, 2003 TTEST PROCEDURE Variable: HEIGHT SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 81 159.19629630 5.55928153 0.61769795 M 173 172.16184971 5.31157589 0.40383164 Variances T DF Prob>|T| --------------------------------------- Unequal -17.5687 150.2 0.0001 Equal -17.8622 252.0 0.0000 For H0: Variances are equal, F' = 1.10 DF = (80,172) Prob>F' = 0.6162 SAS システム 3 21:59 Wednesday, November 19, 2003 TTEST PROCEDURE Variable: WEIGHT SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 55 48.54545455 4.69364496 0.63289096 M 173 62.03352601 7.63858228 0.58075066 Variances T DF Prob>|T| --------------------------------------- Unequal -15.7027 149.9 0.0001 Equal -12.3634 226.0 0.0000 For H0: Variances are equal, F' = 2.65 DF = (172,54) Prob>F' = 0.0000 SAS システム 4 21:59 Wednesday, November 19, 2003 TTEST PROCEDURE Variable: CHEST SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 28 83.25000000 4.35145782 0.82234823 M 59 88.64406780 8.73116241 1.13670053 Variances T DF Prob>|T| --------------------------------------- Unequal -3.8447 84.7 0.0002 Equal -3.0855 85.0 0.0027 For H0: Variances are equal, F' = 4.03 DF = (58,27) Prob>F' = 0.0001 SAS システム 5 21:59 Wednesday, November 19, 2003 TTEST PROCEDURE Variable: KODUKAI SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 75 53846.66666667 51734.44232349 5973.77884037 M 164 50402.43902439 52429.17741412 4094.03093474 Variances T DF Prob>|T| --------------------------------------- Unequal 0.4756 145.3 0.6351 Equal 0.4732 237.0 0.6365 For H0: Variances are equal, F' = 1.03 DF = (163,74) Prob>F' = 0.9130
/* Lesson 07-3 */ /* File Name = les0703.sas 11/20/03 */ data gakusei; infile 'all03b.prn' firstobs=2; input sex $ height weight chest jitaku $ kodukai carrier $ tsuuwa; proc print data=gakusei(obs=10); run; proc npar1way data=gakusei wilcoxon; : wilcoxon 検定 class sex; : 分類したい特性変数の指定 var height weight chest kodukai; : 比較したい変量名 run; :
SAS システム 2 21:59 Wednesday, November 19, 2003 N P A R 1 W A Y P R O C E D U R E Wilcoxon Scores (Rank Sums) for Variable HEIGHT Classified by Variable SEX Sum of Expected Std Dev Mean SEX N Scores Under H0 Under H0 Score F 81 3880.0 10327.5000 545.310227 47.901235 M 173 28505.0 22057.5000 545.310227 164.768786 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 3 21:59 Wednesday, November 19, 2003 N P A R 1 W A Y P R O C E D U R E S = 3880.00 Z = -11.8226 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 139.80 DF = 1 Prob > CHISQ = 0.0001 SAS システム 4 21:59 Wednesday, November 19, 2003 N P A R 1 W A Y P R O C E D U R E Wilcoxon Scores (Rank Sums) for Variable WEIGHT Classified by Variable SEX Sum of Expected Std Dev Mean SEX N Scores Under H0 Under H0 Score F 55 1899.0 6297.5000 425.639144 34.527273 M 173 24207.0 19808.5000 425.639144 139.924855 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 5 21:59 Wednesday, November 19, 2003 N P A R 1 W A Y P R O C E D U R E S = 1899.00 Z = -10.3327 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 106.79 DF = 1 Prob > CHISQ = 0.0001 SAS システム 6 21:59 Wednesday, November 19, 2003 N P A R 1 W A Y P R O C E D U R E Wilcoxon Scores (Rank Sums) for Variable CHEST Classified by Variable SEX Sum of Expected Std Dev Mean SEX N Scores Under H0 Under H0 Score F 28 800.0 1232.0 109.525696 28.5714286 M 59 3028.0 2596.0 109.525696 51.3220339 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 7 21:59 Wednesday, November 19, 2003 N P A R 1 W A Y P R O C E D U R E S = 800.000 Z = -3.93971 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0002 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 15.557 DF = 1 Prob > CHISQ = 0.0001 SAS システム 8 21:59 Wednesday, November 19, 2003 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 75 9553.5000 9000.0 493.189786 127.380000 M 164 19126.5000 19680.0 493.189786 116.625000 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 9 21:59 Wednesday, November 19, 2003 N P A R 1 W A Y P R O C E D U R E S = 9553.50 Z = 1.12127 Prob > |Z| = 0.2622 T-Test Approx. Significance = 0.2633 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 1.2595 DF = 1 Prob > CHISQ = 0.2617
/* Lesson 07-4 */ /* File Name = les0704.sas 11/20/03 */ 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 21:59 Wednesday, November 19, 2003 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 21:59 Wednesday, November 19, 2003 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 21:59 Wednesday, November 19, 2003 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 21:59 Wednesday, November 19, 2003 Univariate Procedure Variable=DIF Normal Probability Plot 0.25+ *++++* | *++*+++ | *++++ -0.05+ *+++*++ | +++++ | ++++++ -0.35+ +++++ * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
options linesize=72 pagesize=20;
sas les9999.sas