跳至主要内容

Compare and Contrast

實驗中我們會用 AONVA 表來檢定因素對結果是否是有影響的,這是 Compare。而 Contrast 則是更進一步分析,不同因素之間的主要差異在哪裡。

假設我們有 4 個因素 A,B,C,DA,B,C,D,我們在獲得數據之前可能有下面幾個問題:

  1. Is AA different from CC ?     H0:μA=μC\implies H_0:\mu_A=\mu_C v.s. H1:μAμCH_1:\mu_A\neq\mu_C

  2. Average of AA and BB =?\overset{?}{=} Average of CC and DD ?

        H0:12(μA+μB)=12(μC+μD)\implies H_0:\frac{1}{2}(\mu_A+\mu_B)=\frac{1}{2}(\mu_C+\mu_D) v.s. H1:12(μA+μB)12(μC+μD)H_1:\frac{1}{2}(\mu_A+\mu_B)\neq\frac{1}{2}(\mu_C+\mu_D)

  3. A=?A\overset{?}{=} average of B,C,DB,C,D ?     H0:μA=13(μB+μC+μD)\implies H_0:\mu_A=\frac{1}{3}(\mu_B+\mu_C+\mu_D) v.s. H1:μA13(μB+μC+μD)H_1:\mu_A\neq\frac{1}{3}(\mu_B+\mu_C+\mu_D)

以上這三個問題可以分別寫成和為 0 的線性方程組:

ContrastμA\mu_AμB\mu_BμC\mu_CμD\mu_D
C1C_110-10=0
C2C_211-1-1=0
C3C_33-1-1-1=0
Definition

k=k= number of trt. A contrast of trt totals:

Cm=i=1kCimYiwith m=1kCimni=0C_{m}=\sum_{i=1}^k C_{im}Y_{i\cdot}\quad\text{with }\sum_{m=1}^k C_{im}n_i=0

i=1,ki=1\cdots,k, j=1,,nij=1,\cdots,n_i

Yij=μi+εijwith εijiidN(0,σε2)    Yi=j=1niYijN(niμi,niσε2)\begin{align*} &Y_{ij}=\mu_i+\varepsilon_{ij}\quad\text{with }\varepsilon_{ij}\overset{iid}{\sim}N(0,\sigma_\varepsilon^2)\\ \implies& Y_{i\cdot}=\sum_{j=1}^{n_i}Y_{ij}\sim N(n_i\mu_i,n_i\sigma_\varepsilon^2) \end{align*}     Cm=i=1kCimYiN(i=1kCimniμi,i=1kCim2niσε2)    CmE(Cm)Cim2niσε2N(0,1)with E(Cm)=i=1kCimniμi\begin{align*} \implies &C_m=\sum_{i=1}^k C_{im}Y_{i\cdot}\sim N\left(\sum_{i=1}^k C_{im}n_i\mu_i,\sum_{i=1}^k C_{im}^2n_i\sigma_\varepsilon^2\right)\\ \implies &\frac{C_m-E(C_m)}{\sqrt{\sum C_{im}^2n_i\sigma_\varepsilon^2}}\sim N(0,1)\quad\text{with }E(C_m)=\sum_{i=1}^k C_{im}n_i\mu_i \end{align*}     CmE(Cm)Cim2niMSEtNk    Cm2Cim2niMSEF1,Nk\implies\frac{C_m-E(C_m)}{\sqrt{\sum C_{im}^2n_iMS_E}}\sim t_{N-k}\implies \frac{C_m^2}{\sum C_{im}^2n_iMS_E}\sim F_{1,N-k}
Definition
SScm=Cm2Cim2niMSEH0F1,Nkwith df=1SS_{cm}=\frac{C_m^2}{\sum C_{im}^2n_iMS_E}\overset{H_0}{\sim} F_{1,N-k}\quad\text{with }df=1

    MScm=SScm\implies MS_{cm}=SS_{cm}

Note: balance case, ni=n,in_i=n,\forall i

Cimni=0    Cim=0\sum C_{im}n_i=0\iff \sum C_{im}=0

E(Cm)=Cimniμi=0    Cimμi=0E(C_m)=\sum C_{im}n_i\mu_i=0\iff\sum C_{im}\mu_i=0

EX: 繼續使用上一章 fabric 的數據

ContrastμA\mu_AμB\mu_BμC\mu_CμD\mu_DCmC_mSScmSS_{cm}
1100-18.76-9.26=-0.5(0.5)24(12+12)=0.0312\frac{(-0.5)^2}{4(1^2+1^2)}=0.0312
201-101.050.1378
31-1-110.3511

注意到,以上三個 Contrast 的係數如果作為向量,那麼是兩兩垂直的。同時 SSc1+SSc2+SSc3=0.5201=SStrtSS_{c1}+SS_{c2}+SS_{c3}=0.5201=SS_{trt} 且自由度為 3。

Definition

Two contrasts:

  • Cm=ikCimYiC_m=\sum_i^kC_{im}Y_{i\cdot} with ikCimni=0\sum_i^kC_{im}n_i=0
  • Cq=ikCiqYiC_q=\sum_i^kC_{iq}Y_{i\cdot} with ikCiqni=0\sum_i^kC_{iq}n_i=0

are orthogonal     ikCimCiq=0\iff\sum_i^kC_{im}C_{iq}=0

Since Cm,CqC_m, C_q are normal r.v.

CmCq    Cov(Cm,Cq)=0=Cov(CimYi,CiqYi)=CimCiqniσε2    CimCiqni=0\begin{align*} C_m\perp C_q&\iff Cov(C_m,C_q)=0=Cov(\sum C_{im}Y_{i\cdot},\sum C_{iq}Y_{i\cdot})=\sum C_{im}C_{iq}n_i\sigma_\varepsilon^2\\ &\iff \sum C_{im}C_{iq}n_i=0 \end{align*}

Remark: with df=k1df=k-1, SStrt=m=1dfSScmSS_{trt}=\sum_{m=1}^{df}SS_{cm}, with CmC_m are orthogonal and each SScmSS_{cm} has df=1df=1

    \implies ANOVA table:

dfSSMSFp-value
trt30.52010.17348.530.0026
C1C_110.03120.03121.530.238
C2C_210.13780.13786.770.023
C3C_310.35110.351117.270.001
Error120.24380.0203
  • A,B,C,DA,B,C,D 的平均值是顯著不同的
  • B(A&D)B(A\&D) 的平均值與 C(B&C)C(B\&C) 的平均值是顯著不同的
注意

要檢定的 contrasts 應該要在觀測數據之前就設定好。

“先收集數據,再從數據中找出有意義的 contrasts” 被成為數據嗅探( data snooping )。這會導致檢定的實際顯著水准比預期高,因為這種行為會更關注在數據看上去顯著的部分。

Multiple Comparisons Procedure

CmC_m 寫成與平均相關的形式:

Cm=i=1kCimYi=i=1kCimniYˉi=dimYˉi,with dim=Cimni=0E(Cm)=Cimniμi=dimμi=0\begin{gather*} C_m=\sum_{i=1}^kC_{im}Y_{i\cdot}=\sum_{i=1}^kC_{im}n_i\bar{Y}_i=\sum d_{im}\bar{Y}_i,\quad\text{with }\sum d_{im}=\sum C_{im}n_i=0\\ E(C_m)=\sum C_{im}n_i\mu_i=\sum d_{im}\mu_i=0 \end{gather*}     H0:ΓmE(Cm)=0    dimμi=0, with dim=0\implies H_0: \Gamma_m\triangleq E(C_m)=0\iff\sum d_{im}\mu_i=0, \text{ with } \sum d_{im}=0 CmN(Γm,Cim2niσε2)    CmΓmCim2niMSEtNkC_m\sim N\left(\Gamma_m,\sum C_{im}^2n_i\sigma_\varepsilon^2\right)\implies \frac{C_m-\Gamma_m}{\sqrt{\sum C_{im}^2n_iMS_E}}\sim t_{N-k}     H0:Γm=0 v.s. H1:Γm0\implies H_0: \Gamma_m=0\text{ v.s. }H_1: \Gamma_m\neq 0

reject H0H_0 at level α    01α\alpha\iff0\notin 1-\alpha confidence interval for Γm\Gamma_m

1α=P(CmΓmdim2niMSE>tα/2,Nk)=P(Γm[Cm±tNk,α/2Cim2niMSE]CI(Γm;α))\begin{align*} 1-\alpha&=P\left(\left|\frac{C_m-\Gamma_m}{\sqrt{\sum d_{im}^2n_iMS_E}}\right|>t_{\alpha/2,N-k}\right)\\ &=P\left(\Gamma_m\in \underbrace{\left[C_m\pm t_{N-k,\alpha/2}\sqrt{\sum C_{im}^2n_iMS_E}\right]}_{CI(\Gamma_m;\alpha)}\right) \end{align*}

Γm\forall \Gamma_m 以上的 CI 都是 1α1-\alpha 的信心區間,但 P(ΓmCI(Γm;α),Γm)1αP(\Gamma_m\in CI(\Gamma_m;\alpha), \forall\Gamma_m)\le 1-\alpha 。因此我們希望有一個特殊的 CICI^* 來保證可以得到一個 1α1-\alpha 的信心區間。

Scheffe 's Method

Compare all contrasts with overall probability of type I error 1α\le 1-\alpha

Definition
Sα;cm=scm(k1)Fk1,Nk,αwith scm=cim2niMSES_{\alpha;cm}=s_{cm}\sqrt{(k-1)F_{k-1,N-k,\alpha}}\quad\text{with }s_{cm}=\sqrt{\sum c_{im}^2n_iMS_E}

Scheffe proves:

Theorem
1α=P(Γm[Cm±scm(k1)Fk1,Nk,α],Γm)=P(Γm[Cm±Sα;cm],Γm)\begin{align*} 1-\alpha&=P\left(\Gamma_m\in\left[C_m\pm s_{cm}\sqrt{(k-1)F_{k-1,N-k,\alpha}}\right], \forall \Gamma_m\right)\\ &=P\left(\Gamma_m\in\left[C_m\pm S_{\alpha;cm}\right], \forall \Gamma_m\right)\\ \end{align*}

    H0:Γm=0vsH1:Γm0\implies H_0: \Gamma_m=0 vs H_1:\Gamma_m\neq 0, reject H0H_0 at level α    Cm>Sα,m\alpha\iff |C_m|>S_{\alpha,m}

Comparing Pairs of Treatment Means

Tukey's Method

用於比較兩個 trt 的平均值是否有顯著差異,並且保證所有的成對比較的總類型 I 錯誤率不超過 α\alpha

設有 kk 個 trt ,它們的平均分別為 μ1,,μk\mu_1,\cdots,\mu_k

ii\forall i\neq i'YˉiYˉi\bar{Y}_{i\cdot}-\bar{Y}_{i'\cdot} 來估計 μiμi\mu_i-\mu_{i'}

    YˉiYˉiN(μiμi,σε2ni+σε2ni)    YˉiYˉiMSE(1ni+1ni)tNk\implies \bar{Y}_{i\cdot}-\bar{Y}_{i'\cdot}\sim N\left(\mu_i-\mu_{i'},\frac{\sigma_\varepsilon^2}{n_i}+\frac{\sigma_\varepsilon^2}{n_i'}\right) \implies \frac{\bar{Y}_{i\cdot}-\bar{Y}_{i'\cdot}}{\sqrt{MS_E\left(\frac{1}{n_i}+\frac{1}{n_i'}\right)}}\sim t_{N-k}     1α=P(μiμi[YˉiYˉi±tNk,α/2MSE(1ni+1ni)]CI(μiμi;α))\implies 1-\alpha=P\left(\mu_i-\mu_{i'}\in\underbrace{\left[\bar{Y}_{i\cdot}-\bar{Y}_{i'\cdot}\pm t_{N-k,\alpha/2}\sqrt{MS_E\left(\frac{1}{n_i}+\frac{1}{n_i'}\right)}\right]}_{CI(\mu_i-\mu_{i'};\alpha)}\right)

但所有信賴區間都成功的幾率會小於 1α1-\alpha ,因此我們希望能找到一個區間 CICI^* s.t. P(μiμiCI,ii)1αP(\mu_i-\mu_{i'}\in CI^*,\forall i\neq i')\ge 1-\alpha

Definition
Tα=qα(k,f)2(1ni+1ni)MSE=balqα(k,f)MSEnT_\alpha=\frac{q_\alpha(k,f)}{\sqrt{2}}\sqrt{(\frac{1}{n_i}+\frac{1}{n_i'})MS_E}\xlongequal{\text{bal}}q_\alpha(k,f)\sqrt{\frac{MS_E}{n}}
  • k=k= number of trt
  • f=f= df of error
Theorem

Tukey's Result:

P(μiμi[YˉiYˉi±Tα],ii)1αP\left(\mu_i-\mu_{i'}\in\left[\bar{Y}_{i\cdot}-\bar{Y}_{i'\cdot}\pm T_\alpha\right],\forall i\neq i'\right)\ge 1-\alpha

i.e. ii\forall i\neq i' with H0:μ=μH_0:\mu=\mu' vs H1:μμH_1:\mu\neq\mu', reject H0H_0     YˉiYˉi>Tα\iff |\bar{Y}_{i\cdot}-\bar{Y}_{i'\cdot}|>T_\alpha with overall sig. level α\le \alpha

Fisher Least Significant Difference (LSD) Method

The Fisher Least Significant Difference (LSD) Method. P99-101

Student-Newman-Keuls (SNK) Method

檢驗一對 trt 的平均值中,數值較大的 trt 是否顯著大於數值較小的 trt。

H0:μi=μjv.s.H1:μi>μjwith Yˉi>YˉjH_0:\mu_i=\mu_j\quad\text{v.s.}\quad H_1:\mu_i>\mu_j\quad\text{with }\bar{Y}_{i\cdot}>\bar{Y}_{j\cdot}

使用 fabric 的數據在 α=0.05\alpha=0.05 下進行 SNK 檢定:

  1. 將所有的 trt 平均從小到大排序

    fabricADCB
    sample mean2.192.322.422.68

    將所有的 trt 進行兩兩比較,並且計算它們的差值

    ADCB
    A
    D0.13
    C0.230.10
    B0.490.360.26
  2. 從 ANVOA 表中得到數據 MSE=0.0203MS_E=0.0203df=12df=12,並計算要比較的兩個 trt 的方差:

    SAB=MSE2(1ni+1nj)=balMSEnS_{AB}=\sqrt{\frac{MS_E}{2}(\frac{1}{n_i}+\frac{1}{n_j})}\xlongequal{\text{bal}}\sqrt{\frac{MS_E}{n}}

    在這組數據下 SYˉi=0.02034=0.0712S_{\bar{Y}_{i\cdot}}=\sqrt{\frac{0.0203}{4}}=0.0712

  3. 通過查表得到 qα(p,df)q_\alpha(p, df) ,其中 p=2,,kp=2,\cdots,k 代表要比較的兩個 trt 在排序中的差距。

    q0.05(2,12)q_{0.05}(2,12)q0.05(3,12)q_{0.05}(3,12)q0.05(4,12)q_{0.05}(4,12)
    3.053.774.20

    qα(p,df)q_\alpha(p, df)SABS_{AB} 相乘得到 SNK(p,0.05)SNK(p,0.05)

    ADCB
    A
    D0.22
    C0.270.22
    B0.300.270.22
  4. 將所有的差值與 SNK(p,0.05)SNK(p,0.05) 進行比較,如果差值大於 SNK(p,0.05)SNK(p,0.05) 則拒絕 H0:μi=μjH_0:\mu_i=\mu_j

    ADCB
    A
    D0.130.220.13\not>0.22
    C0.230.270.23\not>0.270.100.220.10\not>0.22
    B0.49>0.300.49>0.300.36>0.270.36>0.270.26>0.220.26>0.22

得到結論:A,D,CA,D,C 的平均值沒有顯著差異,但 BB 的平均值顯著大於其他三個。

使用 Tukey's Method 和 Scheffe's Method 則會得到不同的結論:A,D,CA,D,C 之間沒有顯著差異,C,BC,B 之間有顯著差異,但 BB 顯著大於 A,D,CA,D,C

並且 Tα=0.30,Sα,cm=MSE243F3,12,0.05=0.326T_\alpha=0.30, S_{\alpha,cm}=\sqrt{\frac{MS_E*2}{4}}\sqrt{3\cdot F_{3,12,0.05}}=0.326 都是偏保守的檢定。


Yij=μ+τi+εij    τi{fixedrandomY_{ij}=\mu+\tau_i+\varepsilon_{ij}\implies \tau_i\begin{cases} \text{fixed}\\ \text{random} \end{cases}

    \implies ANOVA for testing H0:H_0: No trt effect v.s. H1:H_1: At least one trt effect H0\to H_0 usually rejected.

  • τi\tau_i: fixed \to contrast for detailed analysis

  • τi\tau_i: random \to Variance components estimation problem. Basic way to do this is by ANOVA method.

        \implies solve for each variance component and the solution is an est for that variance component.

    e.g. One-fator CRD (random model)

    E(MSE)=σε2=setMSEE(MStrt)=σε2+nστ2=setMStrt    σ^ε2=MSEσ^τ2=MStrtMSEn\begin{gather*} E(MS_E)=\sigma_\varepsilon^2\xlongequal{\text{set}}MS_E\quad E(MS_{trt})=\sigma_\varepsilon^2+n\sigma_\tau^2\xlongequal{\text{set}}MS_{trt}\\ \implies \hat{\sigma}_\varepsilon^2=MS_E\quad\hat{\sigma}_\tau^2=\frac{MS_{trt}-MS_E}{n} \end{gather*}

    與 MOME 類似。估計量可能為負,在這種情況下,我們應該將估計量設為 0 (P510-511)。