代码拉取完成,页面将自动刷新
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)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。