/* Lesson 10-1 */ /* File Name = les1001.sas 06/24/04 */ data gakusei; infile 'all04a.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 19:32 Wednesday, June 16, 2004 TTEST PROCEDURE Variable: SHINTYOU SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 94 159.18936170 5.45520306 0.56266123 M 190 172.09000000 5.40135736 0.39185565 Variances T DF Prob>|T| --------------------------------------- Unequal -18.8147 183.8 0.0001 Equal -18.8782 282.0 0.0000 For H0: Variances are equal, F' = 1.02 DF = (93,189) Prob>F' = 0.8958 SAS システム 3 19:32 Wednesday, June 16, 2004 TTEST PROCEDURE Variable: TAIJYUU SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 63 48.42857143 4.64450520 0.58515265 M 190 62.13947368 7.72765047 0.56062269 Variances T DF Prob>|T| --------------------------------------- Unequal -16.9193 178.7 0.0001 Equal -13.2982 251.0 0.0000 For H0: Variances are equal, F' = 2.77 DF = (189,62) Prob>F' = 0.0000 SAS システム 4 19:32 Wednesday, June 16, 2004 TTEST PROCEDURE Variable: KYOUI SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 32 82.93750000 4.35473417 0.76981552 M 61 88.70491803 8.61460826 1.10298756 Variances T DF Prob>|T| --------------------------------------- Unequal -4.2878 90.9 0.0001 Equal -3.5503 91.0 0.0006 For H0: Variances are equal, F' = 3.91 DF = (60,31) Prob>F' = 0.0000 SAS システム 5 19:32 Wednesday, June 16, 2004 TTEST PROCEDURE Variable: KODUKAI SEX N Mean Std Dev Std Error ----------------------------------------------------------------------- F 89 50589.88764045 48581.26753872 5149.60405991 M 181 49298.34254144 51281.56965350 3811.72905338 Variances T DF Prob>|T| --------------------------------------- Unequal 0.2016 183.9 0.8405 Equal 0.1979 268.0 0.8433 For H0: Variances are equal, F' = 1.11 DF = (180,88) Prob>F' = 0.5740
/* Lesson 10-2 */ /* File Name = les1002.sas 06/24/04 */ data gakusei; infile 'all04a.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 19:32 Wednesday, June 16, 2004 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 94 5223.0 13395.0 650.846383 55.563830 M 190 35247.0 27075.0 650.846383 185.510526 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 3 19:32 Wednesday, June 16, 2004 N P A R 1 W A Y P R O C E D U R E S = 5223.00 Z = -12.5552 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 157.65 DF = 1 Prob > CHISQ = 0.0001 SAS システム 4 19:32 Wednesday, June 16, 2004 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 63 2467.5000 8001.0 502.822144 39.166667 M 190 29663.5000 24130.0 502.822144 156.123684 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 5 19:32 Wednesday, June 16, 2004 N P A R 1 W A Y P R O C E D U R E S = 2467.50 Z = -11.0039 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 121.11 DF = 1 Prob > CHISQ = 0.0001 SAS システム 6 19:32 Wednesday, June 16, 2004 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 32 961.0 1504.0 123.138679 30.0312500 M 61 3410.0 2867.0 123.138679 55.9016393 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 7 19:32 Wednesday, June 16, 2004 N P A R 1 W A Y P R O C E D U R E S = 961.000 Z = -4.40560 Prob > |Z| = 0.0001 T-Test Approx. Significance = 0.0001 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 19.445 DF = 1 Prob > CHISQ = 0.0001 SAS システム 8 19:32 Wednesday, June 16, 2004 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 89 12662.5000 12059.5000 600.013767 142.275281 M 181 23922.5000 24525.5000 600.013767 132.168508 Average Scores Were Used for Ties Wilcoxon 2-Sample Test (Normal Approximation) (with Continuity Correction of .5) SAS システム 9 19:32 Wednesday, June 16, 2004 N P A R 1 W A Y P R O C E D U R E S = 12662.5 Z = 1.00414 Prob > |Z| = 0.3153 T-Test Approx. Significance = 0.3162 Kruskal-Wallis Test (Chi-Square Approximation) CHISQ = 1.0100 DF = 1 Prob > CHISQ = 0.3149
/* Lesson 10-3 */ /* File Name = les1003.sas 06/24/04 */ 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 19:31 Wednesday, June 16, 2004 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 19:31 Wednesday, June 16, 2004 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 19:31 Wednesday, June 16, 2004 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 19:31 Wednesday, June 16, 2004 Univariate Procedure Variable=DIF Normal Probability Plot 0.25+ *++++* | *++*+++ | *++++ -0.05+ *+++*++ | +++++ | ++++++ -0.35+ +++++ * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2
/* Lesson 10-4 */ /* File Name = les1004.sas 06/24/04 */ data gakusei; infile 'all04a.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 plot data=gakusei; : 散布図を描く plot shintyou*taijyuu; : 散布図の変量を指定(縦軸、横軸の順) plot taijyuu*shintyou; : run: : proc corr data=gakusei; : 相関係数(相関行列)を計算 run: :
SAS システム 2 16:17 Friday, June 18, 2004 プロット : SHINTYOU*TAIJYUU. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 40 オブザベーションが欠損値です.) SHINTYOU | 200 + | | B A 180 + A ADCDDDBEA B B A A | AAEDKHTMGGCEDCB BA | AEAGIFEDBBBEAA AA A A 160 + ADCEBHDDAABB | A EB DCDA A A | A AAA 140 + ---+-----------+-----------+-----------+-----------+-- 20 40 60 80 100 TAIJYUU SAS システム 3 16:17 Friday, June 18, 2004 プロット : TAIJYUU*SHINTYOU. 凡例: A = 1 OBS, B = 2 OBS, ... (NOTE: 40 オブザベーションが欠損値です.) 100 + A | A A TAIJYUU | A A A A B A A | A B CBDDC DCEAD CCF B AA | A AA D B CABBF HBOHKBIFFDC BADBB A 50 + AAA CABDA CCH F EBCGF DAAAB BA | A B C BA BA | | | 0 + --+-----------+-----------+-----------+-----------+-----------+- 140 150 160 170 180 190 SHINTYOU SAS システム 4 16:17 Friday, June 18, 2004 Correlation Analysis 5 'VAR' Variables: SHINTYOU TAIJYUU KYOUI KODUKAI TSUUWA Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum SHINTYOU 284 167.8 8.1392 47660.9 145.0 186.0 TAIJYUU 253 58.7253 9.2406 14857.5 35.0000 100.0 KYOUI 93 86.7204 7.8979 8065.0 56.0000 112.0 KODUKAI 270 49724.1 50320.7 13425500 0 300000 TSUUWA 76 7279.6 5074.8 553248 200.0 30000.0 SAS システム 5 16:17 Friday, June 18, 2004 Correlation Analysis Pearson Correlation Coefficients / Prob > |R| under Ho: Rho=0 / Number of Observations SHINTYOU TAIJYUU KYOUI KODUKAI TSUUWA SHINTYOU 1.00000 0.70810 0.39574 0.04566 0.09515 0.0 0.0001 0.0001 0.4601 0.4168 284 253 93 264 75 TAIJYUU 0.70810 1.00000 0.67545 -0.00639 0.03815 0.0001 0.0 0.0001 0.9222 0.7592 253 253 93 236 67 KYOUI 0.39574 0.67545 1.00000 -0.08997 0.14602 0.0001 0.0001 0.0 0.4017 0.5760 93 93 93 89 17 KODUKAI 0.04566 -0.00639 -0.08997 1.00000 0.07144 0.4601 0.9222 0.4017 0.0 0.5481 264 236 89 270 73 TSUUWA 0.09515 0.03815 0.14602 0.07144 1.00000 0.4168 0.7592 0.5760 0.5481 0.0 75 67 17 73 76
[注意] 相関行列は細切れに表示されるので、 不要部分を削除することによって整形しレポート等に使うこと。