大家好,又见面了,我是你们的朋友全栈君。
原标题:一文读懂倾向得分匹配法(PSM)举例及stata实现(一)
一、倾向匹配得分应用之培训对工资的效应
政策背景:国家支持工作示范项目( National Supported Work,NSW )
研究目的:检验接受该项目(培训)与不接受该项目(培训)对工资的影响。基本思想:分析接受培训组(处理组, treatment group )接受培训行为与不接受培训行为在工资表现上的差异。但是,现实可以观测到的是处理组接受培训的事实,而处理组没有接受培训会怎样是不可能观测到的,这种状态也成为反事实( counterfactual )。
匹配法就是为了解决这种不可观测事实的方法。在倾向得分匹配方法( Propensity Score Matching )中,根据处理指示变量将样本分为两个 组,一是处理组,在本例中就是在 NSW 实施后接受培训的组;二是对照组 ( comparison group ),在本例中就是在 NSW 实施后不接受培训的组。倾向得分 匹配方法的基本思想是,在处理组和对照组样本通过一定的方式匹配后,在其他 条件完全相同的情况下,通过接受培训的组(处理组)与不接受培训的组(对照 组)在工资表现上的差异来判断接受培训的行为与工资之间的因果关系。
注:本例节选自 Cameron&Trivedi 《微观计量经济学:方法与应用》(中译本,上海财经大学出版社, 2010 ) pp794-800 所有数据及程序均来自于本书的配套网站( http://cameron.econ.ucdavis.edu/mmabook/mmaprograms.html )。
二、变量介绍
描述性分析
tabulate t, summarize(re78) means standard
三、倾向匹配得分操作
数据介绍 :Data used by Lalonde (1986)We are interested in the possible effect of participation in a job training program on individuals earnings in 1978This dataset has been used by many authors ( Abadie et al. 2004,Becker and Ichino, 2002, Dehejia and Wahba, 1999).
四、详细介绍
set seed 20180105 //产生随机数种子
gen u=runiform
sort u //排序
或者order u
上述命令是为了生成伪随机数,满足01的均匀分布
localv1 “t”
localv2 “age edu black hisp married re74 re75 u74 u75”
globalx “`v1′ `v2′ “
psmatch2 $x, out(re78) neighbor(1) ate ties logit common // 1:1 匹配
$表示引用宏变量,
psmatch2 $x, out(re78) neighbor(1) ate ties logit common // 1:1 匹
等价于
psmatch2 t age edu black hisp married re74 re75 u74 u75, out(re78) neighbor(1) ate ties logit common
下面用pstest查看匹配效果是否较好的平衡了数据
psmatch2 tage edu black hisp married re74 re75 u74 u75, out(re78) neighbor(1) ate ties logit common // 1:1 匹
pstest age edu black hisp married re74 re75 u74 u75, both graph
psgraph
五、PSM命令简介
Stata does not have a built-in command for propensity score matching, a non-experimental method of sampling that produces a control group whose distribution of covariates is similar to that of the treated group. However, there are several user-written modules for this method. The following modules are among the most popular:
Stata没有一个内置的倾向评分匹配的命令,一种非实验性的抽样方法,它产生一个控制组,它的协变量分布与被处理组的分布相似。但是,这个方法有几个用户编写的模块。以下是最受欢迎的模块(主要有如下几个外部命令)
psmatch2.ado
pscore.ado
nnmatch.ado
psmatch2.ado was developed by Leuven and Sianesi (2003) and pscore.ado by Becker and Ichino (2002). More recently, Abadie, Drukker, Herr, and Imbens (2004) introduced nnmatch.ado. All three modules support pair-matching as well as subclassification.
You can find these modules using the .net command as follows:
net search psmatch2
net search pscore
net search nnmatch
You can install these modules using the .ssc or .net command, for example:
ssc install psmatch2, replace
After installation, read the help files to find the correct usage, for example:
help psmatch2
上述主要介绍了如何获得PSM相关的命令,总结一下目前市面上用的较好的命令为psmatch2.
PSM 相关命令
help psmatch2
help nnmatch
help psmatch
help pscore
持续获取最新的 PSM 信息和程序
findit propensity score
findit matching
psmatch2 is being continuously improved and developed. Make sure to keep your version up-to-date as follows
ssc install psmatch2, replace
where you can check your version as follows:
which psmatch2
语法格式
help psmatch2
psmatch2 depvar [indepvars] [if exp] [in range] [, outcome(varlist)
pscore(varname) neighbor(integer) radius caliper(real)
mahalanobis(varlist) ai(integer) population altvariance
kernel llr kerneltype(type) bwidth(real) spline
nknots(integer) common trim(real) noreplacement
descending odds index logit ties quietly w(matrix) ate]
where indepvars and mahalanobis(varlist) may contain factor variables;
see fvvarlist.
psmatch2 D x1 x2 x3, outcome(y)
pscore(varname) neighbor(integer) radius caliper(real)
mahalanobis(varlist) ai(integer) population altvariance
kernel llr kerneltype(type) bwidth(real) spline
nknots(integer) common trim(real) noreplacement
descending odds index logit ties quietly w(matrix) ate]
核匹配 (Kernel matching)
其他匹配方法
广义精确匹配(Coarsened Exact Matching) || help cem
局部线性回归匹配 (Local linear regression matching)
样条匹配 (Spline matching)
马氏匹配 (Mahalanobis matching)
◆◆◆◆
点击上图查看:
Stata寒假研讨班_2020年1月15日——1月18日_第14届“高级计量经济学及stata应用”研讨班@北京专场返回搜狐,查看更多
责任编辑:
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/128527.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...