|
一、半径(卡尺)匹配
psmatch2 x controls ,out(y) radius cal(0.01) ate ties logit common
pstest controls, both graph //考察匹配结果是否很好地平衡了数据
psgraph //柱状图 看on support部分越多 匹配的效果越好
drop if _weight == . //保留匹配成功样本
然后对保留的样本再进行回归,以下同理。
二、核匹配
psmatch2 x controls ,out(y) kernel ate ties logit common
pstest controls, both graph //考察匹配结果是否很好地平衡了数据
*核密度函数图
kdensity _pscore if durationA==1,addplot(kdensity _pscore if durationA==0) //匹配前命令 观测密度函数图
kdensity _pscore if durationA==1, addplot(kdensity _pscore if _wei!=.) //匹配后命令 若两个核函数图从差异很大变得很近似,说明效果好
drop if _weight == .
三、k邻近匹配 1:1匹配 & 1:4匹配
1:1
psmatch2 x controls ,out(y) logit ate n(1) common caliper(.05) ties
pstest controls, both graph
drop if _weight == . //保留匹配样本
1:4
psmatch2 x controls ,out(y) logit ate n(4) common caliper(.05) ties
pstest controls, both graph
gen pair1 = _id if _treated==0
replace pair1 = _n1 if _treated==1
gen pair2 = _id if _treated==0
replace pair2 = _n2 if _treated==1
gen pair3 = _id if _treated==0
replace pair3 = _n3 if _treated==1
bysort pair1: egen paircount1 = count(pair1)
bysort pair2: egen paircount2 = count(pair2)
bysort pair3: egen paircount3 = count(pair3)
egen byte paircount = anycount(paircount1 paircount2 paircount3), values(2)
drop if paircount==0 //保留匹配样本
至于您提的问题,建议看陈强的书高级计量经济学与stata,里面应该有很具体的说明。
|