xtreg y time treated pre_* current time_* i.year, fe est sto reg 结果为: 方法2 采用coefplot命令进行绘图,观察是否1994年前的回归系数均在0轴附近波动,在1994年后回归系数显著为负。 **coefplot reg, keep(pre_\* current post_\*) vertical recast(connect) yline(0) xline(3, lp(dash))** 结...
. reg waiting_all `income' worktime if any_time == 1, cluster(gestfips) //考虑州的集群方差 . est sto m3 //保存模型 输出结果:与only固定效应相比,系数变大了,标准误变小了(更容易显著),R方变小。 第二种,同时考虑固定效应&集群方差
此外,还可以将上述结果的系数和置信区间画出来,以更直观的形式展示结果,代码如下: est sto reg coefplot reg,keep(pre_* current time_*) vertical recast(connect) yline(0) xline(4,lp(dash))/// ytitle("政策效应") /// xtitle("时期 (pre_*政策前,current政策年,time_*政策后)") 3.3 安慰剂检...
如果i = 1(1)4,后续绘图时,pre_i的顺序会不一致 gen policy = year - 1994 forvalues i = 4(-1)1{ gen pre_`i' = (policy == -`i' & treat == 1) } // 回归计算 xtreg y pre_*, fe r // 绘制曲线图 est sto reg coefplot reg, keep(pre_*) vertical recast(connect) yline(0)...
est sto reg 采用coefplot命令进行绘图,观察是否1994年前的回归系数均在0轴附近波动,在1994年后回归系数显著为负。 coefplot reg, keep(pre_* current post_*) vertical recast(connect) yline(0) xline(3, lp(dash)) 结果发现系数在政策前的确在0附近波动,而政策后一年系数显著为负,但很快又回到0附近。这...
输入 reghdfe 被解释变量 主效应(DID),absorb(行政区划代码 年份)cluster(行政区划代码),然后用 est sto m1 存储结果。最后 esttab m1 using 基准回归.rtf,b(%12,4f) se(%12,4f) stats(N r2_a) nogap compress star(* 0.1 ** 0.05 *** 0.01) replace,把结果保存成 rtf 文件。🌟7. 平行趋势...
est sto m2在这里,我们使用了reghdfe命令,它允许我们在模型中包含高维度的固定效应。absorb(id year)表示我们吸收了id和year的固定效应,而vce(r)则表示我们使用稳健标准误。最后,我们使用outreg2命令将两个模型的结果输出到一个文档中,方便结果解读:stata ...
reg y x controls i.stkcd, cluster(stkcd)// 模型存在个体效应 reg y x controls i.year, cluster(stkcd)// 模型存在时间效应 xi: reg y x controls i.stkcd i.year, cluster(stkcd)// 加入xi,就是在加入虚拟变量的基础上还会创建这些虚拟变量,个人一般不用。
est sto reg CT检验1 可以看出Before3 Before2 Before1 的系数均不显著,After1的系数负向显著 **采用coefplot命令画图 ssc install coefplot coefplot reg,keep(Before3 Before2 Before1 Current After1 After2 After3) vertical recast(connect) yline(0) ...
est sto reg coefplot reg,keep(pre_* current time_*) vertical recast(connect) yline(0) xline(5,lp(dash)) ytitle("政策效应") xtitle("时期 (pre_*政策前,current政策年,time_*政策后)") *安慰剂检验一:提前政策时间 gen time_new = (year>=2015)&!missing(year) ...