#### Transcript Counterfactuals, Causal Inference, and Propensity Score

```資料庫研究與統計方法學

A New Paradigm for Causal Inference:
The Counterfactual Framework

2010.01.16

• 參考Judea Pearl（professor of Computer
Science and Statistics and director of the
Cognitive Systems Laboratory , UCLA）
• http://singapore.cs.ucla.edu/LECTURE/lectur
e_sec1.htm

1
06.09.06

• 從亞當與夏娃說起：亞當與夏娃吃過智慧

。當上帝問亞當你是否吃了智慧樹的果子

」（不只是說明事實，還做了解釋）；上

1
06.09.06

• 聖經故事的意涵：
▫ 因果解釋是拿來歸咎責任的。
▫ 只有神（為了某些目的）、人與動物（有

（objects）或物理的過程（physical
processes）。

1
06.09.06

• 但當工程師開始建造有許多滑輪及繩纜的
system來幫人做事後，physical objects開始有了

• 至此，causes之概念有雙重意義：
▫ the targets of credit and blame
▫ the carriers of physical flow of control on the
other

1
06.09.06

• 至文藝復興時，當上帝做為final cause逐漸

• Galileo在1638年出版 Discorsi （兩門新科學

1
06.09.06

▫ 1. 先描述，後解釋 （Description first,
explanation second）: The how precedes the
why. Ask not, said Galileo, whether an object
falls because it is pulled from below or pushed
from above. Ask how well you can predict the
time it takes for the object to travel a certain
distance, and how that time will vary from
object to object, and as the angle of the track
changes.
▫ 2. 以數學（方程式）來描述，而不是語言：如
d=t2 。

1
06.09.06

• 從此，物理學充滿了有用但未被解釋的

Ohm’s law, Joule’s law。
• 另一項比預測實驗結果更重要的是代數

“how to” 外，還可以問 “what if”。

1
06.09.06

• 至啟蒙時代，David Hume 將 Galileo的第一項格言

to the HOW, but that the WHY is totally superfluous as
it is subsumed by the HOW。
• On page 156 of Treatise of Human Nature:
"Thus we remember to have seen that species of object
we call FLAME, and to have felt that species of
sensation we call HEAT. We likewise call to mind their
constant conjunction in all past instances. Without any
farther ceremony, we call the one CAUSE and the other
EFFECT, and infer the existence of the one from that of
the other."

1
06.09.06

• 從實證主義的角度來看， Hume是在說 “A
caused B” 與 “Whenever A occurs, then B does”相

• 大難題1：如果如Hume所說，我們的知識是來自

▫ If regularity of succession is not sufficient;
what WOULD be sufficient?

1
06.09.06

• 大難題2：我們知道某些關連有或沒有因果

▫ 當然知道因果關係，就可以做某些事。如

▫ If causal information has an empirical
meaning beyond regularity of succession,
then that information should show up in
the laws of physics. But it does not!

1
06.09.06

• Russell（1913）認為 “All philosophers
imagine that causation is one of the
fundamental axioms of science, yet oddly
enough, in advanced sciences, the word 'cause'
never occurs ... The law of causality, I believe, is
a relic of bygone age, surviving, like the
monarchy, only because it is erroneously
supposed to do no harm ...”
• “It could not possibly be an abbreviation,
because the laws of physics are all symmetrical,
going both ways, while causal relations are unidirectional, going from cause to effect.”

1
06.09.06

• 但另一位科學哲學家Patrick Suppes 則指出
“There is scarcely an issue of Physical
Review that does not contain at least one
article using either ‘cause’ or ‘causality’ in its
title.”
• 物理學家一方面寫無因果意涵的方程式，但另

• 統計學一百多年前發現相關（correlation）的概

1
06.09.06

• Francis Galton於1888年進行個人的前臂與其頭大

▫ If you plot one quantity against the other and scale
the two axes properly, then the slope of the best-fit
line has some nice mathematical properties: The
slope is 1 only when one quantity can predict the
other precisely; it is zero whenever the prediction is
no better than a random guess and, most remarkably,
the slope is the same no matter if you plot X against Y
or Y against X. "
• 我們開始可以根據資料客觀的測量兩個變項間的

1
06.09.06

• Galton的發現震撼了其學生Karl Pearson（公認是

• 這一直要到Sir Ronald Fisher 建立 randomized
experiment 的研究設計後，才成為唯一被主流統

• 但這種謹慎的看法使得無法做實驗，而需靠統計

1
06.09.06

• Pearl 認為這樣的困境是源自統計學的官方語言：

。我們只能說兩者相關。
• Naturally, if we lack a language to express a
certain concept explicitly, we can't expect to
develop scientific activity around that concept.
• Scientific development requires that knowledge
be transferred reliably from one study to another
and, as Galileo has shown 350 years ago, such
transference requires the precision and
computational benefits of a formal language.

1
06.09.06

• 當研究者開始企圖使用電腦來建立因果關係時，

• 從概念層次來說，機器人所遇到的問題是與經濟

1
06.09.06

• 機器人的世界也與第二大難題有關。如果

• 對機器人而言，這兩大難題是具體而實際

1
06.09.06

• J. Pearl 的答案：第二個難題可以結合graphs與
equations的方式解決，如此則第一個難題也比較容易

▫ (1) treating causation as a summary of behavior
under interventions.
▫ (2) using equations and graphs as a mathematical
language within which causal thoughts can be
represented and manipulated.
▫ (3) Treating interventions as a surgery over
equations.

1
06.09.06

• 社會科學家過去75年來不時使用graphs，如
structural equations modeling 及 path diagrams。

• 這些diagrams事實上捕捉了因果的本質─預測不

• 這種預測是代數或相關分析無法做到的。

1
06.09.06

1
06.09.06

• 從這樣的角度來看因果關係，可以理解為何科

control” 的感覺。
• Deep understanding的意思是 “knowing, not
merely how things behaved yesterday, but
also how things will behave under new
hypothetical circumstances, control being one
such circumstance”.

1
06.09.06

• 即使我們無法實際上控制事情，我們也因理解因果

• 我們也可以預測當萬有引力改變時，對潮汐會產生

• 因果模式也是做為區辨有意識的論證（deliberate
reasoning）及被動或本能的反應（reactive or
instinctive response）的試金石。前者可在即使不真

1
06.09.06

• Equations vs. Diagrams (J. Pearl)

1
06.09.06

• Definition of Causation: Y is a cause of Z if we can
change Z by manipulating Y, namely, if after
surgically removing the equation for Y, the solution
for Z will depend on the new value we substitute for
Y.
• THE DIAGRAM TELLS US WHICH EQUATION
IS TO BE DELETED WHEN WE MANIPULATE
Y.
• INTERVENTION AMOUNTS TO A SURGERY
ON EQUATIONS, GUIDED BY A DIAGRAM,
AND CAUSATION MEANS PREDICTING THE
CONSEQUENCES OF SUCH A SURGERY.

1
06.09.06

• INTERVENTION AS SURGERY CONTROLLED EXPERIMENTS
▫ 假定我們要研究某種藥物是否能幫助病人從某

Experiment能夠做到的。但隨機分派的實驗設

1
06.09.06

• 這種實驗設計實際上有兩個部份： Randomization
and Intervention.
• Intervention 就是我們將藥物給一些在正常情況下不

（如SES）切斷，而用另一種替代。
• Fisher的偉大貢獻是 connecting the new link to a

1
06.09.06

1
06.09.06

• 在新典範下，我們可以如何在無法從事實

（如調查或病歷）的資料思考因果關係呢？

1
06.09.06

•

▫ 第一類研究問題： X 對 Y 的影響為何？研究目的




X 對 Y 有影響嗎？

▫ 第二類研究問題：影響 Y 的因素有哪些？研究目



1
06.09.06

• 參考 Morgan, Stephen L.& Christopher Winship
(2007). Counterfactuals and Causal Inference:
Methods and Principles for Social Research. New
York, NY: Cambridge University Press.

1
06.09.06

•X
Y
(Had X taken a different value, then Y would have
taken a different value)
The causal relationship between X and Y is
confounded if:
•Z
X

Y
1
06.09.06

•Z
A
X
•Z
Y
A (unobserved)
X

Y
1
06.09.06

• X
Y
C (collider)
• Z
A (unobserved)
X

Y
1
06.09.06
Statistical Relations vs.
Causal Relations
• Statistical dependence may reflect
▫ Random fluctuation (c. i. & p-value)
▫ X caused Y
▫ Y caused X (temporal order; longitudinal
data)
▫ X and Y share a common cause (covariate
▫ Association between X and is induced by
conditioning on a common effect of X and Y
(selection bias; collider bias)

1
06.09.06

• 當X與Y有common causes時，如能認定X

• Pearl’s Back-door Criterion

1
06.09.06

on Y?
A
V (unobserved)
F
G
U (unobserved)
B
D
Y
C

1
06.09.06
Pearl’s Back-door Criterion
• If one or more back-door paths connects the
causal variable to the outcome variable,
Pearl shows that the causal effect is identified by
conditioning on a set of variables Z
if and only if
all back-door paths between the causal variable
and the outcome variable are blocked after
conditioning on Z.

1
06.09.06
Pearl’s Back-door Criterion
• A back-door path of D and Y is blocked by Z
if and only if
the back-door path satisfies any one of the
following:
▫ contains a chain of mediation A → Z → B, or
▫ contains a fork of mutual dependence A ← Z → B;
▫ contains an inverted fork of mutual causation
A → C* ← B, where C* and all its descendants
are not in Z.

1
06.09.06

(控制 B & F 即可，Why?）
A
V (unobserved)
F
G
U (unobserved)
B
D
Y
C

1
06.09.06
Pearl’s Back-door Criterion (continued)
• 從 Pearl 的 Back-door Criterion 來看，並不是控制

，控制這類變項後，反而會產生相關。
• Example
▫ 如果collider是申請入學時是否被一所菁英學校接受
▫ 是否被接受是根據兩個獨立變項：SAT及面試時對

▫ 因此：adm 是的兩個 causes 是 SAT 及 Motivation，

1
06.09.06
Example of controlling a collider
Logistic regression
Number of obs
LR chi2(2)
Prob > chi2
Pseudo R2
Log likelihood = -27.345829
Odds Ratio
SAT
Motivation
41.97531
29.03388
=
=
=
=
250
107.85
0.0000
0.6635
Std. Err.
z
P>|z|
[95% Conf. Interval]
34.4407
21.40764
4.55
4.57
0.000
0.000
8.405896
6.843622
209.6061
123.1754
. reg Motivation SAT
Source
SS
df
MS
Model
Residual
.155624956
248.844375
1
248
.155624956
1.00340474
Total
249
249
.999999998
Motivation
Coef.
SAT
_cons
.025
-3.28e-09

Std. Err.
.0634802
.0633531
t
0.39
-0.00
Number of obs
F( 1,
248)
Prob > F
R-squared
Root MSE
P>|t|
0.694
1.000
=
250
=
0.16
= 0.6940
= 0.0006
= -0.0034
= 1.0017
[95% Conf. Interval]
-.1000291
-.1247788
.1500291
.1247788
1
06.09.06
4
Example of controlling a collider
1
2
0
0
0
-2
0
0
1
0
00
1
1
1
00
0 00
1 1
0
1
00
1
00
1
0
0
0
0
0
0
0
00
000 00 0 1 1 1
1 1
0 00
0
1
0
0
0
0 0 00 0 000 00001 1 110 1
0 0
0 0 0
0
00 0 000 0 00 0
0
0 00
0 0 0 0 00 0 0
00 0
0 0 0
0
0
0 0
0
0
0
0
00 000 000 0 0 0 0 0 0 0
000 0
00
0
0
0
0
0
0
0
0
0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0
0 0 00 000 00
00
0 00
0 0 0 00 0 0
0
0
0
0
0 000 0 0 00 00 0
0
0
0
0 00
0 0 0
0
0
0
0
0
00
0
00
0
0
0
0 0
0 0
0
0
0
1
0
-4
Motivation
0
1
00
-2
0
2
4
SAT

1
06.09.06
Example of controlling a collider
Source
SS
df
Model
Residual
45.5299
203.4701
2
247
22.76495
.823765585
Total
249
249
.999999998
Motivation
Coef.
SAT
_cons
-.1684419
1.559085
-.1559085

MS
Std. Err.
.0631478
.2100713
.0611258
t
-2.67
7.42
-2.55
Number of obs
F( 2,
247)
Prob > F
R-squared
Root MSE
P>|t|
0.008
0.000
0.011
=
=
=
=
=
=
250
27.64
0.0000
0.1829
0.1762
.90762
[95% Conf. Interval]
-.2928187
1.145326
-.2763028
-.044065
1.972845
-.0355143
1
06.09.06

A
B
C

F
G
D
Y
H
1
06.09.06

(Z)呢？
• 如果D只有兩個值：0及1，我們可以用實驗設計

• 如果無法用實驗設計，而是用調查方法蒐集資料

▫ 條件性控制（conditioning）或是配對（
matching）：
 by holding <something> constant or
 by balancing/homogenizing the treatment & control
groups.

1
06.09.06
The Counterfactual Framework
• 反事實因果推論的想像
Potential Outcomes
Group
Treatment group
(D = 1)
Control group
(D = 0)

Y1
Y0
Observable
Counterfactual
Counterfactual
Observable
1
06.09.06
The Counterfactual Framework
• 反事實分析架構的想像可看成是一種thought
experiment。
• 要想像的是同一個個體或群體在不同的狀態下，

• 這些可能結果間的差異，即為不同狀態（因）的

• Counterfactuals should be reasonable !

1
06.09.06
The Counterfactual Framework
Q：什麼是unreasonable 的 counterfactuals 呢
？
▫ 有什麼狀態不適合看成為 causes 的嗎
？
▫ 有什麼樣的結果不適合想像
counterfactual情況的嗎？

1
06.09.06
The Counterfactual Framework
• 個人層次的真正因果效應：
δi = Yi1 ─ Yi0
• The Fundamental Problem of Causal
Inference：無法觀察同一個人同時在實驗組及

• 加上一些假定，如 SUTVA，則可推估群層次

1
06.09.06
The Counterfactual Framework
• SUTVA：The Stable Unit Treatment Value
Assumption – a priori assumption that the
value of Y for unit u when exposed to
treatment t will be the same no matter what
mechanism is used to assign treatment t to
unit u and no matter what treatments the

1
06.09.06
The Counterfactual Framework
• 實驗設計是假設我們能夠將觀察到的替代無法觀

• 如隨機分派到實驗組與控制組的個體的特性相同
，則我們可以假定：
▫ 如果實驗組的個人沒有接受treatment的話，其

▫ 如果控制組的個人接受treatment的話，其結果

1
06.09.06
The Counterfactual Framework
• 當使用調查方法得到資料時，即observational
data，個人為何會接受或不接受treatment，

• Observational data通常有兩個問題：
▫ 接受treatment者與不接受者有baseline
differences，以及heterogeneity of
treatment effect.
▫ 可能有些影響接受treatment與否的變項，並未

1
06.09.06
The Counterfactual Framework
Potential Outcomes
Group
Treatment
group
(D = 1)
Control group
(D = 0)

Y1
Y0
Observable
E[Y1 | D = 1]
Counterfactual
Counterfactual
Observable
E[Y1 | D = 0]
E[Y0 | D = 0]
E[Y0 | D = 1]
1
06.09.06
The Counterfactual Framework
• 以反事實架構的觀點來看，母群體層次的真正因果

• E[δ] = E[Y1 – Y0]
= E[Y1] – E[Y0]
= {πE[Y1 | D = 1] + (1 – π) E[Y1 | D = 0]} –
{πE[Y0 | D = 1] + (1 – π) E[Y0 | D = 0]}
= π{E[Y1 | D = 1] – E[Y0 | D = 1] } +
(1 – π) {E[Y1 | D = 0] – E[Y0 | D = 0] }
= πE[δ| D = 1] + (1 – π) E[δ | D = 0]

1
06.09.06
The Counterfactual Framework
• π：母群體中接受 treatment 的比例
• 不同組的因果效應：
▫ ATT（Average Treatment Effect on the Treated）:
E[Y1 |D = 1] – E[Y0|D = 1] ，即 E[δ| D = 1]
▫ ATU（Average Treatment Effect on the Untreated）:
E[Y1 |D = 0] – E[Y0|D = 0] ，即 E[δ | D = 0]
Q：我們可以假定不同組的人有同樣的因果效應嗎？

1
06.09.06
The Counterfactual Framework
• 基準線的差異：
E[Y0 |D = 1] – E[Y0|D = 0]
Q：我們可以假定不同組的人在未接受 treatment 前

1
06.09.06
The Counterfactual Framework

Naïve Estimate
= average causal effect
+ baseline bias
+ differential effect bias

E[Y1 |D = 1] – E[Y0|D = 0]
= E(δ)
+ {E(Y0|D=1) − E(Y0|D=0)}
+{E(δ |D=1) − E(δ |D=0)} (1−π)
1
06.09.06
The Counterfactual Framework: A
Review

• Potential/Hypothetical States & Outcomes:
▫因果效應（causal effect）是利用 “potential” 或
“hypothetical”的概念，而不是只用到 actual
observations。.
• The ceteris paribus condition
▫其他條件相同的條件下，也就是將其他因素控制成

。

1
06.09.06
The Counterfactual Framework: A
Review
• Heterogeneity:
▫ 個人對於treatment的反應是因人而異的。亦即因果效應在

[potential outcome under the potential treatment state]
─ [potential outcome under the potential control state]
• Fundamental Problem of Causal Inference:
▫ 由於 the counterfactual definition of causal effect 意涵著

Average Causal Effects。

1
06.09.06
The Counterfactual Framework: A
Review
• Basic Parameters of Interest:
▫ ATT: Average Treatment effect on the Treated
▫ ATU: Average Treatment effect on the Untreated
▫ ATE: Average Treatment Effect
▫ the most basic one is ATT, and there are other
meaningful causal parameters of interest than
these three.

1
06.09.06

• 假設控制影響treatment之共變項後，就能達成
ignorability，這也稱為selection on
observables）
▫ propensity score matching
• 如果此假定不成立的話：
▫ instrumental variable
▫ Heckman selection model
▫ 利用長期追蹤資料的特性，使用如 fixed effect
model，change score model
• 不同的分析方法，要做不同的假定

1
06.09.06

Introduction to Propensity Score
Matching

2010.01.16

1
06.09.06
OLS迴歸分析的問題
• 一般多元OLS迴歸分析，是一種ATE的估計，其

• OLS迴歸分析通常無法克服自我選擇的問題。
• OLS 迴歸分析可能將接受 treatment 及沒接受
treatment 兩組中無法比較的人納入分析。如果

imputation 的方式來推估。

1
06.09.06

• 假設只有 omitted variables，且是可以用控制觀

selection on observables）
▫ propensity score matching （PSM）是這類

1
06.09.06

• selection on observables
•
Z
•
D
•
U (unobservable)

Y
1
06.09.06
Propensity Score Matching（PSM）
• 假定：如果接受及不接受 treatment 兩種人的差異

。

1
06.09.06
Propensity Score Matching（PSM）
• (Y1 , Y0 ) ╨ D | Z
• 實際上如果有許多共變項時，配對過程很麻煩，

Paul Rosenbaum及Donald Rubin在一系列的論

score）將是否會接受視為一種機率，然後以此

1
06.09.06
Propensity Score Matching（PSM）
• 如何得到傾向分數？
▫ 找到有意義可解釋是否會接受 treatment 的共變項
，然後做Logit 或 Probit 迴歸，應變項為是否接受
treatment。
• 根據傾向分數將接受者及不接受者進行配對，並

quality）。

1
06.09.06
Propensity Score Matching（PSM）
• 實際從事PSM的運算方法有四大類：
▫
▫
▫
▫
Exact Matching
Nearest Neighbor Matching
Interval Matching
Kernel Matching
• 不同運算方法的差異：
 With or without replacement
 How many units to match

1
06.09.06
Propensity Score Matching（PSM）
• 選擇不同運算法的兩難
▫ 要能 maximize 精準的配對（如用 strictly
“nearest” or common-support region）， 可能會

▫ 要能包括比較多的配對樣本個案 （如擴大配對的範

• 用bootstrapping方式求得PSM估計值的
standard errors

1
06.09.06
Propensity Score Matching（PSM）
• 實際可從事PSM的程式：
▫ Stata: psmatch2 等
▫ SPSS: SPSS Macro for Propensity Score Matching
(http://ssw.unc.edu/VRC/Lectures/index.htm)
▫ SAS: “GREEDY” Macro
(http://www2.sas.com/proceedings/sugi26/proceed.p
df)
▫ R: “MatchIt” (http://gking.harvard.edu/matchit/)

1
06.09.06

• 研究問題：國三補習數學有用嗎？
▫ ATT：如果國三補數學的人，沒補的話，數學成就會有

▫ ATU：如果國三沒補數學的人，補習的話，數學成就

▫ ATE：如果所有的人國三都補數學的話，數學成就會有

▫ 參考：關秉寅、李敦義（2008）。補習數學有用嗎？

。

1
06.09.06

• 研究使用的資料：TEPS 國中樣本（公開使用版）
▫ 2001（N ＝ 13,978 ）
▫ 2003（N ＝ 13,247 ）
▫ 分析樣本 ：公立國中生；with common support
（N ＝ 10,013 ）

1
06.09.06

• 應變項：國三數學能力 IRT，轉換成 NCE （normal
curve equivalence）分數(Range: 1 – 99; Mean: 50; S.D.:
21.06)
• 自變項（Treatment）：國三補習數學
• 26個配對變項：
▫ 個人特性及學習特質：性別、補習經驗、W1數學IRT等（
motivation, ability）
▫ 家庭背景：父母教育程度、職業、教育期待等
▫ 班級/學校學習氣氛及環境

1
06.09.06

• 分析策略：只研究國三數學補習的效果
▫ 國三補習主要是為了準備基測
▫ 學校教育對數學能力的培養比較有影響力
• 以階層性模型探討國三補習的參與及補習效果，

OLS及PSM兩者估計ATE可能有的差異
• 比較有及沒有W1數學IRT做為配對變項的差異

1
06.09.06

• 使用 Stata（version 9以上版本）的指令：psmatch2

• PSMATCH2: Stata module to perform full
Mahalanobis and propensity score matching, common
support graphing, and covariate imbalance testing (by
Edwin Leuven & Barbara Sianesi)
• Bootstrap 用來估計 standard error of the estimate

1
06.09.06

• use D:\w2w1all01, clear
• set seed 19123584
• psmatch2 w2s1102 w1s502 mathtime w1s535-w1s550 w1tms1 w1tms3 ///
w1s507d w2s1121d cram1-cram3 ethn2-ethn4 paedu2 paedu3 ///
paocc1-paocc2 w1p5152-w1p5154 nuintact sibsize ///
eduexp2 eduexp3 grouping w1s309-w1s318 w1urban32-w1urban33 ///
w1m3p29c, out(w2m3p28NCE) kernel common logit ate
• gen ps=_pscore

1
06.09.06

Logistic regression
Number of obs
LR chi2(36)
Prob > chi2
Pseudo R2
Log likelihood = -5939.0544

w2s1102
Coef.
w1s502
mathtime
w1s535
w1s536
w1s537
w1s550
w1tms1
w1tms3
w1s507d
w2s1121d
cram1
cram2
cram3
ethn2
ethn3
ethn4
paedu2
paedu3
paocc1
paocc2
w1p5152
w1p5153
w1p5154
nuintact
sibsize
eduexp2
eduexp3
grouping
w1s309
w1s315
w1s316
w1s317
w1s318
w1urban32
w1urban33
w1m3p29c
_cons
-.0833313
.1435434
-.0678964
-.0847454
.0680199
.0215024
-.4073255
.1107166
.0330961
-.8260525
-.7770591
-.4560749
-.2523984
.0328902
.0318565
-.6514906
.156507
-.4139991
.2022489
.0958511
.4493477
.8032888
1.006179
.2259083
-.0765143
.5042964
.6798024
-.0359304
.1079485
-.0107513
.0510998
-.0837422
.0036893
.3659348
.6316685
.1882496
-.2456198
Std. Err.
.0470693
.0508503
.0329894
.0342559
.0355634
.0245201
.0394947
.0365143
.0883917
.051729
.085213
.0871879
.1042133
.0702542
.0717653
.154933
.0575545
.1370291
.0589527
.0572689
.0872949
.0918514
.1108639
.0607856
.0194415
.0858112
.099277
.0581625
.0271998
.0282028
.0333087
.0298398
.0305617
.1112798
.1116324
.0308065
.2961725
z
-1.77
2.82
-2.06
-2.47
1.91
0.88
-10.31
3.03
0.37
-15.97
-9.12
-5.23
-2.42
0.47
0.44
-4.20
2.72
-3.02
3.43
1.67
5.15
8.75
9.08
3.72
-3.94
5.88
6.85
-0.62
3.97
-0.38
1.53
-2.81
0.12
3.29
5.66
6.11
-0.83
P>|z|
0.077
0.005
0.040
0.013
0.056
0.381
0.000
0.002
0.708
0.000
0.000
0.000
0.015
0.640
0.657
0.000
0.007
0.003
0.001
0.094
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.537
0.000
0.703
0.125
0.005
0.904
0.001
0.000
0.000
0.407
=
=
=
=
10039
2001.93
0.0000
0.1442
[95% Conf. Interval]
-.1755854
.0438787
-.1325545
-.1518857
-.0016831
-.0265561
-.4847336
.03915
-.1401485
-.9274395
-.9440735
-.62696
-.4566527
-.1048056
-.108801
-.9551536
.0437023
-.6825712
.0867038
-.0163939
.2782528
.6232635
.78889
.1067708
-.114619
.3361094
.485223
-.1499268
.0546378
-.0660278
-.0141841
-.1422271
-.0562106
.1478304
.412873
.12787
-.8261073
.0089228
.2432081
-.0032383
-.0176051
.1377229
.0695609
-.3299174
.1822832
.2063406
-.7246655
-.6100447
-.2851899
-.0481441
.1705859
.172514
-.3478275
.2693118
-.145427
.317794
.2080961
.6204425
.9833142
1.223468
.3450458
-.0384096
.6724833
.8743818
.078066
.1612592
.0445251
.1163838
-.0252572
.0635892
.5840392
.8504641
.2486292
.3348676
1
06.09.06

• 誰參加國三數學補習？
▫ 個人特性及學習特質：先備能力較佳、過去沒

▫ 家庭背景：非原住民、與雙親同住、父母不是

▫ 班級/學校情況：位於在都市化程較高地區、

1
06.09.06

• --------------------------------------------------------------------------------------------------------•
Variable Sample
| Treated
Controls
Difference
S.E.
T-stat
• --------------------------------------------------------------------------------------------------------w2m3p28NCE Unmatched | 57.1492421 44.4285175 12.7207246 .40052829 31.76
•
•
•
•
•
<observed> <potential> <outcome>
ATT | 57.1242786 54.866121 2.25815756 .479776217 4.71
ATU | 44.6844424 48.2644102 3.57996779
ATE |
2.95584959
----------------------------+---------------------------------------------------------------------------Note: S.E. for ATT does not take into account that the propensity score is estimated.
• psmatch2: | psmatch2: Common
• Treatment |
support
• assignment | Off suppo On suppor | Total
• --------------+---------------------------+---------• Untreated |
61
5,263 | 5,324
•
Treated |
7
4,708 | 4,715
• -------------+----------------------------+---------•
Total |
68
9,971 | 10,039

1
06.09.06

• pstest w2s1102 w1s502 mathtime w1s535-w1s550 w1tms1 w1tms3 ///
w1s507d w2s1121d cram1-cram3 w1m3p29c ethn2-ethn4 ///
paedu3 paocc1-paocc2 w1p5152-w1p5154 nuintact sibsize ///
eduexp2 eduexp3 grouping w1s309-w1s318 ///
w1urban32-w1urban33, summary treated(_treated)
Mean
Treated Control
%bias
%reduct
|bias|
0
0
.
.
.
.
.
.
.
.48802
.48774
.51014
.49835
-4.4
-2.1
52.0
-2.21
-1.03
0.027
0.304
Unmatched
Matched
.27996
.2798
.22746
.28553
12.1
-1.3
89.1
6.06
-0.62
0.000
0.538
Unmatched
Matched
2.0185
2.0205
2.1101
2.0085
-11.2
1.5
86.9
-5.58
0.72
0.000
0.470
Unmatched
Matched
2.2431
2.2459
2.3418
2.2336
-12.0
1.5
87.5
-5.98
0.73
0.000
0.465
Unmatched
Matched
1.9421
1.9437
2.0306
1.9238
-11.7
2.6
77.5
-5.85
1.30
0.000
0.193
Unmatched
Matched
2.2503
2.2485
2.0648
2.2687
19.2
-2.1
89.1
9.59
-0.99
0.000
0.324
Variable
Sample
w2s1102
Unmatched
Matched
1
1
Unmatched
Matched
w1s502
mathtime
w1s535
w1s536
w1s537
w1s550

t-test
t
p>|t|
1
06.09.06

Summary of the distribution of the abs(bias)
BEFORE MATCHING
1%
5%
10%
25%
50%
75%
90%
95%
99%
Percentiles
.6808444
1.474137
3.638223
7.567391
Smallest
.6808444
1.474137
2.777662
3.638223
12.08539
27.73524
32.9365
54.21405
55.57048
Largest
32.9365
32.98215
54.21405
55.57048
Obs
Sum of Wgt.
37
37
Mean
Std. Dev.
18.13108
13.64366
Variance
Skewness
Kurtosis
186.1494
.940569
3.57198
AFTER MATCHING
1%
5%
10%
25%
50%
75%
90%
95%
99%
Percentiles
.0326583
.2346073
.3174218
.7289222
Smallest
.0326583
.2346073
.3134599
.3174218
1.439995
1.782969
2.694701
2.900254
3.467881

Largest
2.694701
2.8343
2.900254
3.467881
Obs
Sum of Wgt.
37
37
Mean
Std. Dev.
1.366565
.8430323
Variance
Skewness
Kurtosis
.7107035
.5760441
2.674063
1
06.09.06

• set seed 19123584
• psmatch2 w2s1102, out(w2m3p28NCE) pscore(ps) mahal(w2stwt1) ///
-----------------------------------------------------------------------------------------------------------Variable Sample
| Treated Controls
Difference
S.E.
T-stat
--------------------------------------+--------------------------------------------------------------------------------w2m3p28NCE Unmatched | 57.1492421 44.4285175 12.7207246 .40052829 31.76
ATT | 57.1044268 54.9845736 2.11985317 .49239495 4.31
----------------------------+-------------------------------------------------------------------------------------------Note: S.E. for ATT does not take into account that the propensity score is estimated.

psmatch2: | psmatch2: Common
Treatment |
support
assignment | Off suppo On suppor | Total
-----------+---------------------------------------+---------Untreated |
0
5,324 |
5,324
Treated |
26
4,689 |
4,715
---------------+------------------------------------+---------Total |
26
10,013 |
10,039
1
06.09.06

• psgraph, bin(50) treated(_treated) support(_support) ///
pscore(_pscore)
▫ 檢視有 common support 的分析樣本的balance
0

.2
.4
.6
Propensity Score
Untreated
Treated: Off support
.8
1
Treated: On support
1
06.09.06

• bs r(att): psmatch2 w2s1102, out(w2m3p28NCE) pscore(ps) ///
Bootstrap results
Number of obs
Replications
=
=
10039
50
command: psmatch2 w2s1102, out(w2m3p28NCE) pscore(ps)
_bs_1: r(att)
---------------------------------------------------------------------------------------------| Observed Bootstrap
Normal-based
|
Coef.
Std. Err.
z
P>|z| [95% Conf. Interval]
---------+-----------------------------------------------------------------------------------_bs_1 | 2.11783 .4667819 4.54 0.000 1.202954 3.032706
------------------------------------------------------------------------------

1
06.09.06

• 國三補習數學有用嗎？
▫ Gross effect (OLS): 12.243（分析樣本with common support）
▫ After controlling all matching variables (OLS): 3.017 – an
estimate of ATE
• PSM results (all matching variables included):
▫ Total population (ATE): 2.956
▫ Treated (ATT): 2.258
▫ Untreated (ATU): 3.580

1
06.09.06

• 階層性模型分析結果顯示
▫ PSM的ATE估計大多比OLS的估計小
▫ ATT比ATU小
▫ 都會受到未納入重要自變項的影響

1
06.09.06

• PSM stratified by propensity scores





•
•
1st stratum (lowest)
2nd stratum
3rd stratum
4th stratum
5th stratum (highest)
3.519
4.063
3.384
1.997
2.950
1st – 3rd stratum
4th – 5th stratum
3.292
2.557

1
06.09.06

• PSM stratified by prior math ability scores







1st stratum (lowest)
2nd stratum
3rd stratum
4th stratum
5th stratum (highest)
1st – 3rd stratum
4th – 5th stratum

3.600
4.406
2.101
3.215
2.108
4.203
2.248
1
06.09.06

• PSM stratified by whose decision to undertake math
cramming
▫ Student’s own decision 2.281
▫ Decision made by others 1.429
• PSM stratified by parents’ education level
▫ High school
▫ College and above

4.712
1.371
1
06.09.06

•
•
•
•
•

TEPS數學IRT不是基測成績？

1
06.09.06

Q：如果 treatment（如補習）不只是接受

Group
YD1
Takes D1
Observable as Y
Counterfactual
…..
Counterfactual
Takes D2
Counterfactual
Observable as Y
…..
Counterfactual
…..
…..
…..
…..
Observable as Y
…..
Takes Dj
…..
Counterfactual

YD2
Counterfactual
…..
YDj
1
06.09.06

Q：如果解釋是否接受 treatment 的共變項

Selection on the observables vs.
Selection on the unobservables

1
06.09.06

• Sensitivity analysis
• 參考：
▫ DiPrete, T. A. & Gangl, M. (2004). Assessing bias
in the estimation of causal effects: Rosenbaum
bounds on matching estimators and instrumental
variables estimation with imperfect instruments.
Sociological Methodology, 34, 271–310.
▫ Caliendo, M. & Kopeinig, S. (2008). Some
Practical Guidance for the Implementation of
Propensity Score Matching. Journal of Economic
Surveys, 22, 31-72.

1
06.09.06

• 如果是否補習的機率是πi，且此機率不僅是為觀察到

• ui可設定介於0與1間，而γ是ui對參與補習的影響效

• Rosenbaum（2002）將兩人有同樣配對變項數值，

1
06.09.06

• gen delta = w2m3p28NCE - _w2m3p28NCE if _treated==1 & ///
_support==1
• rbounds delta, gamma(1 (0.05) 2)
Rosenbaum bounds for delta (N = 4689 matched pairs)
Gamma
sig+
sigt-hat+
t-hatCI+
CI---------------------------------------------------------------------1
0
0 2.53564 2.53564 2.01807 3.04954
1.05
4.4e-16
0 2.15427 2.91407 1.63508 3.42905
1.1
1.2e-11
0 1.78947 3.27694 1.26991 3.79062
1.15
3.8e-08
0 1.44109 3.62183 .920764 4.13528
1.2
.000018
0 1.10691 3.95152 .584407 4.46356
1.25
.001696
0 .787757 4.26565 .262282 4.77819
1.3
.03747
0 .478479 4.56627 -.048146 5.07914
1.35
.249543
0 .182048 4.85537 -.347525 5.36746
1.4
.651198
0 -.104479 5.13329 -.636678 5.64383
1.45
.921584
0 -.38144 5.40027 -.916216 5.90901
1.5
.991994
0 -.648689 5.65514 -1.1861 6.16496

1
06.09.06

• 針對國三補習數學者與從未補習者配對成功的4689

，是介於1.25到1.35時，就可能會變成不顯著。
• 取這些數值的自然對數，則分別為0.223及0.300 ，

，則此數值大約是完整家庭（nuintact）的係數（
.226）。也就是說，這未觀察到變項對補習與否的影

。

1
06.09.06
PSM其他限制
• 通常需要大樣本。
• Treat group 與 Control group 配對後應該有足夠

• 即使是以觀察到的變項進行配對，仍可能有
hidden bias 。

1
06.09.06

• 其他在selection on unobservables 時可用的

▫ instrumental variable
▫ Heckman selection model
▫ 利用長期追蹤資料的特性，使用如 fixed effect
model，change score model
• 不同的分析方法，要做不同的假定

1
06.09.06

• selection on unobservables
•
Z
•
D
•
U (unobservable)

Y
1
06.09.06

• 結合迴歸分析。
• 結合 multi-level modeling。

1
06.09.06

Q＆A

1
06.09.06
```