http://www.semsoeasy.com.tw/
1
HLM生存指南-理論與實務應用
張偉豪
三星統計服務有限公司執行長
SEM 亞洲一哥
版本:20150902
三星課程網
Outline
• HLM到底在做什麼?
• 故事從ANOVA開始
• What is Hierarchical Linear Modeling
• HLM的估計模型
• 進入HLM分析的世界
– HLM資料檔製作
– ICC, Reliability, rwg(j)
– 報表解讀
http://www.semsoeasy.com.tw/
2
HLM到底在做什麼?
• SPSS VS. HLM兩種資料型態
– 樣本獨立 (cross-section)
– 樣本不獨立 (longitudinal, panel data)
• 掛在嘴上的兩句話
– 巢狀結構
– 非巢狀結構
http://www.semsoeasy.com.tw/
3
HLM到底在做什麼?
• HLM就只是兩組迴歸分析而已!
– Disaggregate level regression (個體)
– Aggregate level regression (群體)
• 弄懂兩個重要的名詞
– 固定效果 (Fixed effect)
– 隨機效果 (Random effect)
http://www.semsoeasy.com.tw/
4
HLM到底在做什麼?
• 計算兩種變異
– 組內變異 (between variance)
– 組間變異 (within variance)
• 估計兩個參數
– 截距(平均數)(ANOVA)
– 斜率(干擾(調節)效果分析)
http://www.semsoeasy.com.tw/
5
HLM到底在做什麼?
• 只看兩張表格
– Estimation of Fix Effect
– Estimation of Variance Components
• 計算兩個重要指標
– ICC (1) (Intra Correlation Coefficient)
– Rwg(j) (Interrater agreement)
http://www.semsoeasy.com.tw/
6
HLM到底在做什麼?
• 自變數平減(Mean center)兩種方法
– Group mean center (組平減)
– Grand mean center (總平減)
• 內生變數(Y)變異數的分解
– 可解釋變異 (R2) (Level1 and Level 2)
– 不可解釋變異 (殘差)
http://www.semsoeasy.com.tw/
7
HLM是如何進行分析?
•個人層次執行迴歸分析
•檢查估計參數的變異數是否跨群組有差異
•使用群組變數去解釋個人層次估計參數的
變異數
•估計不同層級之間的主效果及交互作用
http://www.semsoeasy.com.tw/
8
故事從ANOVA開始
http://www.semsoeasy.com.tw/
9
μ1 μ2 μ3
μ=(μ1+μ2+μ3)/3
故事從ANOVA開始
http://www.semsoeasy.com.tw/
10
故事從ANOVA開始
group1 group2 group3 總平均
1 6 12 18
2 2 8 14
組平均 4 10 16 10
http://www.semsoeasy.com.tw/
11
組間變異(τ00)=[(4-10)2+(10-10)2+(16-10)2]/3=24
組內變異(σ2)=[(6-4)2+(2-4)2+(12-10)2+(8-10)2+
(18-16)2+(14-16)2]/6=4
總變異=[(6-10)2+(2-10)2+(12-10)2+(8-10)2+
(18-10)2+(14-10)2]/6=28
組間變異佔總變異比例(ρ=τ00 /(τ00 +σ2 ))= 24/28≈86%
表示群組之間的差異可解釋全部變異約86%
What is HLM?
• 在研究領域中有許多的資料是巢狀結構
– 學生巢形(包含)於教授之下,教授巢形學校之下
– 病患巢形於醫生之下,醫生巢形於醫院之下
– 果樹巢形於果園之下,果園巢形於產地之下
– 員工巢形於公司之下,公司巢形於產業之下
– 兒童巢形於家庭之下,家庭巢形於社區之下
– 人民巢形於城市之下,城市巢形於國家之下
– 重複實驗巢形於個人之下
– 校外實習生巢形於公司經理之下
– 連續10年財務指標巢形於公司之下
• 重點是以上的個體樣本資料都不獨立
http://www.semsoeasy.com.tw/
12
13
What is HLM
•了解了吧! 但是到底 …
– Two levels HLM 模型分析是如何?
–從概念模型來看
• Step 1
–分別估計每個群體的迴歸方程式
–進行群組間的描述性分析 (intercept
and slopes的平均數及變異數)
• Step 2
–將步驟1求得的截距與斜率當作結果變數
與LEVEL2的變數進行迴歸分析
–從數學上來講,並不是真的分成兩個階段,但
這種講法有助於理解HLM是怎麼一回事
14
What is HLM
Level 1: 每一群各
自的迴歸值(斜率)
Level 2:
•群組變數預測的截距變異數(每個樣本有不同的截距)
•群組變數預測的斜率變異數(每個樣本有不同的斜率)
Yij
Xij
15
What is HLM
•有些人就是喜歡看方程式…
•多層次模型的二階段方法
– Level 1: 估計各群組組內的關係
– Level 2: 群組變數估計 level-1的參數,包括截距
與斜率 (intercepts & slopes)
Level 1: Yij = ß0j + ß1j Xij + rij
Level 2: ß0j =  00 +  01 (Groupj) + U0j
ß1j =  10 +  11 (Groupj) + U1j
{ j 小標表示參數跨群不同}
16
What is HLM
•利用一個簡單的例子說明
– Individual variables (Level 1)
•學生學習成績(DV)
•學生參與程度(IV)
– Group variable (Level 2)
•老師教學技巧
What is HLM
• Hypotheses
–學生參與程度正向顯著影響學生學習成績
–老師教學技巧正向顯著影響學生學習成績在學
生參與程度控制的情形之下
•平均而言,老師的教學技巧愈好,學生的學習成績愈
好
–教學技巧調節學生參與學習成績之間的關係
•教學技巧較好時學生參與對學習成績的影響會大於
教學技巧較差時學生參與對學習成績的影響
•老師不同的教學技巧,學生參與學習成績會有不
同的斜率
http://www.semsoeasy.com.tw/
17
18
What is HLM
•整體而言,學生參與與學習成績呈現正相關 (跨群組的
平均迴歸值)
•教師有好的教學技巧,學習成績會高於較差的教學技巧
(平均截距 green/solid vs.red/dotted line)
•好的教學技巧會使得學生參與對學習成績優於較差教
學技巧 (平均斜率)
學
習
成
績
學生參與
好的教學技巧
差的教學技巧
19
What is HLM
•再度給喜歡看方程式的人…
Level 1: 學習成績ij = ß0j + ß1j (學生參與ij) + rij
Level 2: ß0j =  00 +  01 (教學技巧j) + U0j
ß1j =  10 +  11 (教學技巧j) + U1j
HLM formal notation
• Yij=j群中第i個人的內生變數的值
• Β0j=level 1隨機截距
• Β1j=level 1隨機斜率
• Xij=level 1預測變數在j群中第i個人的值
• rij=level 1殘差變異數(可能含自變數)
• σ2
ij=level 1殘差變異數(截距模型的組內變異σ2
W)
• γ00=level 2隨機截距的總平均截距
• γ01=level 2隨機截距的斜率
• γ10=level 2隨機斜率的截距
• γ11=level 2隨機斜率的斜率
http://www.semsoeasy.com.tw/
20
HLM formal notation
• Wj=level 2預測變數的值
• μ0j=level 2隨機截距的殘差(可能含自變數)
• μ1j=level 2隨機斜率的殘差
• σ2
0j=level 2隨機截距的殘差
(截距模型的組間變異σ2
B)
• σ2
1j=level 2隨機斜率的殘差
• τ01=level 2隨機截距與斜率的共變異數
• ρ=ICC (Intraclass Correlation Coefficient)
= σ2
B/(σ2
W+ σ2
B)
http://www.semsoeasy.com.tw/
21
層級(Levels, classifications)及單位(units)
• 層級(學校,區域,組織)是由許多不獨立的
單位所組成(學生,社區居民,公司員工)
• classification and level兩個名詞可以互
換,但是level隱含有巢形結構的意義,而
classification沒有
http://www.semsoeasy.com.tw/
22
23
levels
• Level-1 變數:
–巢形於群組(group)下的變數,一般是個人
(或個人底下的重複測量的次數)
•依(結果)變數永遠都在第一層
• Level-2 變數:
–這些變數是位於較高層次的變數
• group level (老師的經驗,學校教材)
• individuals (重複量數實驗)
Two-level hierarchical structures
• 學生巢形於學校之下
• 每個學校隨機抽樣幾個學生
http://www.semsoeasy.com.tw/
24
Students St1 St2 St3 St1 St2 St1 St2 St3 St1 St2 St3 St4
Schools Sc1 Sc2 Sc3 Sc4 Schools
Students
資料類型
levels 應變數 自變數
學生i 學校j 學生測驗分數Yij 學生前測分數Xij 學生性別Gij 學校類型Sj
1 1 75 56 M 公立
2 1 71 45 M 公立
3 1 91 72 F 公立
1 2 68 49 F 私立
2 2 37 36 M 私立
3 2 67 56 M 私立
1 3 82 76 F 公立
http://www.semsoeasy.com.tw/
25
1.男生成績是否比女生成績高一些?(截距)
2.性別效果是否跨學校不同?
3.男生與女生在學業進步是否不一樣? (斜率)
4.學校不同對學生學業進步是否不一樣?
5.某特定學校的影響效果是否與其它學校不一樣?
6.學生在私立學校進度是否比公立學校多?
這些答案要由HLM分析來解答
Repeated Measures data
http://www.semsoeasy.com.tw/
26
levels 應變數 自變數
學生i 學校j 學生測驗分數Yij 學生前測分數Xij 學生性別Gij 學校類型Sj
1 1 75 56 M 公立
2 1 71 45 M 公立
3 1 91 72 F 公立
1 2 68 49 F 私立
2 2 37 36 M 私立
3 2 67 56 M 私立
1 3 82 76 F 公立
在上一例子中我們可以利用學生前測成績來預測現今
的學習成效
另外,資料中顯示1個學生有兩次的測驗成績,我們也可
以將之視為第1層,而學生為第2層,學校為第3層
重複量數結構圖示
P1 P2 P3 .....
O1 O2 O3 O4 O1 O2 O1 O2 O3
Person
Measurement
一行代表1個人
重複次數要以直的方式建檔
Person m1 m2 m2 Gender
1 75 85 95 F
2 82 91 * M
3 88 93 96 F
levels Response
measurement I Person J Heightij Genderj
0 1 75 F
1 1 85 F
2 1 95 F
0 2 82 M
1 2 91 M
0 3 88 F
1 3 93 F
2 3 96 F
虛擬的資料範例
http://www.semsoeasy.com.tw/
28
整合前(不考慮群組影響) 整合後(考慮群組影響)
不考慮群組影響迴歸分析
http://www.semsoeasy.com.tw/
29
Y= 5.333- .333X+ error
Y= 5.333- .333X+ error
http://www.semsoeasy.com.tw/
30
This is an example of a disaggregated analysis
β0
β1
考慮群組影響迴歸分析
http://www.semsoeasy.com.tw/
31
Y=8.00- 1.00X+ error
Y=8.00- 1.00X+ error
• X對Y有負向的影響,X每增加1單位,Y會下
降1個單位
http://www.semsoeasy.com.tw/
32
β0
β1
This is an example of a aggregated analysis
如果分別考慮群組內的迴歸
http://www.semsoeasy.com.tw/
33Yij = Yj +1.00(Xij − 𝑋j ) + rij
http://www.semsoeasy.com.tw/
34
Between group regressions
Total regression
Within group
regressions
Why Is Multilevel Analysis Needed?
• 巢形結構使得樣本資料不獨立
– 樣本相依違反了傳統的統計假設 (殘差獨立及
迴歸斜率同質)
– 相依資料導致統計估計偏誤
• 了解不同群間所造成的變異就變得很重要
http://www.semsoeasy.com.tw/
35
Sample size requirements
• Kreft (1996) proposes a general 30/30
rule, in which there are 30 groups and 30
observations per group.
• Hox (1998) suggests a minimum ratio of
50/20 rule, in order to test cross-level
interactions.
• Hox (1998) also suggests a minimum ratio
of 100/10 to test random effects.
http://www.semsoeasy.com.tw/
36
Hox,J.(1998). Multilevel modeling: When and why. In R.Mathar & M. Schader,
Classification, data analysis, and data highways. Berlin, Germany: Springer-Verlag.
Kreft, I.G.G. (1996). Are multilevel techniques necessary? An overview, including
simulation studies. Unpublished manuscript, California State University, Los Angeles, CA.
37
HLM的估計模型
Variables in HLM Models
• 結果變數(Outcome variables, Y)
• 預測變數(Predictors, X)
– 控制變數(Control variables)
– 解釋變數(Explanatory variables)
• 群組層次預測變數
(Variables at higher levels, W)
– Global variables (只在二階存在的變數)
– Shared variables (由一階整合到二階)
– 脈絡變數(Contextual variables)
http://www.semsoeasy.com.tw/
38
39
HLM的估計模型
HLM常見的定義:
–隨機效果(Random coefficients/effects)
• Coefficients/effects 假設跨群組不同
–組內截距(截距變異數); 組內斜率(斜率變異數);
Level 2 殘差
–固定效果(Fixed effects)
•效果跨群組不變
– Level 2 截距(總平均), Level 2 斜率
Level 1: 學習成績ij = ß0j + ß1j (學生參與) + rij
Level 2: ß0j =  00 +  01(教學技巧) + U0j
ß1j =  10
40
random and fixed effect
•固定效果:估計參數具有跨群組的不變性
– e.g., 截距及跨第二層的斜率
•隨機效果:估計參數會隨著群組不同而不同
– level-1 及 level-2 的誤差項
–模型中可以用其它的自變數來解釋這些變異的
存在
•學校是從眾多學校中隨機抽出,學生也是從
學校中隨機抽出,因此會有隨機效果
•性別及學校類型只有有限的分類,因此不會
有隨機效果
41
HLM的估計模型
• HLM提供:
– Level-2 parameters (intercepts, slopes)
– Variance of Level-2 residuals
– Level 1 parameters (intercepts, slopes)
– Variance of Level-1 residuals
– Covariance of Level-2 residuals
• Statistical tests:
– t-test for parameter estimates (Level-2,
fixed effects)
– Chi-Square for variance components
(Level-2, random effects)
HLM的估計模型
• 簡單範例的假設
–學生參與程度正向影響學生學習成績
–老師教學技巧正向影響學生學習成績在學生參
與程度控制的情形下
•平均而言,教師教學技巧愈好,學生的學習成績會愈
好,在學生參與程度維持不變的情形下
–教學技巧調節學生參與學習成績的關係
•教學技巧好的老師其學生參與學習成績的影響會
大於教學技巧較差者
http://www.semsoeasy.com.tw/
42
43
HLM的估計模型
•必要條件
– 學習成績需具有一定的組內及組間變異
– level-1 的平均斜率要顯著不為0 (H1)
– level-1 截距變異數要有顯著差異 (H2)
– 截距變異數要與教學技巧顯著相關 (H2)
– level-1 斜率變異數要有顯著差異 (H3)
– 斜率變異數要與教學技巧顯著相關 (H3)
44
HLM的估計模型
• 整體而言, 學生參與 和學習成績 為正相關(跨所有群組
的平均迴歸線)
• 整體而言, 好的教學技巧 有比較好旳學習成績
(average intercept green/solid vs. mean
red/dotted line)
• 好的教學技巧 的平均斜率比差的教學技巧要高
學
習
成
績
學生參與
High 教學技巧
Low 教學技巧
45
HLM的估計模型
• One-way ANOVA - no Level-1 or Level-2
predictors (null)
Level 1: 學習成績ij = ß0j + rij
Level 2: ß0j =  00 + U0j
• where:
ß0j = 各(j)群平均學習成績
 00 = 所有學生的學習成績總平均
Var ( rij ) = 2 = 學習成績的組內變異
Var ( U0j ) = 學習成績的組間變異
Var (學習成績 ij ) = Var ( U0j + rij ) =  + 2
ICC1 =  / ( + 2 )
46
HLM的估計模型
• Random coefficient regression model
–新增學生參與到 Level-1 model ( no Level-2 predictors)
Level 1: 學習成績ij = ß0j + ß1j (學生參與ij) + rij
Level 2: ß0j =  00 + U0j
ß1j =  10 + U1j
 00 = 截距的平均數(pooled) (t-test)
 10 = 斜率的平均數(pooled) (t-test; H1)
Var ( rij ) = 2 = Level-1 殘差變異數(組內變異) (H1)
Var ( U0j ) =   截距的變異數 (related H2)
Var (U1j ) = 斜率的變異數 (related H3)
47
HLM的估計模型
• Intercepts-as-outcomes - model Level-2 intercept
(H2)
–增加教學技巧 to intercept model
Level 1: 學習成績ij = ß0j + ß1j (學生參與ij) + rij
Level 2: ß0j =  00 +  01 (教學技巧j) + U0j
ß1j =  10 + U1j
 00 = Level-2 截距 (t-test)
 01 = Level-2 斜率 (t-test; H2)
 10 = 斜率的平均(pooled) (t-test; H1)
Var ( rij ) = Level-1 residual variance
Var ( U0j ) =  = residual inter. var (H2)
Var (U1j ) = variance in slopes (related H3)
48
• Slopes-as-outcomes - model Level-2 slope (H3)
– 增加教學技巧到斜率模型
Level 1:學習成績ij = ß0j + ß1j (學生參與ij) + rij
Level 2: ß0j =  00 +  01 (教學技巧j) + U0j
ß1j =  10 +  11 (教學技巧j ) + U1j
 00 = Level-2 intercept (t-test)
 01 = Level-2 slope (t-test; H2)
 10 = Level-2 intercept (t-test)
 11 = Level-2 slope (t-test; H3)
Var ( rij ) = Level-1 residual variance
Var ( U0j ) = residual intercepts variance
Var (U1j ) = residual slope var (H3)
HLM的估計模型
HLM分析流程
• 資料準備
• 空模型(NULL or 隨機ANOVA MODEL)
• 僅含Level 1的自變數(隨機ANCOVA MODEL)
• 僅含Level 2的自變數(固定效果模型)
– 自變數為類別變數.
• 僅含Level 2的自變數(隨機迴歸模型)
– 自變數為連續變數
• Level 1及Level 2同時包含自變數(完整模型)
http://www.semsoeasy.com.tw/
49
Preparing Data for HLM Analysis
• 資料檔以SPSS為例
• HLM在不同的LEVEL需要有不同的資料檔
• SPSS的準備工作
– 檢查資料
– 遺漏值處理(Level 1可以有遺漏值,Level 2不行)
– ID連結各層的資料
– ID號碼要排序
• 在HLM中產生MDM file
http://www.semsoeasy.com.tw/
50
SPSS的資料準備
• Level1 整合成 Level2 data
• 資料整合
http://www.semsoeasy.com.tw/
51
• Example
– 使用leve1 及level2的檔
– File
– Make new MDM file
– Stat package input
Creating a new MDM file
http://www.semsoeasy.com.tw/
52
Creating a MDM file
• 選擇HLM2OK
http://www.semsoeasy.com.tw/
53
Creating a MDM file
• Choose Variables
http://www.semsoeasy.com.tw/
54
Creating a MDM file
• 指定level 1分析變數及level 2變數
• SCHID一定要勾
http://www.semsoeasy.com.tw/
55
Creating a MDM file
http://www.semsoeasy.com.tw/
56
Creating a MDM file
• Make MDM
http://www.semsoeasy.com.tw/
57
Creating a MDM file
• Check Stats Done
http://www.semsoeasy.com.tw/
58
Creating a MDM file
• 完成後會看到以下的畫面,準備進行分析
http://www.semsoeasy.com.tw/
59
TWO-LEVEL HLM MODEL
http://www.semsoeasy.com.tw/
60
LEVEL 1
Students
LEVEL 2
Schools
多層次模型示意圖
http://www.semsoeasy.com.tw/
61
截距
Xij
Yij截距 Wj
γij
σ2
μ0j
β1j
γ00
γ10
μ1j
γ01
γ11
β0j
二階迴歸是對一階迴歸
係數做解釋,而不是對
依變項本身做解釋
Yij=γ00 + γ01Wj +γ10Xij + γ11WjXij
+ μ0j + μ1j + μ1jXij + γij
多層次模型的六大次模型
• 隨機效果單因子變異數分析
(one-way ANOVA with random effects )
• 隨機效果單因子共變數分析
(one-way ANCOVA with random effects)
• 隨機係數迴歸模型
(random coefficients regression model)
• 截距模型(intercept-as-outcomes regression )
• 脈絡模型(contextual model)
• 非隨機變化斜率模型
(a model with nonrandomly varying slopes)
HLM分析的六大次模型
階層一 階層二
模型
無解釋變項 有解釋變項 階層一截距為結果變項 階層一斜率為結果變項
隨機 ANOVA 0ij j ijY r  jj u0000  
隨機 ANCOVA 0 1ij j j ij ijY X r    0 00 0j ju   1 10j 
隨機係數迴歸模型 0 1ij j j ij ijY X r    0 00 0j ju   1 10 1j ju  
截距模型 0ij j ijY r  0 00 01 0j j jW u    
脈絡模型 0 1ij j j ij ijY X r    0 00 01 0j j jX u     1 10j 
非隨機斜率模型 0 1ij j j ij ijY X r    0 00 01 0j j jW u     1 10 11j jW   
完整模型 0 1ij j j ij ijY X r    0 00 01 0j j jW u     1 10 11 1j j jW u    
隨機ANOVA模型
• 又稱為空模型
• 目的:計算ICC(1),了解資料是否適合進行
HLM
• 模型只有依變數不含任何自變數
http://www.semsoeasy.com.tw/
64
隨機ANOVA模型
• LEVEL 1: 𝒀𝒊𝒋 = 𝜷 𝟎𝒋 + 𝜸𝒊𝒋
• LEVEL 2: 𝜷 𝟎𝒋 = 𝜸 𝟎𝟎 + 𝝁 𝟎𝒋
• General model: 𝒀𝒊𝒋 = 𝜸 𝟎𝟎 + 𝝁 𝟎𝒋 + 𝜸𝒊𝒋
• 𝑽𝒂𝒓(𝒀𝒊𝒋) = 𝑽𝒂𝒓(𝜸 𝟎𝟎 + 𝝁 𝟎𝒋 + 𝜸𝒊𝒋) = 𝝉 𝟎𝟎+𝝈 𝟐
• 組內相關係數ICC= 𝝆 = 𝝉 𝟎𝟎/𝝉 𝟎𝟎 + 𝝈 𝟐
• 低度組內相關: ICC<.059,
• 中度組內相關: 0.059<ICC<0.138
• 高度組內相關: ICC>0.138
http://www.semsoeasy.com.tw/
65
隨機ANOVA模型
http://www.semsoeasy.com.tw/
66
如果不設定μ0 等於求
全體平均數
隨機ANOVA模型
http://www.semsoeasy.com.tw/
67
• Run Analysis Run the model shown
隨機ANOVA模型
http://www.semsoeasy.com.tw/
68
• File View Output
Variance Components Analysis
• VCA 用來估計隨機殘差變異數的大小
– 尤其是當資料為不平衡設計時
– 必需使用迭代程序估計
(一般為ML estimation)
• VCA提供殘差變異數顯著性估計,當變異跨
單位存在或不存在時(卡方檢定)
http://www.semsoeasy.com.tw/
69
隨機ANOVA模型
http://www.semsoeasy.com.tw/
70
(卡方差異值)
Estimating Variance Components:
Unconditional Model
• Var(Yij) = Var(u0j) + Var(rij)
= τ0 + σ2
http://www.semsoeasy.com.tw/
71
Estimation Methods
• RML: 當群組(j)較少時,可以得到較佳的估計值
FML 具有兩點優勢:
– 計算容易
– FML估計迴歸係數及變異數成份的整體卡方值,
RML只有變異數成份檢定而已.
• 如果比較兩個巢狀模型 離異值的差異檢定
應採用FML比較理想
http://www.semsoeasy.com.tw/
72
隨機ANCOVA模型
• LEVEL 1加入預測變數(X)
• 當X為類別變數時,斜率應設定為固定效果
𝒀𝒊𝒋 = 𝜸 𝟎𝟎 + 𝜸 𝟏𝟎 𝑿𝒊𝒋 + 𝝁 𝟎𝒋 + 𝜸𝒊𝒋
http://www.semsoeasy.com.tw/
73
隨機ANCOVA模型
• LEVEL 1加入”性別“預測變數(X)
http://www.semsoeasy.com.tw/
74
Variance explained
• R2 at level 1
= 1 – (σ2
cond + τcond) / (σ2
uncond + τuncond)
= 1 – (.46 + .86) / (.64 + .88)
= 1- (1.32/1.52)=.1316 = 13.16%
• R2 at level 2 =1 – [(σ2cond / nh) + τcond] /
[(σ2
uncond / nh) + τuncond]
• nh = the harmonic mean of n for the level 2
units (k / [1/n1 + 1/n2 +…1/nk])
• 調和平均數可利用SPSS計算
http://www.semsoeasy.com.tw/
75
Variance explained
• Level 1 增加自變數後,殘差變異數改善的
比例
R2 = (τbaseline – τconditional) / τbaseline
= (.64 – 46)/.64
=.28 = 28%
http://www.semsoeasy.com.tw/
76
隨機係數的迴歸模型
• LEVEL 1加入預測變數(X)
• 當X為連續變數時,斜率應設定為隨機效果
𝒀𝒊𝒋 = 𝜸 𝟎𝟎 + 𝜸 𝟏𝟎 𝑿𝒊𝒋 + 𝝁 𝟎𝒋 + 𝝁 𝟏𝒋 𝑿𝒊𝒋 + 𝜸𝒊𝒋
http://www.semsoeasy.com.tw/
77
隨機係數的迴歸模型
http://www.semsoeasy.com.tw/
78
Compare model fit using
deviance statistics
• 檢定模型改善是否顯著?
• Other settings Hypothesis Testing
http://www.semsoeasy.com.tw/
79
隨機係數的迴歸模型
• LEVEL 1加入連續變數 (X)
• 𝒀𝒊𝒋 = 𝜸 𝟎𝟎 + 𝜸 𝟏𝟎 𝑿𝒊𝒋 + 𝝁 𝟎𝒋 + 𝝁 𝟏𝒋 𝑿𝒊𝒋 + 𝜸𝒊𝒋
http://www.semsoeasy.com.tw/
80
Centering
• No centering (common practice in
single level regression)
• Centering around the group mean ( 𝑿j )
• Centering around the grand mean (M )
http://www.semsoeasy.com.tw/
81
截距模型
• LEVEL 1: 𝒀𝒊𝒋 = 𝜷 𝟎𝒋 + 𝜸𝒊𝒋
• LEVEL 2: 𝜷 𝟎𝒋 = 𝜸 𝟎𝟎 + 𝜸 𝟎𝟏 𝑾𝒋 + 𝝁 𝟎𝒋
• General Model: 𝒀𝒊𝒋 = 𝜸 𝟎𝟎 + 𝜸 𝟎𝟏 𝑾𝒋 + 𝝁 𝟎𝒋 + 𝜸𝒊𝒋
• LEVEL 2加入預測變數
• LEVEL 2的預測變數影響的是LEVEL 1的截距
http://www.semsoeasy.com.tw/
82
截距模型
• LEVEL 2加入老師的經驗
http://www.semsoeasy.com.tw/
83
完整模型(截距及斜率模型)
• LEVEL 1: 𝒀𝒊𝒋 = 𝜷 𝟎𝒋 + 𝜷 𝟏𝒋 𝑿𝒊𝒋 + 𝜸𝒊𝒋
• LEVEL 2: 𝜷 𝟎𝒋 = 𝜸 𝟎𝟎 + 𝜸 𝟎𝟏 𝑾𝒋 + 𝝁 𝟎𝒋
𝜷 𝟏𝒋 = 𝜸 𝟏𝟎 + 𝜸 𝟏𝟏 𝑾𝒋 + 𝝁 𝟏𝒋
• General Model: 𝒀𝒊𝒋 = 𝜸 𝟎𝟎 +
𝜸 𝟎𝟏 𝑾𝒋 + 𝜸 𝟏𝟎 𝑿𝒊𝒋 + 𝜸 𝟏𝟏 𝑾𝒋 𝑿𝒊𝒋 + 𝝁 𝟎𝒋 + 𝝁 𝟏𝒋 𝑿𝒊𝒋 + 𝜸𝒊𝒋
http://www.semsoeasy.com.tw/
84
完整模型(截距及斜率模型)
http://www.semsoeasy.com.tw/
85
HLM的統計估計方法
• Estimation Methods
– FML (Full Maximum Likelihood)
– RML (Restricted Maximum Likelihood)
– Empirical Bayes estimation
• Parameter estimation
– Coefficients and standard errors
– Variance Components
• Parameter reliability
• Centering
• Residual files
http://www.semsoeasy.com.tw/
86
87
Multi-level constructs
•構面是研究發展及測試理論的組成元件
• Group-level constructs 是將群組當成整
體處理並分成以下二種型態 (Kozlowski &
Klein, 2000):
– Global constructs
– Shared constructs
88
Global Constructs
•相對客觀,容易觀察,描述群體特徵
•源自於群體層次
• Examples:
–老師教學經驗,學校型態或學校地點
•不具“有意義”的組內變異(within-group
variability)
•測量一般是直覺的
89
Shared Constructs
•群組特性是來自於群組成員的組合
•源自於群組成員的態度,認知或行為
•組內變異一般要很低,如此才能從個體層次
提升自群體層次
– rwg(j)為必須計算的指標
• Examples:
–組織氣侯,主觀規範,認知行為控制
What is rwg(j)?
• rwg(j)是目前使用最廣泛的interrater
agreement指標,特別是針對量表為李克特
量表
• rwg(j)因為無法符合常態分配,因此不適合估
計φ±2σ的信賴區間
• (j)代表的是構面量表的題數
http://www.semsoeasy.com.tw/
90
91
Rule-Of-Thumb
•實務上一般認為 Rwg(j) >0.70 表示可以
接受個別的分數整合成群體分數,當然愈
高愈好
• Zohar (2000) cited rWG values in the .70’s
and mid .80’s as proof that judgments
“were sufficiently homogeneous for within
group aggregation”
Zohar, D.(2000). A group-level model of safety climate: testing the effect of
group climate on microaccidents in manufacturing jobs. Journal of Applied
Psychology, 85(4), 587-596.
How to calculate rwg(j)?
http://www.semsoeasy.com.tw/
92
James L R, Demaree R G, Wolf G.(1993). Rwg: An Assessment of within-
Group Interrater Agreement. Journal of Applied Psychology.78, 306-309.
93
中心化議題再議
• HLM 要求您要對level-1 predictors進
行中心化
• 這是重要的決策
– 錯誤的選擇會導致您的測試理論模型與假設
結果不一致
– 錯誤的中心化選擇會導致虛假的跨層次干擾
效果
• level-2 變數預測 level-1 slope
94
Centering Decisions
• Level-1 parameters are used as
outcome variables at level-2
• Thus, one needs to understand the
meaning of these parameters
• Intercept: 當X為0時,Y的期望值
• Slope: X每增加1個單位,Y期望增加某些單
位
• Raw metric form: X等於0可能沒有意義
95
Centering Decisions
• 3 種選擇
– Raw metric (資料不做中心化)
– Grand mean
– Group mean
• Kreft et al. (1995): raw metric and
grand mean equivalent, group mean non-
equivalent
• Raw metric/Grand mean centering
– intercept var = adjusted between group
variance in Y
• Group mean centering
– intercept var = between group variance in
Y
[Kreft, I.G.G., de Leeuw, J., & Aiken, L.S. (1995). The effect of different forms of centering in
Hierarchical Linear Models. Multivariate Behavioral Research, 30, 1-21.]
96
Centering Decisions
• 重點是…
– Grand mean centering and/or raw
metric estimate incremental models
• Controls for variance in level-1 variables
prior to assessing level-2 variables
– Group mean centering
• Does NOT estimate incremental models
– Does not control for level-1 variance
before assessing level-1 variables
– Separately estimates with group
regression and between group
regression
97
Centering Decisions
• 當研究包含跨層次交互作用時中心化決
策就顯得非常重要
•考慮以下的模型:
Level 1: Yij = ß0j + ß1j (Xgrand) + rij
Level 2: ß0j =  00 + U0j
ß1j =  10
• ß1j群組斜率整合時並未提供不偏的估計
– It actually represents a mixture of both the
within and between group slope
– Thus, you might not get an accurate picture
of cross-level interactions
98
Centering Decisions
• Bryk & Raudenbush make the distinction
between cross-level interactions and
between-group interactions
– Cross-level: Group level predictor of level-1
slopes
– Group-level: Two group level predictors
interacting to predict the level-2 intercept
99
Centering Decisions
• Only group-mean centering enables the
investigation of both types of
interaction
• Illustration (Hofmann & Gavin, 1999,
J. of Management)
– Created two data sets
• Cross-level interaction, no between-group
interaction
• Between-group interaction, no cross-level
interaction
100
Centering Decision
• Incremental
– group adds incremental prediction over
and above individual variables
– grand mean centering
– group mean centering with means added
in level-2 intercept model
101
Centering Decision
• Mediational
– individual perceptions mediate relationship
between contextual factors and individual
outcomes
– grand mean centering
– group mean centering with means added
in level-2 intercept model
102
Centering Decisions
• Moderational
– group level variable moderates level-1
relationship
– group mean centering provides clean
estimate of within group slope
– separates between group from cross-level
interaction
– Practical: If running grand mean
centered, check final model group mean
centered
103
Centering Decisions
• Separate
– group mean centering produces separate
within and between group structural
models
http://www.semsoeasy.com.tw/
104104
三星統計服務有限公司協辦
http://www.semsoeasy.com.tw/

HLM階層線性模型基礎班-三星統計張偉豪