*! version 1.0 16mar2020

Title

eventcoefplot -- Advanced event-study graphical analysis

Syntax

eventcoefplot
varname [if] [in] , window(varlist)
[options]

varname is the outcome variable's name.

options

Required options
window1(varlist) event dummies to be plotted, interactions are not allowed. E.g. "period_-2 period_-1 period_0 period_1 period2"

Window1 MUST be specified. Eventcoefplot uses as xlabel labels of variables, if available, varnames otherwise

Other options
command shows the implied regression command; recommended for first-time users

event(varname) variable included in window, corresponding to the event. When included adds a 0 estimate (a "gap") before the event

gapname(string) xlabel for the coefficient included above

noconstant no constant included in all specifications

level(#) set confidence level; default is level(95)

Specifications comparison options
The following options can be used to compare up to 3 models, by adding the model number at the end, e.g.: treatment1() treatment2() treatment3().

If the number is not specified, the option is used for model 1 (e.g. controls()=controls1()). Depending on the syntax models can use reghdfe or ivreghdfe.

absorb#(varlist) fixed effects to be included in the regression (controls should always be included in the controls opt)

controls#(varlist) control variables to be included in the regression

cluster#(varname) clustered standard errors

vce#(robust) robust standard errors

aweight#(varname) include aweights

fweight#(varname) include fweights

Robustness tests options - CAN BE COMPUTATIONALLY INTENSIVE

Eventcoefplot can potentially compare thousands of specifications, with an easy to read graphical output. If the number of specifications/estimates exceeds the limit, consider reducing it by grouping or creating random subsamples.

The tests options refer to the options for specification 1.

display regressions are not run quietly, for tests, when this option is included

multitest(globalsnames) plots the regressions including separately the set of controls included in the list. Elements of the list must be names of globals previously saved

tuplestest(varlist) plots the regressions including separately all the possible tuples of the variables in varlist

leaveoneouttest(varlist) plots the regressions excluding one of the controls from the list at the time

perturbationtest(varname) plots the regressions dropping from the sample each time a different "levelsof" varname and generates a diagnostics table on the stability of the sample

Graph options
Eventcoefplot specific options

speccolor#(color) changes color for specification#

symbols when included, the specifications use different symbols (black and white friendly)

symbol# changes symbol for the # spec, can be used together with symbols

testcicolor(color) color of the confidence intervals for the tests

testcoefcolor(color) color of the coefficients in the tests

General graph options

Note that x-axis options are based on the matrix position (that is 1,..,number of estimates), not the label value

offset(filename) set offset between specifications in the basic comparison

legend(filename) controls legend. Default is: legend(1 "Specification 1" 2 "Specification 2" 3 "Specification 3") Input "off" to turn off default lines

title(string) controls axis titles, standard options apply

label(string) controls axis labels, standard options apply

line(string) adds xlines or ylines, standard suboptions apply. Input "off" to turn off default lines

size(string) regulates length and height of the graph

Save Output
savegraph(file) saves all the tables, file has to be of format path/filename.csv

savetex(file) saves a table in .tex format; not allowed for tests; file has to be of format path/filename

Examples of main features

I recommend users to look at these examples directly from the package example .do file

* Load and prepare data

webuse nlswork, clear

keep if inlist(year, 69,71,73,75,77)

gen pre_2=year==69

gen pre_1=year==71

gen post_1=year==75

gen post_2=year==77

* Examples of specifications comparison

* Periods can be included in the preferred way in window()

eventcoefplot ln_wage, window(pre_2 pre_1 post_1 post_2) noconstant legend(off) controls(race birth_yr collgrad south)

* Command is a first-time-users friendly option to show in the console a draft of the regression being run. Signalling the event(), adds a zero estimate before the event (not needed depending on the lags)

eventcoecommandfplot ln_wage, window(pre_2 pre_1 post_1 post_2) noconstant legend(off) command controls(race birth_yr collgrad south) event(post_1) xline(3, lpattern(dash) lcolor(gray))

* Adding labels, eventcoepflot automatically uses them for the xlabels

label var pre_2 "-3"

label var pre_1 "-2"

label var post_1 "0"

label var post_2 "1"

* We compare here a second spec with robust S.E.. Gapname changes the name of the zero estimate.

eventcoefplot ln_wage, window(pre_2 pre_1 post_1 post_2) noconstant event(post_1) gapname(-1) xline(3, lpattern(dash) lcolor(gray)) command controls1(race birth_yr collgrad south) speccolor1(black) controls2(race birth_yr collgrad south) speccolor2(red) vce2(robust)

* We compare here a third spec with more FE's. Symbols is a black and white friendly option.

eventcoefplot ln_wage, window(pre_2 pre_1 post_1 post_2) noconstant event(post_1) gapname(-1) xline(3, lpattern(dash) lcolor(gray)) command symbols controls1(race birth_yr collgrad south) vce1(robust) controls2(race birth_yr collgrad south) absorb2(idcode) vce2(robust) controls3(race birth_yr collgrad south) absorb3(idcode occ) vce3(robust) legend(1 "Baseline" 2 "ID FE's" 3 "ID + Occupation FE's")

* Tests

* Tuplestest runs all the tuples of the included controls, separately.

eventcoefplot ln_wage, window(pre_2 pre_1 post_1 post_2) noconstant legend(off) event(post_1) xline(3, lpattern(dash) lcolor(gray)) command controls(age) tuplestest(race birth_yr collgrad south)

* Leaveoneouttest leaves out one of the controls at the time

eventcoefplot ln_wage, window(pre_2 pre_1 post_1 post_2) noconstant legend(off) event(post_1) xline(3, lpattern(dash) lcolor(gray)) command controls(age) leaveoneouttest(race birth_yr collgrad south)

* Multitest includes one set of controls at the time

global cov1 "race birth_yr"

global cov2 "collgrad south"

eventcoefplot ln_wage, window(pre_2 pre_1 post_1 post_2) noconstant legend(off) event(post_1) xline(3, lpattern(dash) lcolor(gray)) command controls(age) multitest(cov1 cov2)

* Perturbationtest excludes one sub-sample at the time, based on the levelsof() of the variable. Tests look can be adjusted

eventcoefplot ln_wage, window(pre_2 pre_1 post_1 post_2) noconstant legend(off) event(post_1) xline(3, lpattern(dash) lcolor(gray)) command controls(age race birth_yr collgrad south) perturbationtest(age) testcicolor(navy) testcoefcolor(black)

* Looking at the Diagnostics Table of the Perturbationtest, we see that the minimum sample drop required to change the significance of estimates is roughly 10% of the sample

eventcoefplot ln_wage, window(pre_2 pre_1 post_1 post_2) noconstant legend(off) event(post_1) xline(3, lpattern(dash) lcolor(gray)) command controls(age race birth_yr collgrad south) perturbationtest(birth_yr) testcicolor(navy) testcoefcolor(black)

Description

eventcoefplot runs regressions and generates graphs for event-study analysis, with extensive options for multiple specifications comparison, and specification and sample robustness checks.

In the context of event-studies, researchers are often in need of comparing specifications varying the choice of controls, fixed effects or clustered standard errors. Eventcoefplot offers an easy way to compare up to three specifications, furthermore: the multitest option allows to compare any number of groups of controls by including one group at the time; the leaveoneouttest option allows to check for estimates robustness by leaving out one control at the time; the tuplestest option checks that results are robust to including any tuples of a set of controls and finally the perturbationtest option checks that results are not driven by specific sub-samples, by singularly dropping all different values of the indicated variable. The perturbationtest includes a Diagnostics Table of the heterogeneity of results across subsamples, e.g. the Minimum Perturbation: the minimum sample drop that changes at least one estimate's significance/sign.

Author

Matteo Pinna (matteo.pinna@gess.ethz.ch)