matlab双重差分模型,Stata+Eviews+R:倍分法双重差分操作
教程
双重差分法(Difference-in-difference,DID)有⼏种其他的称谓:倍差法、差分再差分等。该⽅法的原理⾮常简单,它要求数据期⾄少有两期,所有的样本被分为两类:实验组和控制组,其中实验组在第⼀期是没有受到政策影响,此后政策开始实施,第⼆期就是政策实施后的结果,控制组由于⼀直没有受政策⼲预,因此其第⼀期和第⼆期都是没有政策⼲预的结果。双重差分⽅法的测算也⾮常简单,两次差分的效应就是政策效应。
案例背景:在这个案例中,研究新泽西州最低⼯资的提⾼对快餐业就业⽔平的影响。⽐较了这⼀组餐馆员⼯⼈数的变化与相邻的宾⼣法尼亚州的对照组。
2
Eviews操作之双重差分
1、调⽤数据
⾸先我们读⼊所需数据
2、⽣成交互项,命令为:
⽣成政策前后以及控制组虚拟变量,并将它们相乘产⽣交互项。
genr did =tr*t
3、进⾏双重差分操作
命令为:ls fte did tr t c
4、操作⽅法⼆:
bootstrapped结果解释:
下⾯进⾏扩展的DID模型分析。
3
R双重差分操作指南
代码为
结果为:
4
Stata操作之双重差分
命令为:
模型必选项介绍:
outcome_var :结果变量
period(varname) :实验期变量
treated(varname) :处理变量
cov(varlist) :协变量。
可选项介绍:
cov(varlist),协变量,加上kernel可以估计倾向得分
kernel, 执⾏双重差分倾向得分匹配
id(varname),kernel选项要求使⽤
bw(#) ,核函数的带宽,默认是0.06
ktype(kernel),核函数的类型.
rcs Indicates that the kernel is set for repeated cross section. This option does not require option id(varname). Option rcs strongly assumes that covariates in cov(varlist) do not vary over time.
qdid(quantile),执⾏分位数双重差分
pscore(varname) .提供倾向得分
logit,进⾏倾向得分计算,默认probit回归
ddd(varname),三重差分
数据结构如下:
1、DID with no covariates不带协变量的估计
diff fte, t(treated) p(t)
bootstrapped 稳健标准误
2、DID with covariates带协变量的估计
diff fte, t(treated) p(t) cov(bk kfc roys)
diff fte, t(treated) p(t) cov(bk kfc roys) report
diff fte, t(treated) p(t) cov(bk kfc roys) report bs
3、Kernel Propensity Score Diff-in-Diff
diff fte, t(treated) p(t) cov(bk kfc roys) kernel rcs
diff fte, t(treated) p(t) cov(bk kfc roys) kernel rcs support
diff fte, t(treated) p(t) cov(bk kfc roys) kernel rcs support addcov(wendys)
diff fte, t(treated) p(t) kernel rcs ktype(gaussian) pscore(_ps)
diff fte, t(treated) p(t) cov(bk kfc roys) kernel rcs support addcov(wendys) bs reps(50)
4、 Quantile Diff-in-Diff 分位数双重差分法
diff fte, t(treated) p(t) qdid(0.25)
diff fte, t(treated) p(t) qdid(0.50)
diff fte, t(treated) p(t) qdid(0.75)
diff fte, t(treated) p(t) qdid(0.50) cov(bk kfc roys)
diff fte, t(treated) p(t) qdid(0.50) cov(bk kfc roys) kernel id(id)diff fte, t(treated) p(t) qdid(0.50) cov(bk kfc roys) kernel rcs 5、Balancing test of covariates.包含协变量的控制组与实验组之间差异检验
diff fte, t(treated) p(t) cov(bk kfc roys wendys) test
diff fte, t(treated) p(t) cov(bk kfc roys wendys) test id(id) kernel
diff fte, t(treated) p(t) cov(bk kfc roys wendys) test kernel rcs
6. Triple differences (consider bk is a second treatment category).
三重差分法
diff fte, t(treated) p(t) ddd(bk)
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论