Skip to content

tgoldring/ddtiming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Bacon decomposition of a diff-in-diff estimator with variation in treatment timing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published