t-tes and one-way ANOVA..gif

<aside> 💡 兩組,使用t檢定(t-test)。 三組與三組以上,使用「變異數分析」(ANOVA: ANalysis Of VAriance)

</aside>

  1. 主管性別、員工性別的四種組合,是否互為獨立? 編碼:女1、男2 卡方獨立性檢定
. tab  gender_e gender_s, chi2

  Employee |
    Gender |   Supervisor Gender
 (Employee |  (Supervisor Rated,
    Rated, |        Time 1)
   Time 1) |       1.0        2.0 |     Total
-----------+----------------------+----------
         1 |        36         43 |        79 
         2 |        15         68 |        83 
-----------+----------------------+----------
     Total |        51        111 |       162 

          Pearson chi2(1) =  14.1876   Pr = 0.000

* 性別組合並非隨機。意即主管性別、員工性別兩者的組合,並不獨立。
* Contingency Table 由「列聯表」中可見:同性組合較高。(1/1和2/2)
. 
. tab  gender_e gender_s, chi2 column

+-------------------+
| Key               |
|-------------------|
|     frequency     |
| column percentage |
+-------------------+

  Employee |
    Gender |   Supervisor Gender
 (Employee |  (Supervisor Rated,
    Rated, |        Time 1)
   Time 1) |       1.0        2.0 |     Total
-----------+----------------------+----------
         1 |        36         43 |        79 
           |     70.59      38.74 |     48.77 
-----------+----------------------+----------
         2 |        15         68 |        83 
           |     29.41      61.26 |     51.23 
-----------+----------------------+----------
     Total |        51        111 |       162 
           |    100.00     100.00 |    100.00 

          Pearson chi2(1) =  14.1876   Pr = 0.000

. chi2 卡方值=14.19, p<-.01

截圖 2022-10-29 下午1.00.24.png

Study_2a.dta

以下使用Study_2a資料 Study 2a以實驗法進行研究 研究參與者扮演員工,閱讀上司給該員工的電子郵件。 研究設計中,透過郵件的內容,操弄了上司UPB(在組織中不道德行為)的程度的高低。 該研究者自評其在某工作決策上的UPB分數。 變數名 upb_manipulation

組間差異

兩組,使用t檢定(t-test)。
三組與三組以上,使用「變異數分析」(ANOVA: ANalysis Of VAriance)

兩組,使用t檢定(t-test)。 三組與三組以上,使用「變異數分析」(ANOVA: ANalysis Of VAriance)

兩組之間「平均數」的差異

  1. 主管UPB程度的高低,是否會對員工的UPB產生影響? 高低兩組:採取獨立樣本t檢定 檢驗高分組與低分組的員工UPB平均數(變數名 eUPB_tot),有無差異 H0: 高低兩組的平均數相同。 H1: 高低兩組的平均數不一樣。

<aside> 💡 研究假說一 主管的UPB,對員工UPB有影響。 Hypothesis 1: Supervisor UPB is positively related to employee UPB.

</aside>

截圖 2022-10-29 下午9.01.08.png

* 檢視資料內容摘要、敘述統計值
. summ upb_manipulation dc_manipulation eUPB1 eUPB2 eUPB3 eUPB_tot

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
upb_manipu~n |        297    .4882155    .5007048          0          1
dc_manipul~n |        297    .5050505    .5008183          0          1
       eUPB1 |        297    2.787879    1.908052          1          7
       eUPB2 |        297    2.673401    1.914842          1          7
       eUPB3 |        297    2.690236    2.009691          1          7
-------------+---------------------------------------------------------
    eUPB_tot |        297    2.717172    1.871649          1          7
.  tabulate upb_manipulation  
* 高低兩組樣本數(49:51)

Manipulatio |
   n of UPB |      Freq.     Percent        Cum.
------------+-----------------------------------
    Low UPB |        152       51.18       51.18
   High UPB |        145       48.82      100.00
------------+-----------------------------------
      Total |        297      100.00

截圖 2022-10-29 下午1.50.29.png

* 依據 by (主管的UPB程度高低) 檢測對於 員工UPB 的影響大小
* 高低兩組,使用t檢定。(三組與三組以上,使用「變異數分析ANOVA」)

**. ttest eUPB_tot, by(upb_manipulation)**

**Two-sample t test with** equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. err.   Std. dev.   [95% conf. interval]
---------+--------------------------------------------------------------------
 Low UPB |     152    2.208333     .124067    1.529601    1.963202    2.453465
High UPB |     145    3.250575    .1699401     2.04635    2.914675    3.586474
---------+--------------------------------------------------------------------
Combined |     297    2.717172    .1086041    1.871649    2.503438    2.930906
---------+--------------------------------------------------------------------
    diff |           -1.042241    .2090057               -1.453573   -.6309102
------------------------------------------------------------------------------
    diff = mean(Low UPB) - mean(High UPB)                         **t =  -4.9867**
H0: diff = 0                                     **Degrees of freedom =      295**

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 1.0000

結果顯示:

  1. 主管UPB高分組的員工UPB (Mean=3.25, SD=2.05)
  2. 主管UPB低分組的員工UPB (Mean=2.21, SD=1.53)
  3. 由此可見,t檢定分析結果顯示出:高分組 高於 低分組
  4. 換言之,兩組員工自評UPB具有顯著差異 (t(295)=-4.99, p<0.05)
  5. 意即,主管UPB高分組的員工UPB(Mean=3.25, SD=2.05)高於主管UPB低分組的員工UPB (Mean=2.21, SD=1.53)

三組樣本:變異數分析ANOVA