平均數檢定 dataset: bank.sav 平均年齡 = 40? 1
平均數檢定 2
平均數 T 檢定 --- (1) One-Sample T-test Statistics Compare Means One-Sample T-test Example 1: dataset: bank.sav Q: 平均年齡 = 40? 3
Example 1 的平均數 T 檢定 40 40 474 T S 37.18-40 11.78 474-5.197 P- 值 =0.00 拒絕平均年齡不是 40,, 應是 < 40 4
Confidence Interval Estimate of Sample Mean 1. Assumptions Population Standard Deviation Is Unknown Population Must Be Normally Distributed 2. Use Student t Distribution 3. Confidence Interval Estimate 37.18-3.877 < 37.18-1.75 33.303 35.37 結論 : 檢定值 40 不在此 95% 信賴區間, 所以拒絕 5
P-Value Test 利用 P-value 作決策 P-value = 2*P(T>5.197) = 0.00 (approx.) if if P P value α, reject H value > α, not reject t 0 H 0 6
Confidence Interval Estimate of Sample Mean 1. Assumptions Population Standard Deviation Is Unknown Population Must Be Normally Distributed 2. Use Student t Distribution 3. Confidence Interval Estimate 37.18-3.877 < 37.18-1.75 33.303 35.37 結論 : 檢定值 40 不在此 95% 信賴區間, 所以拒絕 7
Describing the p-value 8
(2) Independent-Sample T-test ( 平均數 T 檢定 ) Statistics Compare Means Independent-Sample T-test Example 2: dataset: bank.sav Q: 男女平均年齡相等? 9
平均數 T 檢定 (2) Independent-Sample T- test Statistics Compare Means Independent-Sample T-test dataset: bank.sav 男女平均年齡相等? Group Statistics 年齡 性別女 男 Std. Std. Error N Mean Deviation Mean 216 37.8541 13.6789.9307 258 36.6269 9.9243.6179 Independent Samples Test 年齡 Equal variances assumed Equal variances not assumed Levene's Test for Equality of Variances F Sig. t df Sig. (2-tailed) t-test for Equality of Means Mean Difference 95% Confidence Interval of the Std. Error Difference Difference Lower Upper 81.882.000 1.129 472.259 1.2271 1.0868 -.9084 3.3626 1.098 383.882.273 1.2271 1.1171 -.9693 3.4236 10
(2) Independent-Sample T-test -- spss output 分析 先看每個群體的變異數是否相等 --- F- 檢定 (1) 如果 P-value ( 在 SPSS 則為 Sig.) < 0.05, 表示兩個群體的變異數不相等, 此時, 看 Equalvariance not assumed 的所屬列之 t 值檢定, 如果 P-value (Sig.) < 0.05, 則拒絕, 表示男女平均年齡不相等 (2) 如果 P-value ( 在 SPSS 則為 Sig.) >= 0.05, 表示兩個群體的變異數相等, 此時, 看 Equalvariance assumed 的所屬列之 t 值檢定, 如果 P-value (Sig.) < 0.05, 則拒絕, 表示男女平均年齡不相等 11
F- 檢定的 P-value ( 在 SPSS 則為 Sig.) < 0.05, 表示兩個群體的變異數不相等, 此時, 看 Equal variance not assumed 的所屬列之 t 值檢定 Independent Samples Test 年齡 Equal variances assumed Equal variances not assumed Levene's Test for Equality of Variances F Sig. t df Sig. (2-tailed) t-test for Equality of Means Mean Difference 95% Confidence Interval of the Std. Error Difference Difference Lower Upper 81.882.000 1.129 472.259 1.2271 1.0868 -.9084 3.3626 1.098 383.882.273 1.2271 1.1171 -.9693 3.4236 Group Statistics P-value (Sig.) =0.273 > 0.05, 則不拒絕, 表示男女平均年齡相等 年齡 性別男 女 Std. Std. Error N Mean Deviation Mean 258 36.6269 9.9243.6179 216 37.8541 13.6789.9307 12
(3) Paired-Sample T-test ( 成對樣本 T 檢定 ) Statistics Compare Means paired-sample T-test Example 3: dataset: 用藥比較.sav Q: 服用 t3 前後的血糖反應是否相等? 13
H H 0 1 (3) Paired-Sample T-test -- spss output 分析 : 用藥前後, 血糖反應相同 : 用藥前後, 血糖反應不同 結論 : P-value (Sig.) =0.00 < 0.05, 則拒絕, 表示服用 t3 前與服用 t3 後, 血糖反應有差別有差別;表示 t3 的藥物可以降低血糖 P-value 14
(4) One-Way ANOVA ( 單因子變異數分析 ) Statistics Compare Means One-Way ANOVA Example 4: dataset: bank.sav Q: 各個職別的平均教育程度是否相同? 15
H H 0 1 (4) One-Way ANOVA -- spss output 分析 : 各個職別, 教育程度相同 : 各個職別, 教育程度不同 ANOVA P-value=P(F>55.504)=0.00 教育程度 Between Groups Within Groups Total Sum of Mean Squares df Square F Sig. P-value 1638.614 6 273.102 55.504.000 2297.852 467 4.920 3936.466 473 Mean Plot Mean of 教育程度 20 18 16 14 12 10 8 職員 見習生 保全 員 全職 員學校實習 技術 員 MBA 實習 結論 : P-value (Sig.) =0.00 < 0.05, 則拒絕, 表示各個各個職別的平均教育程度不相同 職別 16
One-Way ANOVA F Test Purpose 1. Tests the Equality of 2 or More (C) Population Means 2. Variable (1)One Nominal Scaled Independent Variable(2 or More Treatment Levels or Classifications) (2)One Interval or Ratio Scaled Dependent Variable 3. Used to Analyze Completely Randomized Experimental Designs Assumption 1. Randomness & Independence of Errors Independent Random Samples are Drawn 2. Normality Populations are Normally Distributed 3. Homogeneity of Variance Populations have Equal Variances 4. The F test is sensitive to violations of these assumptions -- is not a robust test. 17
One-Way ANOVA F Test Hypothesis 18
ANOVA Table One-Way ANOVA Summary Table 19
雙因子變異數分析 ㆒般常見的資料因子個數, 除了單㆒因子外 ; 若考慮兩個因子的影響, 所作出來的變異數分析, 稱為雙因子變異數分析 20
可以用來使用 變異數分析 的統計資料, 通常是經過了預先安排的 實驗設計 ( 針對某㆒項因子或㆓項因子, 在各個母體 進行㆒段實驗時間後, 所得到的觀察資料 ( 稱為因變數 ) 21
例如 : 製藥廠的實驗藥品 濃度, 是屬於 單因子 大學畢業生的 性別 與 學院別 是屬於 雙因子 22
Two-Way ANOVA Purpose 1. Tests the equality of 2 or more population means for several independent variables 2. Same results as separate One- Way ANOVA on each variable -- when interaction not present 3. Hypotheses - Differences among: (1) Treatment means, (2) Blocking means (3) Interaction effect between (1) & (2) Assumption 1. Normality Populations are normally distributed 2. Homogeneity of Variance Populations have equal variances 3. Independence of Errors Independent random samples are drawn 23
雙因子變異數分析 重覆試驗 (1)A 因子對於因變數有無影響 (2)B 因子對於因變數有無影響 (3)A B 因子的重覆試驗, 對於變因數有無交互影響 H 0 : 無影響 H: 1 有影響 if if P P value value α, reject H 0 > α, not reject H 0 24
Interaction and its Graph 1. Occurs when effects of one factor vary according to levels of other factor 2. When significant, interpretation of main effects (A & B) is complicated 3. Can be detected In data table, pattern of cell means in one row differs from pattern in another row In graph of cell means, lines cross 25
Randomized Block F Test ANOVA Table Summary Table Variance partitioning where n=r*c*m 26
Example 5: dataset: bank.sav Q: 職別與性別對於目前薪資有無影響? 職別 * 性別 Crosstabulation Count 職別 Total 職員 見習生 保全 員 學校實習 全職 員 MBA 實習技術 員 性別 男 女 Total 110 117 227 47 89 136 27 27 34 7 41 30 2 32 4 1 5 6 6 258 216 474 27
SPSS process Statistics => General Linear Model => GLM General Factorial 28
SPSS Output Tests of Between-Subjects Effects P-value Dependent Variable: 目前薪資 Source 職別 性別 職別 * 性別 Hypothesis Error Hypothesis Error Hypothesis Error a..869 MS( 職別 * 性別 ) +.131 MS(Error) Type III Sum of Mean Squares df Square F Sig. 4.22E+10 6 7.03E+09 35.781.001 8.76E+08 4.460 1.96E+08 a 1.52E+09 1 1.52E+09 14.436.001 2.74E+09 25.992 1.05E+08 b 8.56E+08 4 2.14E+08 2.685.031 3.68E+10 462 79668647 c b..191 MS( 職別 * 性別 ) +.809 MS(Error) c. MS(Error) Sum=6+1+4+462=473 N=474 474-1 29
結論 (1) 不同職別對於目前薪資, 是否有影響? F=35.785, P- 值= 0.001 < 0.05, 職別對於目前薪資有影響 (2) 不同性別對於目前薪資, 是否有影響? F=14.436, P- 值= 0.001< 0.05, 性別對於目前薪資有影響 (3) 職別與性別對於目前薪資, 是否有交互影響的作用? F=2.685, P- 值= 0.031 < 0.05, 職別與性別對於目前薪資有交互影響作用 30