【应用计量系列100】随机交错处理下,更有效率的估计量及其stata操作

参考文献:Jonathan Roth and Pedro H.C. Sant’Anna. 2023. Efficient Estimation for Staggered Rollout Designs. Journal of Political Economy Microeconomics,Conditionally Accepted.

最近几年,计量经济学领域最火的估计就是交错处理可能带来的异质性处理效应,以及一些新的异质性处理效应稳健估计量(Callaway and Sant’Anna, 2021; de Chaisemartin and D’Haultfœuille, 2020; Sun and Abraham, 2021)。

这些估计量通常是在DID的环境中来讨论交错处理情形。DID需要为平行趋势假设提供经验证据,一种方式就是讨论处理时点是随机配置的——这是一种更强假设。在有些情形下,可以确认处理时点是随机配置的,例如,Wood et al.(2020)的警察执法培训。而在另一些情形下,处理时点并非随机的,但研究者认为是准随机的,例如,Deshpande and Li(2019) 的社会保障办公室关闭。还有很多其它例子,参见Roth and Sant' Anna(2023)。

在RS(2023)的文章中,作者从理论上证明,如果处理时点是(准)随机配置的,那么,我们可以获得比上述交叠DID估计量更精确的处理效应估计量。他们推导出了最有效率的估计量,并展示了基于t统计量和perimutation的推断。他们文章的实践含义在于,只要我们用随机处理检验来为平行趋势假设提供经验证据的话,使用RS(2023)估计量会极大地降低标准误。

因此,在实践应用中,我们可以在随机处理检验,并通过该检验后,使用RS估计量来帮助识别出更精确的处理效应

下面,我们来看一个例子:
在美国,降低警察暴力是一个重要的社会目标。Wood et al.(2020)研究了芝加哥警察局在不同时点举行的程序正义培训班对警察投诉和警察暴力的影响。数据集是平衡面板。

首先,安装RS估计量的stata命令:

local github https://raw.githubusercontent.com
net install staggered, from(`github'/mcaceresb/stata-staggered/main) replace

注:如果在线安装不了,可以去https://github.com/mcaceresb/stata-staggered下载,然后离线安装。
命令格式:

staggered depvar , i(individual) t(time) g(cohort) estimand()  [options]
image.png

加载数据:

* 加载数据
use F:\pj_officer_level_balanced.dta,clear

su
image.png

其中,uid是个体变量,period是时间变量,first_trained是同一处理时点类别变量,complaints是结果变量。

RS(2023)的stata命令staggered提供了三种方式来加总类别和时期间的处理效应:简单加权平均、时期加权平均和类别加权平均处理效应(详见RS(2023)的2.3节内容):

① 计算简单加权平均估计量
staggered complaints, i(uid) t(period) g(first_trained) estimand(simple)

image.png
② 计算类别加权估计量
staggered complaints, i(uid) t(period) g(first_trained) estimand(cohort)

image.png
③ 计算时期加权估计量
staggered complaints, i(uid) t(period) g(first_trained) estimand(calendar)
image.png
④ 计算事件研究估计量
staggered complaints, i(uid) t(period) g(first_trained) estimand(eventstudy) eventTime(0/23)

*做出事件研究图
tempname CI b
mata st_matrix("`CI'", st_matrix("r(table)")[5::6, .])
mata st_matrix("`b'",  st_matrix("e(b)"))
matrix colnames `CI' = `:rownames e(thetastar)'
matrix colnames `b'  = `:rownames e(thetastar)'
coefplot matrix(`b'), ci(`CI') vertical yline(0)
* graph export test/StaggeredEventStudy.png, replace
事件研究图

除了上述t统计量推断外,还可以使用permutation推断。这些检验是基于studentized统计量。原假设:没有处理效应。

* Calculate efficient estimator for the simple weighted average
* Use Fisher permutation test with 500 permutation draws
staggered complaints, i(uid) t(period) g(first_trained) estimand(simple) num_fisher(500)

* All results are also saved in a matrix called e(results)
matlist e(results)

我们还可以结合上面提到的多个命令:

staggered complaints, i(uid) t(period) g(first_trained) estimand(eventstudy simple) eventTime(0/4) num_fisher(500)

上述命令结果得到简单加权估计量和事件研究估计量,并进行permutation推断。

于此同时,staggered命令还可以使用CS(2021)估计量和SA(2021)估计量:

* Calculate Callaway and Sant'Anna estimator for the simple weighted average
staggered complaints, i(uid) t(period) g(first_trained) estimand(simple) cs

* Calculate Sun and Abraham estimator for the simple weighted average
staggered complaints, i(uid) t(period) g(first_trained) estimand(simple) sa

更多的命令说明:https://github.com/mcaceresb/stata-staggered

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容