1 Star 0 Fork 1

侯新烁 / 侯新烁

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
DID-ddid-多期 DID.md 733 Bytes
一键复制 编辑 原始数据 按行查看 历史
连享会 提交于 2018-12-10 15:31 . 新任务

任务:介绍 Stata 新命令 help ddid,以便实现多期 DID 分析。该命令的帮助文件中有详细的 Stata 范例和参考文献。

*** SIMULATED DATA ***
. clear
. set obs 5
. set seed 10101
. gen id=_n
. expand 50
. drop in 1/5
. bys id: gen time=_n+1999
. gen D=rbinomial(1,0.4)
. gen x1=rnormal(1,7)
. tsset id time
  forvalues i=1/6{
  gen L`i'_x=L`i'.x
  }
. bys id: gen y0=5+1*x+ rnormal()
. bys id: gen y1=100+5*x+90*L1_x+90*L2_x+120*L3_x+100*L4_x+90*L5_x +90*L6_x + rnormal()
. gen A=6*x+rnormal()
. replace D=1 if A>=15
. replace D=0 if A<15
. gen y=y0+D*(y1-y0)
. tsset id time
. xi: ddid y D x , model(fe) pre(6) post(6) vce(robust) graph save_graph(mygraph)
1
https://gitee.com/HouXavier_admin/Hou_Xinshuo.git
git@gitee.com:HouXavier_admin/Hou_Xinshuo.git
HouXavier_admin
Hou_Xinshuo
侯新烁
master

搜索帮助