Professional Documents
Culture Documents
Analysis of covariance
(ANCOVA)
生物統計諮詢中心
蔡培癸
大綱
1.ANOVA 回顧
2. 何謂 ANCOVA
3. 不同的研究問題
4.ANCOVA 的假設
5. 基礎方程式
6.SPSS 範例
Anova recap (1)
• You will remember that
– ANOVA is used to test for significant differences
between means (2 or more groups) by analyzing
variance.
– The total variation among a set of scores is divided into
between groups and within groups variation.
– Between groups variation = systematic variance due to
differences in DV means between groups
– Within groups variation = unsystematic variance
(error), due to all other sources of variance
ANOVA recap (2)
• ANOVA Model
F = Between groups variation (due to IV)
Within groups variation (due to error)
– F ratio compares the two sources of variation (after taking
into account the degree of freedom).
– The expected value of F is 1, because (under the
assumption of the NULL hypothesis) both sources of
variance are assessing the same underlying population
variability among scores
– The more that F exceeds one, the greater the indication
that differences in means between groups did not occur by
chance due to sampling error
ANCOVA 模式
• Y=β0+β1X+β2A+E
– Y- 連續依變數 (DV)
– X- 連續自變數 .( 共變數 covariate ; CV)
– A- 類別自變數 .( 因子 factor ; IV)
– E- 殘差
– β0 、 β1 、 β2- 母體的迴歸係數
• 若將 E 刪除,可得到 Ŷ=β 0 + β1 X + β 2 A
虛擬變數
• 在 ANCOA 模式內,類別自變數 A 有 a 層
次, A 應如何編碼才合適 ?
• 1. 以 1 個變數來處理
• 2. 以虛擬變數 (dummy variable) 處
理
1. 以 1 個變數來處理
• 如用 1,2,3,…,a 來處理
• (1) 當 A=1 , X=x 時:Ŷ1 =β 0 +β1x+β 2 × 1
• (2) 當 A=2 , X=x 時:Ŷ2 =β 0 +β1x+β 2 × 2
• (3) 當 A=3 , X=x 時:
• Ŷ3 =β 0 +β1X+β 2 × 3
•
•
• (2)-(1)
• (3)-(2)
ˆˆ -Y =β
Y2 1 2
• (3)-(1) ˆˆ -Y =β
Y3 2 2
ˆˆ -Y =2 × β
Y3 1 2
1. 以 1 個變數來處理… (2)
• 設 A=1,2,3…,a ,
– A=1 與 A=2 時, X 相同, 差異相同 (β2)
Ŷ
– A=2 與 A=3 時, X 相同, 差異相同 (β )
2
Ŷ
• A 為名義變數,層次間無順序,層次間非等距差異不
適合的處理方法
2. 以虛擬變數 (dummy variable)
處理
• 當 A 有 a 層次,設 a-1 個虛擬變數
• 虛擬變數數值設定 0 、 1 。當 A 為某ㄧ層次,則
該虛擬變數便是 1 ,其他為 0 。
– 用 0 、 1 設定虛擬變數數值得到的結果最好解釋。
• 當所有虛擬變數數值為 0 時 參考組
(Reference group)
– 注意:人數太少,不適合做為參考組
2. 以虛擬變數處理… (2)
• 例: A=1,2,3…,a ,並以 A=1 為參考組
A A2 A3 … Aa
1 0 0 … 0
2 1 0 … 0
3 0 1 … 0
…
…
…
a 0 0 … 1
用虛擬變數名稱來記錄原來 A 的層次
A=2A2=1 其他 =0 ; A=3A3=1…
2. 以虛擬變數處理… (3)
• ANCOVA 模式變成:
Ŷ=β 0 +β1X+β 2A 2 +β 3A 3 +...+β a A a
• (1) 當 X=x , A=1 , A2=A3=…=Aa=0 :
Ŷ1 =β 0 +β1x
• (2) 當 X=x , A=2 , A2=1 , A3=…=Aa=0 :
Ŷ2 =β 0 +β1x+β 2
• (3) 當 X=x , A=3 , A3=1 , A2=A4=…=Aa=0 :
•
•
• Ŷ3 =β 0 +β1x+β 3
• (2)-(1)
• (3)-(1)
ˆˆ -Y =β
Y2 1 2
ˆˆ -Y =β
Y3 1 3
2. 以虛擬變數處理… (4)
• 即 A=1 與 A=2 , X 相同 Ŷ 差異相同 (β2)
ANCOVA 是 X 與 Y 的直線關係
– 不隨 A 層次改變 ( 平行,無交互作用 interaction)
– 當 X 相同,因子 A 不同層次與 A=1 之 差異為 β2 、 β3….
Ŷ
ANCOVA 圖形,暫設 A 因子只有 3 層次
• ANCOVA 重要目的依類別因子 A 內部同
層次之連續變數 Y 平均數是否有差異
– 1. 調整 ( 控制 )X 對 Y 的影響 ( 因線性關
係)
– 2. 對 β2 、 β3... 作顯著性檢定 ( 檢定與
0 有無差異 )
Basic Example
• DV: 不同教學法後的成績
• IV: 三種教學法 ( 演講法、編序法、啟發
法)
• Covariate (CV): 學生智力
– 因為智力因素是影響學習成績的共變量
• 共變量是幫助我們抽離部份的變異量,使
得組與組之間最後成績不受共變量影響。
ANCOVA
IV IV
ANOVA DV ANCOVA DV Covariate
Error Error
To adjust the means on the DVs in
non-experimental design
Group 3 Group 3
Group 2 Group 2
DV (Y)
DV (Y)
Group 1
Group 1
ANCOVA Between
groups
366.202 2 183.101 6.13*
*p < .05
Source of SS df MS F
Variance
Between 432.889 2 216.444 4.52
ANOVA groups
Within groups 287.333 6 47.889
ANCOVA – SPSS example
Same dataset from Tabachnick, p. 283
IV
Covariate
DV
Analyze General Linear Model Univariate
DV Click here for graphs
of adjusted means
IV(s)
Covariate
N
Treatment-IV 1 3
2 3
3 3
IV = Groups
Treatment groups = 1 & 2
Control group = 3
Output (2) - ANCOVA
Adjusted SS
F = 6.13*
*p < .05
ANOVA
Use the same data but ignore the effect of covariate
ANOVA
Posttest-DV
Sum of
Squares df Mean Square F Sig.
Between Groups 432.889 2 216.444 4.520 .063
Within Groups 287.333 6 47.889
Total 720.222 8