/* Lesson 08-1 */ /* File Name = les0801.sas 06/05/03 */ options linesize=72 pagesize=20; data gakusei; infile 'all03a.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 13:47 Monday, June 2, 2003 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=HEIGHT Normal Probability Plot 172.5+ *+++*+ | **+**++**+ | ***********+ | ********+++ | ++******+ 147.5++*+++*++* * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 33 13:47 Monday, June 2, 2003 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=WEIGHT Normal Probability Plot 57.5+ +**+*+++*+ | ******+*+**+ 47.5+ ****+******++ | +**+*+**+++ 37.5++++*+++* +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 40 13:47 Monday, June 2, 2003 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=CHEST Normal Probability Plot 92.5+ ++++*+++++ | ********++**++++* 82.5+ * **+*+*+*++++ | ++*++*+*+++ 72.5++++++*+ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 47 13:47 Monday, June 2, 2003 -------------------------------- SEX=F --------------------------------- Univariate Procedure Variable=KODUKAI Normal Probability Plot 325000+ * | | * 175000+ ** *+++++++ | +*****++++ | +********** 25000+ * * * ****************** +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 54 13:47 Monday, June 2, 2003 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=HEIGHT Normal Probability Plot 187.5+ * * | ******+*+*++ | ********++ 172.5+ ************ | *********++ | **+***+**+ 157.5+*++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 61 13:47 Monday, June 2, 2003 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=WEIGHT Normal Probability Plot 105+ * | * | * * ++ 75+ ********+++++ | **************** | *****************+ 45+*+*+++++++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 68 13:47 Monday, June 2, 2003 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=CHEST Normal Probability Plot 115+ * * + | ***+*+++++++ | ********+*+*++ 85+ *************++ | ++*+*+**++++ |++++ 55+ * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 SAS システム 75 13:47 Monday, June 2, 2003 -------------------------------- SEX=M --------------------------------- Univariate Procedure Variable=KODUKAI Normal Probability Plot 325000+ * | | * 175000+ ***** ***++++ | ******+++++ | +++*****++ 25000+* * ************************* +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
/* Lesson 08-2 */ /* File Name = les0802.sas 06/05/03 */ data gakusei; infile 'all03a.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 13:47 Monday, June 2, 2003 TTEST PROCEDURE Variable: HEIGHT SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 74 159.30945946 5.61246580 0.65243590 M 168 172.13095238 5.35687987 0.41329225 Variances T DF Prob>|T| --------------------------------------- Unequal -16.6012 133.9 0.0001 Equal -16.9056 240.0 0.0000 For H0: Variances are equal, F' = 1.10 DF = (73,167) Prob>F' = 0.6189 SAS システム 3 13:47 Monday, June 2, 2003 TTEST PROCEDURE Variable: WEIGHT SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 50 48.40000000 4.89897949 0.69282032 M 168 62.05833333 7.68132830 0.59262734 Variances T DF Prob>|T| --------------------------------------- Unequal -14.9811 127.0 0.0001 Equal -11.8648 216.0 0.0000 For H0: Variances are equal, F' = 2.46 DF = (167,49) Prob>F' = 0.0004 SAS システム 4 13:47 Monday, June 2, 2003 TTEST PROCEDURE Variable: CHEST SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 27 83.29629630 4.42731743 0.85203764 M 59 88.64406780 8.73116241 1.13670053 Variances T DF Prob>|T| --------------------------------------- Unequal -3.7645 83.0 0.0003 Equal -3.0040 84.0 0.0035 For H0: Variances are equal, F' = 3.89 DF = (58,26) Prob>F' = 0.0003 SAS システム 5 13:47 Monday, June 2, 2003 TTEST PROCEDURE Variable: KODUKAI SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 69 53021.73913043 52627.60645932 6335.61929947 M 159 50540.88050314 52629.43563656 4173.78573870 Variances T DF Prob>|T| --------------------------------------- Unequal 0.3270 129.3 0.7442 Equal 0.3270 226.0 0.7440 For H0: Variances are equal, F' = 1.00 DF = (158,68) Prob>F' = 1.0000
/* Lesson 08-3 */ /* File Name = les0803.sas 06/05/03 */ data gakusei; infile 'all03a.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 13:47 Monday, June 2, 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 74 3305.5000 8991.0 501.393383 44.668919 M 168 26097.5000 20412.0 501.393383 155.342262 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 3 13:47 Monday, June 2, 2003 N P A R 1 W A Y P R O C E D U R E S = 3305.50 Z = -11.3384 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 128.58 DF = 1 Prob > CHISQ = 0.0001 SAS システム 4 13:47 Monday, June 2, 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 50 1606.0 5475.0 391.083363 32.120000 M 168 22265.0 18396.0 391.083363 132.529762 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 5 13:47 Monday, June 2, 2003 N P A R 1 W A Y P R O C E D U R E S = 1606.00 Z = -9.89175 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 97.872 DF = 1 Prob > CHISQ = 0.0001 SAS システム 6 13:47 Monday, June 2, 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 27 762.0 1174.50000 106.925667 28.2222222 M 59 2979.0 2566.50000 106.925667 50.4915254 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 7 13:47 Monday, June 2, 2003 N P A R 1 W A Y P R O C E D U R E S = 762.000 Z = -3.85314 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0002 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 14.883 DF = 1 Prob > CHISQ = 0.0001 SAS システム 8 13:47 Monday, June 2, 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 69 8314.0 7900.5000 455.045482 120.492754 M 159 17792.0 18205.5000 455.045482 111.899371 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 9 13:47 Monday, June 2, 2003 N P A R 1 W A Y P R O C E D U R E S = 8314.00 Z = 0.907602 Prob > |Z| = 0.3641 T-Test Approx. Significance = 0.3651 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 0.82574 DF = 1 Prob > CHISQ = 0.3635
/* Lesson 08-4 */ /* File Name = les0804.sas 06/05/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 13:47 Monday, June 2, 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 13:47 Monday, June 2, 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 13:47 Monday, June 2, 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 13:47 Monday, June 2, 2003 Univariate Procedure Variable=DIF Normal Probability Plot 0.25+ *++++* | *++*+++ | *++++ -0.05+ *+++*++ | +++++ | ++++++ -0.35+ +++++ * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
data gakusei; infile 'all03a.prn' firstobs=2; input sex $ height weight chest jitaku $ kodukai carrier $ tsuuwa; dekasa=height+weight+chest; : 変量間の加減乗除 ch_2=chest**2; : 二乗 ch_sr=sqrt(chest); : ルート taiseki=ch_2*height :
[算術演算子]
[数値関数]