*! version 2 May 2024

Title

jwdid post-estimation -- JWDID Post Estimation

-jwdid- has a set of post estimation options that can be used to either produce aggregations of the Average Treatment Effects on the Treated (ATT) or to produce plots of the estimated ATTs.

Aggregation Options:

Syntax

estat
[aggregation] [pw]
[, options]

Main
simple Estimates the ATT for all groups across all periods.

group Estimates the ATT for each group or cohort, over all periods.

calendar Estimates the ATT for each period, across all groups or cohorts.

event Dynamic aggregation. When default option is used (not-yet treated)
this option only provides the post-treatment ATT aggregations.

plot Produces Plots using the last estimated results

One can also request using weights different from those used in the estimation.

Because jwdid uses margins to estimate the aggregate ATTs, you can use many margins options, including "post" to store the output for further reporting, or predict() to produce results for other outcomes (other than default).

However, there are other available options.

esave(name) Saves the output into a .ster file, without erasing the previously estimated results. Can be used with replace, to overwrite a previously existing file

estore(name) Stores the output in memory under name

orestriction(str) Imposes an additional restriction on the ATT's aggregation. For example, -estat simple, ores(sex==2)- would estimate a simple ATT for women only. This option can be used for all aggregations.

over(varname) When using simple aggregation, one can request to obtain "simple" estimates across subgroups. For example, to produce ATT's for men and women.

pretrend When using event aggregation, one can request to obtain a simple Parallel trends assumption test. This will use -test- on the Null that all pre-treatment aggregated ATTs are zero.

window(#1 #2) When using event aggregation, this option can be requested to restrict the aggregation and use data only for the event periods within window

cwindow(#1 #2) In contrast to window, this option censors the "events" to be used before doing the aggregation. For example, -cwindow(-4 4)- would display aggregates for periods -4 to 4, but the lower threshold would aggregate all ATTs before T-4.

Plot Options

One of the post-estimation options can also be used to produce plots of the estimated ATTs. These are options in addition to the standard twoway graph options.

style(styleoption) Allows you to change the style of the plot. The options are rspike (default), rarea, rcap and rbar.

title(str) Sets title for the constructed graph

xtitle(str) Sets title for horizontal axis

ytitle(str) Sets title for vertical axis

name(str) Request storing a graph in memory under name

pstyle[1|2](stype) This can be used to choose an overall style for the figure colors. Default is p1 for pstyle1 and p2 for pstyle2. pstyle2 is only used for event style plots, for the post-treatment effects.

color[1|2](colorstyle) This can be used to choose a color for areas of the figures. It supersedes pstyle if a color is defined, but complements it if using transparency or intensity. Default depends on the type of graph style, but is set at %40 for rspike.

lwidth[1|2](options) This can be used to select width of line in figure. It affects the thickness of the contours of Area type plots. Default depends on the type of graph style.

tight When requesting event, calendar or group aggregates, the plots are constructed using the original time scale. For example, if you had 3 groups, 10, 15 and 16, the plot across groups would use periods 10, 15 and 16, with black spaces in between. The option tight can be used to transform the scale of the data to start from 1, to the last period. This is useful to avoid the black spaces in between groups.

Other twoway graph options are allowed.

Description

In the simple linear model, average treatment effects on group G and time T can be directly analyzed by looking at the corresponding regression coefficients. However, in more complex models, those coefficients will not reflect the average treatment effect, except for the latent variable.

The procedure used for aggregation is based on the following steps:

1. Given the estimated coefficients, obtain the predicted outcome of interest (linear index for ols) using all data as observed. Call this y_hat_observed.

2. Obtain the predicted outcome setting to zero all coefficients that are associated with the treatment dummy (ie __tr__=0). Call this y_hat_nontreated

Once these two estimates are obtained, it is possible to calculate the individual level ATT as ATT_i = y_hat_observed_i - y_hat_nontreated_i. Which is the difference between the predicted potential outcome as observed minus the predicted potential outcome as if the individual was not treated.

Once the ATT_i is obtained, Any aggregation can be calculated by simply using a weighted average, and a selection indicator.

AGGATT = sum(ATT_i * w_i*sel_i)/sum(w_i*sel_i)

In this case, -w_i- is the weight observation i has in the survey (or the weight requested using [pw=var]). And -sel_i- is a dummy variable that is 1 if the observation is selected for the aggregation, and 0 otherwise.

Similar to csdid and csdid2, four basic aggregations are available:

Simple: sel_i = 1 if t_i >= g_i (all observations for periods after treatment)

Calendar: sel_i = 1 if t_i >= g_i & t_i == t_c (all observations for periods after treatment, if treated at time t_c)

Group: sel_i = 1 if t_i >= g_i & g_i == g_c (all observations for periods after treatment, if they belong to group g_c)

Event: sel_i = 1 if (t_i - g_i) = e & g_i != 0 (all observations where the gap between time and treatment period is e)

When other estimation methods are used (probit/poisson) margins are calculated based on the default options in margins. However, the user can also request to use other options, such as -predict(xb)-.

Combining the basic aggregations with orestriction() and over() allows for a wide range of aggregations to be calculated, allowing for the direct identification of Characteristics heterogeneity.

After producing the aggregations, one can use -estat plot- to produce the corresponding plots.

Remarks

This code shows how simple it is to produce Aggregations for ATT's based on this approach.
However, as experienced with the first round of CSDID, when you have too many periods and cohorts,
some aggregations may take some time to be produced. The same is true for xtdidregress twfe and hdidregress twfe implementations.

Also, the general recommendation is to produce aggregations and Standard errors using -vce(unconditional)- option. However, this is not possible in all cases. Specifically, if the model is estimated with reghdfe (default) or ppmlhdfe, the unconditional standard errors are not available. xtdidregress twfe avoids this problem by implementing a regression approach combined with a full Mundlak approach.

Also, all errors are my own.

Examples

Setup: Estimation of ATTGTs without controls using not-yet treated groups

ssc install frause

frause mpdta.dta, clear

jwdid lemp, ivar(countyreal) tvar(year) gvar(first_treat)

Aggregations:

estat simple

estat calendar

estat group

estat event

Using Never treated as controls

jwdid lemp, ivar(countyreal) tvar(year) gvar(first_treat) never

estat simple

estat calendar

estat group

estat event

estat event, window(-3 2)

estat event, cwindow(-3 2)

Using a single control variable

jwdid lemp lpop, ivar(countyreal) tvar(year) gvar(first_treat)

estat simple

estat calendar

estat group

estat event

Using a single control variable and poisson

gen emp = exp(lemp)

jwdid emp lpop, ivar(countyreal) tvar(year) gvar(first_treat) method(poisson)

estat simple

estat calendar

estat group

estat event

Using a different outcome

estat event, predict(xb)

Plot Examples

Setup: Estimation of ATTGTs without controls using never treated as controls

jwdid lemp, ivar(countyreal) tvar(year) gvar(first_treat) never

Estimation of event aggregation

estat event

Plot

estat plot

estat plot, pstyle1(p3)

estat plot, xscale(range(-4.5/3.5))

`"estat plot, legend(order(1 "Before" 3 "After"))"'

`"estat plot, style(rbar)"'

Authors

Fernando Rios-Avila

Levy Economics Institute of Bard College

Annandale-on-Hudson, NY

friosavi@levy.org

Arne J. Nagengast

Deutsche Bundesbank

arne.nagengast@bundesbank.de

Yoto V. Yotov

School of Economics, Drexel University

yotov@drexel.edu

References

Nagengast, Arne J., Fernando Rios-Avila and Yoto V. Yotov. 2024. The European Single Market and Intra-EU Trade: An Assessment with Heterogeneity-Robust Difference-in-Differences Methods.
School of Economics Working Paper Series 2024-5, LeBow College of Business, Drexel University. https://ideas.repec.org/p/ris/drxlwp/2024_005.html. Paper.

Nagengast, Arne J. and Yoto V. Yotov. 2024. Staggered Difference-in-Differences in Gravity Settings: Revisiting the Effects of Trade Agreements. American Economic Journal: Applied Economics (forthcoming).

Wooldridge, Jeffrey. 2021.
Two-Way Fixed Effects, the Two-Way Mundlak Regression, and Differences-in-Differences
estimators. Working paper.

Wooldridge, Jeffrey. 2023.
Simple Approaches to Nonlinear Difference-in-Differences with Panel Data. The Econometrics Journal, Volume 26, Issue 3, September 2023, Pages C31–C66.

Also see

Help: drdid, csdid, csdid_postestimation,
jwdid, jwdid_postestimation, xthdidregress, hdidregress