# DID **Repository Path**: econometric/did ## Basic Information - **Project Name**: DID - **Description**: DID资源推荐 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2021-12-16 - **Last Updated**: 2022-07-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 欢迎光临! 这个存储库跟踪DID文献的最新发展。它有两个目的。首先,它是一个有组织的转储我的书签从Twitter, GitHub, YouTube等。这里的目的是跟踪DiD进展。第二是从终端用户的角度理解不同的包。这一部分是关于如何在我们的研究工作中应用这些方法。在理论方面,已经存在几个真正有用的注释(请参阅参考资料部分)。 我会继续增加这个网站的内容。它可能包含错误或者语言不够精确。这可能反映了我自己对正在发生的事情的理解不足。所以请给予反馈!这个存储库的目的是共同构建我们都可以使用的注释和代码库。 以下是我个人的一些想法(这些想法也会随着时间的推移而改变): # 发生了什么事?DID 一些DDID方面创新在2020年和2021年同时出现,导致了网上的集体混乱。这篇新did文献的核心是一个前提,即经典的双向固定效应(TWFE)模型对治疗效果给出了错误的估计。如果处理是异质性的(不同的处理时间,不同的处理规模,不同的处理状态随着时间的推移),这尤其正确,这可能会导致“负权重”,稀释真正的处理效果。通过比较晚期治疗组与早期治疗组、治疗组与未治疗组的组合,可以得出负权重。也有广泛的共识,即这些偏见仍然存在,即使治疗没有交错。 从抨击TWFE开始,不同的DiD包使用不同的方法创新来“纠正”TWFE的偏差。在这些包中有处理不同DiD方面的不同方法,如平行趋势、负权重和协变量。因此,在不同的包中使用了各种方法,包括自举、逆概率权重、匹配、影响函数和impuations。 这里也存在着我自己的困惑,即使用哪个包来解决哪个问题。根据网上的对话,似乎所有的研究问题都归结为我们真正想要估计的。这使得用于分析的包选择有点主观。希望专家们会写更多关于比较每个包的效用的文章。但在撰写本文时,预计未来几个月将出现更多的创新。 # 我们为什么要用DiD? 因为并不是所有的东西都能用随机对照试验来评估。尽管随机对照试验在方法上非常干净,但它们有很高的时间和金钱成本。此外,它们需要一定程度的社会和政治资本来执行,尤其是在发展中国家。相比之下,像iv和rd等准实验方法的应用则很难找到。这使得did在适用性方面成为一种非常强大的方法。如果可以获得详细的主要或次要微观数据,也相对容易找到具有不同时间的干预措施(基本上是所有的政策实施)。因此,从数据到结果的转换相当快(与rcts相比),而且交错处理图在视觉上非常容易解释。此外,我的预感是,TWFEs发现的方法论问题,导致了新的DiD论文,也将在未来几年溢出到IV和RDD论文中。因此,现在这些DiD文献将为跟踪即将到来的方法创新提供坚实的基础。 # 信息 这是一个工作文档。如果您想报告错误或贡献,只需打开一个问题,或开始讨论,或发送电子邮件到asjadnaqvi@gmail.com。由于路径和链接也可能更改,请报告它们,以保持这个库尽可能最新。我可能会在帖子下面增加一个讨论区,以便直接评论。 我会用一些Stata代码慢慢建立这个网站。这是为了帮助我(和您)浏览文献并找出不同包的代码结构。 # Stata中关于DID的包 包是按名字的字母顺序排序的。有些包路径被跨行分隔,但添加了空格以保持表格式的完整性。只需确保在Stata中复制它们时,它们在一行中并删除空格。要从GitHub安装包,获取GitHub包:net install github, from("https://haghish.github.io/github/")。Stata包的文档通常在内部帮助文件上完成。有些包确实有专门的网站、pdf或GitHub存储库,它们在网站栏中被识别出来。否则,检查具有专用页面的等价R包。 1 | Name | Installation | Website | Package by | Reference paper | | -------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | `bacondecomp` | `ssc install bacondecomp, replace` or older version: `net install ddtiming, from (https://tgoldring.com/code/)` | | Andrew Goodman-Bacon Thomas Goldring Austin Nichols | Andrew Goodman-Bacon (2021). Difference-in-differences with variation in treatment timing. Journal of Econometrics | | `csdid` | `ssc install csdid, replace` | [Link](https://friosavila.github.io/playingwithstata/main_csdid.html) | Fernando Rios-Avila Pedro H.C. Sant’Anna | Brantly Callaway, Pedro H.C. Sant’Anna (2020). Difference-in-Differences with multiple time periods, Journal of Econometrics. | | `did2s` | `ssc install did2s, replace` | [Link](https://github.com/kylebutts/did2s_stata) | Kyle Butts | [John Gardner](https://jrgcmu.github.io/) (2021). [Two-stage differences in differences](https://jrgcmu.github.io/2sdd_current.pdf). | | `did_multiplegt` | `ssc install did_multiplegt, replace` | | Clément de Chaisemartin Xavier D’Haultfoeuille | Clément de Chaisemartin, Xavier D’Haultfoeuille (2020). [Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects](https://www.aeaweb.org/articles?id=10.1257/aer.20181169). American Economic Review. Clément de Chaisemartin, Xavier D’Haultfoeuille (2021). [Two-way fixed effects regressions with several treatments](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3751060). Clément de Chaisemartin, Xavier D’Haultfoeuille (2021). [Difference-in-Differences Estimators of Inter-temporal Treatment Effects](https://arxiv.org/abs/2007.04267). | | `did_imputation` | `ssc install did_imputation, replace` | [Link](https://github.com/borusyak/did_imputation) | Kirill Borusyak Xavier Jaravel Jann Spiess | Kirill Borusyak , Xavier Jaravel , Jann Spiess (2021). Revisiting Event Study Designs: Robust and Efficient Estimation. | | `drdid` | `ssc install drdid, replace` | [Link](https://friosavila.github.io/playingwithstata/main_drdid.html) | Fernando Rios-Avila Pedro H.C. Sant’Anna Asjad Naqvi | Pedro H.C. Sant’Anna , Jun Zhao (2020). Doubly robust difference-in-differences estimators, Journal of Econometrics. | | `eventdd` | `ssc install eventdd, replace` | [Link](https://www.damianclarke.net/computation/) | Damian Clarke Kathya Tapia | [Damian Clarke](http://www.damianclarke.net/), Kathya Tapia Schythe (2020). [Implementing the Panel Event Study](http://ftp.iza.org/dp13524.pdf). | | `eventstudyinteract` | `ssc install eventstudyinteract, replace` | [Link](https://github.com/lsun20/EventStudyInteract) | [Liyang Sun](http://economics.mit.edu/grad/lsun20) | [Liyang Sun](http://economics.mit.edu/grad/lsun20), [Sarah Abraham](https://www.cornerstone.com/Staff/Sarah-Abraham#) (2020). [Estimating dynamic treatment effects in event studies with heterogeneous treatment effects](https://www.sciencedirect.com/science/article/abs/pii/S030440762030378X). Journal of Econometrics. | | `flexpaneldid` | `ssc install flexpaneldid, replace` | [Link](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3692458) | [Eva Dettmann](https://www.iwh-halle.de/en/about-the-iwh/team/detail/eva-dettmann/) [Alexander Giebler](https://www.iwh-halle.de/ueber-das-iwh/team/detail/alexander-giebler/) [Antje Weyh](https://www.iab.de/754/section.aspx/Mitarbeiter/359) | [Eva Dettmann](https://www.iwh-halle.de/en/about-the-iwh/team/detail/eva-dettmann/), [Alexander Giebler](https://www.iwh-halle.de/ueber-das-iwh/team/detail/alexander-giebler/), [Antje Weyh](https://www.iab.de/754/section.aspx/Mitarbeiter/359) (2020). [Flexpaneldid: A Stata Toolbox for Causal Analysis with Varying Treatment Time and Duration](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3692458). IWH Discussion Papers No. 3/2020 | | `stackedev` | `github install joshbleiberg/stackedev` | [Link](https://github.com/joshbleiberg/stackedev) | [Joshua Bleiberg](https://sites.google.com/view/joshbleiberg) | Doruk Cengiz , Arindrajit Dube , Attila Lindner, Ben Zipperer (2019). The effect of minimum wages on low-wage jobs. The Quarterly Journal of Economics. | | `staggered_stata` | `github install jonathandroth/staggered_stata` | [Link](https://github.com/jonathandroth/staggered#stata-implementation) | Jonathan Roth | Jonathan Roth , Pedro H.C. Sant’Anna (2021). Efficient Estimation for Staggered Rollout Designs | | `xtevent` | `ssc install xtevent, replace` | [Link](https://www.nber.org/papers/w29170) | Simon Freyaldenhoven Christian Hansen Jorge Perez Perez Jesse M. Shapiro | [Simon Freyaldenhoven](https://simonfreyaldenhoven.github.io/), [Christian Hansen](https://voices.uchicago.edu/christianhansen/), [Jesse M. Shapiro](https://www.brown.edu/Research/Shapiro/) (2019). [Pre-event Trends in the Panel Event-Study Design](https://www.aeaweb.org/articles?id=10.1257/aer.20180609). American Economic Review. | # 如何使用Stata软件包? 对于各个包,请查看它们的帮助文件以获取文档和示例。我已经开始将一些Stata代码放在注释和代码部分。但这需要一段时间才能完成。 对于在Stata中使用和绘制多个DiD包,强烈推荐Kirill Borusyak的event_plot命令(ssc install event_plot, replace)。它估计并组合来自五个不同估计的结果。在GitHub上的five_estimators_example.do文档中给出了如何使用不同包绘制事件研究图的示例 event_plot的用法示例已经被扩展了两次: David Burgherr在Dropbox上有一份文件。 Pietro Santoleri在GitHub上有一份文件,列出了七个不同的估算值。 Scott Cunningham将样本dofile作为CodeChella DiD事件的一部分。 ## Videos and online lectures Ben Elsner在YouTube上有一个关于因果推理的系列讲座,包括新的DiD文献。 Jorge Perez和他的合著者在YouTube上进行了一系列关于事件研究的讲座(参见Stata部分中的xtevent),包括以下一系列视频: - Jesse Shapiro, Christian Hansen: [Introduction to Linear Panel Event-Study Designs](https://www.youtube.com/watch?v=hOIB3PwntYg&list=PLg-LvQ_7SfMD9d8kbSd_Ig_HB-5h6HCTx&index=1) - Jorge Perez Perez: [Event-Study Plots: Basics](https://www.youtube.com/watch?v=pAOhWWiuhM8&list=PLg-LvQ_7SfMD9d8kbSd_Ig_HB-5h6HCTx&index=2) - Simon Freyaldenhoven: [Event-Study Plots: Suggestions](https://www.youtube.com/watch?v=PfMXAC3OGow&list=PLg-LvQ_7SfMD9d8kbSd_Ig_HB-5h6HCTx&index=3) - Simon Freyaldenhoven: [Approaches without Proxies or Instruments](https://www.youtube.com/watch?v=pXJisUpHi7Q&list=PLg-LvQ_7SfMD9d8kbSd_Ig_HB-5h6HCTx&index=4) - Jorge Perez Perez: [Approaches with Proxies or Instrumental Variables](https://www.youtube.com/watch?v=-HvaBoLhIMc&list=PLg-LvQ_7SfMD9d8kbSd_Ig_HB-5h6HCTx&index=5) - Jorge Perez Perez: [Performance of Different Estimators](https://www.youtube.com/watch?v=aZCXxwUQH7U&list=PLg-LvQ_7SfMD9d8kbSd_Ig_HB-5h6HCTx&index=6) - Simon Freyaldenhoven: [Heterogeneous Policy Effects](https://www.youtube.com/watch?v=P-nAUIyhujY&list=PLg-LvQ_7SfMD9d8kbSd_Ig_HB-5h6HCTx&index=7) Josh Angrist(麻省理工学院)有一个关于DID的动画视频。 Paul Goldsmith-Pinkham有一组关于实证方法的精彩幻灯片,包括GitHub上的DiD。他还通过YouTube系列讲座补充了这些内容。 Taylor J. Wright组织了一个在线DiD阅读小组。这些讲座可以在YouTube上观看。下面是他们出现顺序的播放列表: - Andrew Goodman-Bacon: [Difference-in-Differences with Variation in Treatment Timing](https://www.youtube.com/watch?v=m1xSMNTKoMs&list=PLVObvb_htcuBt8mV9yNagt7hK9FL5KXeE). *27 April 2021*. - Jonathan Roth: [Testing and Sensitivity Analysis for Parallel Trends](https://www.youtube.com/watch?v=F8C1xaPoRvM&list=PLVObvb_htcuBt8mV9yNagt7hK9FL5KXeE&index=2). *10 May 2021*. - Pedro H.C. Sant’Anna: [Difference-in-Differences with Multiple Time Periods](https://www.youtube.com/watch?v=VLviaylakAo&list=PLVObvb_htcuBt8mV9yNagt7hK9FL5KXeE&index=3). *15 May 2021*. - Akash Issar: [Two-way fixed effects estimators with heterogeneous treatment effects](https://www.youtube.com/watch?v=xA8dmXfucoE&list=PLVObvb_htcuBt8mV9yNagt7hK9FL5KXeE&index=4). *11 June 2021*. - Kirill Borusyak: [Revisiting Event Study Designs: Robust and Efficient Estimation](https://www.youtube.com/watch?v=rdfTxWnudt4&list=PLVObvb_htcuBt8mV9yNagt7hK9FL5KXeE&index=5). *13 June 2021*. - Kyle Butts: [Difference-in-Differences with Spatial Spillovers](https://www.youtube.com/watch?v=nZrsaqG9FI4&list=PLVObvb_htcuBt8mV9yNagt7hK9FL5KXeE&index=6). *29 June 2021*. - John Gardner: [Two-stage differences in differences](https://www.youtube.com/watch?v=6mVfQkmpghY&list=PLVObvb_htcuBt8mV9yNagt7hK9FL5KXeE&index=7). *11 July 2021*. - Brantly Callaway: [Difference-in-Differences with a Continuous Treatment](https://www.youtube.com/watch?v=mbEJuCFCgXo&list=PLVObvb_htcuBt8mV9yNagt7hK9FL5KXeE&index=8). *6 August 2021*. - Clément de Chaisemartin: [Two-way Fixed Effects Regressions with Several Treatments](https://www.youtube.com/watch?v=UHeJoc27qEM&list=PLVObvb_htcuBt8mV9yNagt7hK9FL5KXeE&index=9). *4 September 2021*. [Chloe East](https://www.chloeneast.com/)组织了一个在线DiD阅读小组。