teffect psmatch结合前两篇文章在stata里画图和用psmatch2提取匹配好的数据的do file

use http://ssc.wisc.edu/sscc/pubs/files/psm, clear
teffects psmatch (y) (t x1 x2), gen(match1)
gen ob=_n
save psmdata, replace
keep if t //保留实验组
keep match1 //保留实验的match1
bysort match1: gen weight=_n //计算实验组匹配了多少次
by match1: keep if _n==1 //只保留n=1的实验组
ren match1 ob //重命名
merge 1:m ob using fulldata
replace weight=1 if t //
reg y x1 x2 t [fweight=weight]
pstest x1 x2, both row mweight(weight) t(t)
pscore t x1 x2, pscore(pscore) //评分
psgraph, t(t) pscore(pscore) //画图

teffect psmatch结合前两篇文章在stata里画图和用psmatch2提取匹配好的数据的do file_第1张图片

你可能感兴趣的:(stata,teffect,psmatch,pscore,画图,dofile)