Git Product home page Git Product logo

ddtiming's Introduction

ddtiming

ddtiming is a Stata command that implements a decomposition of a difference-in-differences (DD) estimator with variation in treatment timing, based on Goodman-Bacon (2021). The two-way fixed effects DD model is a weighted average of all possible two-group/two period DD estimators. The command generates a scatterplot of 2x2 DD estimates and their associated weights.

Caution

ddtiming is not under active development. Stata users should instead use bacondecomp, a more recent implementation of the Bacon decomposition in Stata.

R Users

An R package called bacondecomp is available to perform the decomposition.

Installation

Type the following command:

net install ddtiming, from(https://raw.githubusercontent.com/tgoldring/ddtiming/master)

Alternatively, you can download the package from GitHub and install it manually.

Example - No-Fault Divorce Laws

ddtiming can replicate the example in Goodman-Bacon (2021). Download and load a dataset with the timing of no-fault divorce laws and female suicide rates (Stevenson & Wolfers, 2006):

net get ddtiming, from(https://raw.githubusercontent.com/tgoldring/ddtiming/master)

use nofault_divorce.dta

For comparison, estimate a two-way fixed effects DD model of female suicide on no-fault divorce reforms:

areg asmrs treat i.year, a(state) vce(robust)

Apply the DD decomposition theorem in Goodman-Bacon (2021) to the two-way fixed effects DD model:

ddtiming asmrs treat, i(state) t(year)

Stata will produce DD estimates, the associated weights, and a scatterplot of the estimates. The scatterplot replicates Fig. 6 in Goodman-Bacon (2021). Additionally, we can add options to the command to modify the look of the scatterplot:

ddtiming asmrs treat, i(state) t(year) ddline(lwidth(thick)) ///
ylabel(-30(10)30) legend(order(3 4 1 2)) savegraph(nfd.jpg) ///
savedata(nfd) replace

This command demonstrates the use of ddtiming's options (ddline, savegraph, savedata, and twoway options ylabel and legend). For descriptions of all options and additional help, type

help ddtiming

Citation

Please cite ddtiming as:

Goldring, T. (2019). ddtiming: Stata module to perform a Goodman-Bacon decomposition of difference-in-differences estimation. https://github.com/tgoldring/ddtiming

References

Goodman-Bacon, A. (2021). Difference-in-differences with variation in treatment timing. Journal of Econometrics, 225(2), 254-277.

Stevenson, B., & Wolfers, J. (2006). Bargaining in the Shadow of the Law: Divorce Laws and Family Distress. The Quarterly Journal of Economics, 121(1): 267-288.

ddtiming's People

Contributors

tgoldring avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.