*! version 1.1 2_feb_2023

Title

jwdid -- DID estimator using Mundlak approach

Syntax

jwdid
[varlist]
[if] [in]
[weight]
[, options]

ivar(varname) Declares the Panel ID variable

tvar(varname) Declares the time variable

gvar(varname) Provides the cohort variable

trtvar(varname) If no Gvar is available, you can provide the post-treatment variable. This works if data is panel.

trgvar(varname) If data is RC, you can use trtvar() option with this one. It should be a pseudo panel id in your data for people who share the treatment status at the same time

never Request using Never treated as control group. Default is using not yet treated. Using this, will exclude g-1 period from the interactions

group Request using Group fixed effects instead of Panel ID fixed effects. In linear models, with balanaced panel, estimates are numerically identical

method(method name, options) Request other methods for the estimation of ATT's. For example poisson or logit.
Default is linear regression model. One can also add some options for other methods (GLM for example)

pweights are allowed; see weight.

Description

jwdid is a program that implements the Extended TWFE estimator proposed by Jeff Wooldridge for the estimation of ATT's based on a generalized DID design.

In principle, this estimator simply suggests that to avoid some of the negative aspects of the traditional TWFE-DID estimator, which uses already treated units as controls causing the so-called negative weights, one should simply use a fully interacted set of dummies allowing for treatment effect heterogeneity by cohort and timing.

Specifically, instead of estimating a model as follows:

y_it = gamma * D_it + a_i + b_t + e_t

where D_it indicates if unit i is treated at time t. One should estimate a model like the following:

y_it = sum(gamma_gt * G_i * t) + a_i + b_t + e_t

where G_i * t corresponds to all possible interactions of the cohort unit i belongs to (G_i) and the period we aim to estimate that effect at (t).

In the simplest case, gamma_gt represents the ATT for cohort G at time t, and the estimates are comparable to the ones one could obtain using csdid.

This command also allows you to add controls to the model, but those controls should be time invariant. The command will NOT verify that this is the case.

One should also be aware that jwdid will create as many interactions as cohorts and periods are there in the data, times all possible controls.
This could provide an extreamly large number of estimated coefficients, which could make the models difficult to estimate.

When using other estimation methods using method(), the program will assume group/cohort fixed effects only, instead of individual fixed effects. Mostly, this is to avoid the incidental parameter problem.

The default comparison group only the interactions of cohort and time AFTER treatment occurred are included in the specification. This effectively uses not-yet treated as controls. When using the option never, all posible interactions of cohort
and time are used, thus considering only the never treated as controls. The results from this are equivalent to Callaway and Sant'Anna (2021) and csdid, and the proposition by Sun and Abraham (2021).

Remarks

The first version of this command came out as one of my attempts of learning some of the new DID methods.
For a while, most of my efforts were centered on drdid and csdid.
However, the methodology proposed by Prof. Wooldridge has important advantages over other methods, which called my applied econometrician's attention.

The two most important advantages are:

1. It is based on regression analysis, and most people understand regression, compared to the other alternatives

2. It is flexible for other methods. Namely, you should be easily be able to apply it for binary or count models (or other methods yet untested?)

Also, this program was coded independently from Jeff Wooldridge, but mostly based on some of his simulation codes he shared with the community.
Thus all errors of interpretation, and re-implementation (some of my own views on it) are my own.
If you see an error or bug, Please let me know.

And of course, there are now other two options to do the same in Stata. In Stata18, they lunch -xthdidregress- and -hdidregress-, which have the option
to estimate DID models using the same approach. And most recently, someone developed -wooldid-. Lots of options! but I still like mine better! Just saying.

To estimate aggregates, see jwdid_postestimation

Examples

ssc install frause

frause mpdta.dta, clear

Simple DID using not-treated as controls

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

Simple DID using never treated as controls

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

Simple DID using not-treated as controls, based on group (rather than individual) fixed effects

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

DID using not-treated as controls, based on group (rather than individual) fixed effects, and one time invariant control

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

DID using not-treated as controls, based on group (rather than individual) fixed effects, and one time invariant control.
Poisson regression estimator.

gen emp = exp(lemp)

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

Authors

Fernando Rios-Avila

Levy Economics Institute of Bard College

Annandale-on-Hudson, NY

friosavi@levy.org

References

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.

Aknowledgement

This command was put together just for fun, and as my last push of "productivity" before my
baby girl was born! (she is now 15months!)

Also see

Help: drdid, csdid, jwdid_postestimation, xtdidregress, xthdidregress, help hdidregress