*! version 3.1.0 July 11 2024
help xteventplot

Title

xteventplot -- Plots After Panel Event Study Estimation

Syntax

xteventplot
,
[options]

Main
suptreps(integer) number of repetitions for sup-t confidence bands

overlay(string) generate overlay plots

y generate event study plot for dependent variable in IV setting

proxy generate event study plot for proxy variable in IV setting

levels(numlist) customize confidence levels for plot

smpath([type, subopt]) smoothest path through confidence region

overidpre(integer) change pre-event coefficients to be tested

overidpost(integer) change post-event coefficients to be tested

Appearance
noci omit all confidence intervals and bands

nosupt omit sup-t confidence bands

nozeroline omit reference line at 0

nonormlabel omit label for value of dependent variable at event-time = -1

noprepval omit p-value for pre-trends test

nopostpval omit p-value for leveling-off test

scatterplotopts(string) graphics options for coefficient scatter plot

ciplotopts(string) graphics options for confidence interval plot

suptciplotopts(string) graphics options for sup-t confidence band plot

smplotopts(string) graphics options for smoothest path plot

trendplotopts(string) graphics options for extrapolated trend plot

staticovplotopts(string) graphics options for the static effect overlay plot

textboxoption(string) textbox options for displaying the p-values of the pre-trend and leveling-off tests

addplots(string) plot to be overlaid on event-study plot

additional_options additional options to be passed to twoway

Description

xteventplot produces event-study plots after xtevent.

Options

Main

suptreps(integer) specifies the number of repetitions to calculate Montiel Olea and Plagborg-Møller (2019) sup-t confidence bands for
the dynamic effects. The default is 10000. See xtevent.

overlay(string) creates overlay plots for trend extrapolation, instrumental variables estimation in presence of pre-trends, and constant
policy effects over time.

overlay(trend) overlays the event-time coefficients for the trajectory of the dependent variable and the extrapolated linear trend.
overlay(trend) is only available after xtevent, trend(, saveoverlay).

overlay(iv) overlays the event-time coefficients trajectory of the dependent variable and the proxy variable used to infer the
trend of the confounder. overlay(iv) is only available after xtevent, proxy() proxyiv().

overlay(static) overlays the event-time coefficients from the estimated model and the coefficients implied by a constant policy
effect over time. These coefficients are calculated by (i) estimating a model where the policy affects the outcome contemporaneously and
its effect is constant, (ii) obtaining predicted values of the outcome variable from this constant effects model, and (iii) regressing
the predicted values on event-time dummy variables.

y creates an event-study plot of the dependent variable in instrumental variables estimation. y is only available after
xtevent, proxy() proxyiv().

proxy creates an event-study plot of the proxy variable in instrumental variables estimation. proxy is only available after
xtevent, proxy() proxyiv().

levels(numlist) customizes the confidence level for the confidence intervals in the event-study plot. By default, xteventplot draws a standard confidence interval and a sup-t confidence band.
levels allows different confidence levels for standard confidence intervals. For example, levels(90 95) draws both 90% and 95% level
confidence intervals, along with a sup-t confidence band for Stata's default confidence level.

smpath([type , subopt])} displays the "least wiggly" path through the Wald confidence region of the event-time coefficients.
type determines the line type, which may be scatter or line. smpath is not allowed with noci.

The following suboptions for smpath control the optimization process. Because of the nature of the
optimization problem, optimization error messages 4 and 5 (missing derivatives) or 8 (flat regions) may be
frequent. Nevertheless, the approximate results from the optimization should be close to the results that would be obtained with convergence of the optimization process. Modifying these optimization suboptions may improve optimization behavior.

postwindow(scalar > 0) sets the number of post event coefficient estimates to use for calculating the
smoothest line. The default is to use all the estimates in the post event window.

maxiter(integer) sets the maximum number of inner iterations for optimization. The default is 100.

maxorder(integer) sets the maximum order for the polynomial smoothest line. Maxorder must be between 1 and 10. The default is 10.

technique(string) sets the optimization technique for the inner iterations of the smoothest-path optimization.
"nr", "bfgs", "dfp", and combinations are allowed. See maximize. The default is "nr 5 bfgs".

overidpre(integer) changes the coefficients to be tested for the pre-trends overidentification test.
The default is to test all pre-event coefficients. overidpre(#1) tests if the coefficients
for the earliest #1 periods before the event are equal to 0, including the endpoints.
For example, with a window of 3, overidpre(2) tests that the coefficients for event-times -4+
(the endpoint) and -3 are jointly equal to 0. #1 must be greater than 0.
See xteventtest.

overidpost(integer) changes the coefficients to be tested for the leveling-off overidentification
test. The default is to test that the rightmost coefficient and the previous coefficient are
equal. overidpost(#1) tests if the coefficients for the latest
#1 periods after the event are equal to each other, including the endpoints. For example, with a window of 3,
overidpost(3) tests that the coefficients for event-times 4+ (the endpoint), 3,
and 2 are equal to each other. #1 must be greater than 1. See xteventtest.

Appearance

noci omits the display and calculation of both Wald and sup-t confidence bands. noci overrides suptreps if it is specified.
noci is not allowed with smpath.

nosupt omits the display and calculation of sup-t confidence bands. nosupt overrides suptreps if it is specified.

nozeroline omits the display of the reference line at 0. Note that reference lines with different styles can be obtained by removing the
default line with nozeroline and adding other lines with yline. See added_line_options.

nonormlabel suppresses the vertical-axis label for the mean of the dependent variable at
event-time corresponding to the normalized coefficient.

noprepval omits the display of the p-value for a test for pre-trends. By default, this is a
Wald test for all the pre-event coefficients being equal to 0, unless overidpre is specified.

nopostpval omits the display of the p-value for a test for effects leveling off. By default,
this is a Wald test for the last post-event coefficients being equal, unless overidpost is specified.

scatterplotopts specifies options to be passed to scatter for the coefficients' plot.

ciplotopts specifies options to be passed to rcap for the confidence interval's
plot. These options are disabled if noci is specified.

suptciplotopts specifies options to be passed to rcap for the sup-t confidence
band's plot. These options are disabled if nosupt is specified.

smplotopts specifies options to be passed to line for the smoothest path through
the confidence region plot. These options are only active if smpath is specified.

trendplotopts specifies options to be passed to line for the extrapolated trend
overlay plot. These options are only active if overlay(trend) is specified.

staticovplotopts specifies options to be passed to line for the static effect overlay
plot. These options are only active if overlay(static) is specified.

addplots specifies additional plots to be overlaid to the event-study plot.

textboxoption specifies options to be passed to the textbox of the pre-trend and leveling-off
tests. These options are disabled if noprepval and nopostval are specified. See textbox_options.

additional_options: Additional options to be passed to twoway. See twoway.

Examples

Setup

. webuse nlswork

year variable has many missing observations

Create a time variable that ignores these gaps

. by idcode (year): gen time=_n

. xtset idcode time

Basic event study with clustered standard errors

Impute policy variable assuming no unobserved changes

. xtevent ln_wage age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure , pol(union) w(3) cluster(idcode) impute(nuchange)

Simple plot

. xteventplot

Supress confidence intervals or sup-t confidence bands

. xteventplot, noci

. xteventplot, nosupt

Plot smoothest path in confidence region

. xteventplot, smpath(line)

. xteventplot, smpath(line, technique(dfp))

Adjust textbox options for the p-values of the pre-trend and leveling-off tests

. xteventplot, textboxoption(color(blue) size(large))

Freyaldenhoven, Hansen and Shapiro (2019) estimator with proxy variables

. xtevent ln_wage age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure , pol(union) w(3) vce(cluster idcode) impute(nuchange) proxy(wks_work)

Dependent variable, proxy variable, and overlay plots

. xteventplot, y

. xteventplot, proxy

. xteventplot, overlay(iv)

. xteventplot

Authors

Simon Freyaldenhoven, Federal Reserve Bank of Philadelphia.

simon.freyaldenhoven@phil.frb.org

Christian Hansen, University of Chicago, Booth School of Business.

chansen1@chicagobooth.edu

Jorge Pérez Pérez, Banco de México.

jorgepp@banxico.org.mx

Jesse Shapiro, Brown University.

jesse_shapiro_1@brown.edu

Support

For support and to report bugs please email Jorge Pérez Pérez, Banco de México.

jorgepp@banxico.org.mx

xtevent can also be found on Github.