文章预览
DID方法
gen time = (year >= 77) & !missing(year)
gen treated = (idcode >2000)&!missing(idcode)
gen did = time*treated
reg ln_w did time treated $xlist //OLS回归,也可以用diff命令
* diff outcome_var [if] [in] [weight] ,[ options]
*diff fte, t(treated) p(t) cov(bk kfc roys)
xtreg ln_w did time treated $xlist i.year, fe //固定效应模型
PSM-DID方法
** PSM的部分
set seed 0001
gen tmp = runiform()
sort tmp
psmatch2
treated
$xlist, out(ln_w) logit ate neighbor(1) common caliper(.05) ties //通过近邻匹配,这里可以要outcome,也可以不要它
pstest $xlist, both graph //检验协变量在处理组与控制组之间是否平衡
gen common=_support
drop if common == 0 //去掉不满足共同区域假定的观测值
psgraph
** DID的部分,根据上面匹配好的数据
treated
reg ln_w did time
treated
$xlist
xtreg ln_w did time
treated
$xlist i.year, fe
**命令teffects psmatch 和psmatch2也可以实现倾向得分匹配,但是后者报告的标准误估计是错误的
………………………………