Title

lpdid -- Local Projections Difference-in-Differences (LP-DiD) estimator.

Syntax

lpdid
depvar
[if] [in] [weight],
unit(varname)
time(varname)
treat(varname)
pre_window(integer)
post_window(integer)
[options]

Options

Main Parameters

unit(varname) Variable indexing units of observation.
(Also cluster unit for SEs, unless otherwise selected by the user).

time(varname) Variable indexing time periods (or time-equivalent).

treat(varname) Treatment indicator
(Note: we currently only support binary treatments, although continuous treatments are potentially possible with local projections diff-in-diff).

pre_window(#) Length of the pre-treatment window of the event-study estimates.
Positive integer >=2 required. Either pre_window or post_window needs to be specified.

post_window(#) Length of the post-treatment window of the event-study estimates.
Positive integer >=0 required.
Either pre_window or post_window needs to be specified.

Additional Diff-in-Diff Options

cluster(varname) Cluster for SEs (default is to use the variable indexing units).

controls(varlist) List of covariates
(excluding lags of the dependent variable, which can be included using the ylags() or dylags() options described below).
Note: since version 1.0.1, time-series and other STATA operators are now allowed in the controls() option.

absorb(varlist) Categorical variables that identify additional fixed effects to be absorbed.
Note 1: Time effects are always automatically included (otherwise it would not be DiD!);
if you only want to absorb time indicators, there is no need to use this option.
Note 2: Please remember that unit fixed effects are already filtered out by the differencing of the outcome.
Therefore, in most cases you will not want to include unit fixed effects in the LP-DiD specification.
Adding unit fixed effects to the LP-DiD specification is equivalent to including unit-specific linear time trends.

ylags(#) Lags of the dependent variable to be included as covariates.

dylags(#) Lags of first-differenced dependent variable to be included as covariates.

nonabsorbing(#, [notyet] [firsttreat]) Non-absorbing treatment.
This option requires a numerical or string input of the format “# , [notyet] [firsttreat]”.
The integer # is the post-treatment horizon at which effects are assumed to stabilize.
The [notyet] suboption restricts the control group to not-yet treated units only;
[firsttreat] restricts the treatment group to first treatments only.

nevertreated Only use never treated observations as control units.
(Default is to use all clean controls, including not-yet treated units and possibly,
if treatment is non-absorbing, treated units which treatment effects have stabilized.)

nocomp Rule out composition effects across the post-treatment window.
It ensures that the set of clean control units is the same across all post-and pre-treatment time horizons.
Default is to use all available clean controls at each time horizon, which might introduce composition effects.

rw Reweight observations to estimate an equally weighted ATE.
Default is to not reweigh observations, which yields a variance-weighted ATE with strictly positive weights.

pmd(#|max) Pre-mean-differenced version of LP-DiD.
The option argument indicates how many periods are used to compose the pre-treatment baseline;
if "max" is selected, all available pre-treatment periods are used;
if instead of "max" an integer k is specified, pmd uses a moving average over [-k,-1].
Default is "max" if absorbing treatment.
Default is k=L if nonabsorbing treatment, where L is the argument of the nonabsorbing() option,
unless firsttreat & (notyet | nevertreated) are selected, in which case the default is "max".

bootstrap(#) Wild bootstrap for SE, argument is the number of repetitions.

seed(#) Set seed for bootstrap.

post_pooled(#) Sets the length of the post-treatment window for the pooled estimates.
Default is [0, post_window], which means using the same post-treatment window as in the event study estimates.
Users can either specify only one integer as input, which is then used to replace post_window,
or they can specify two integers to set a custom interval.

pre_pooled(#) Sets the length of the pre-treatment window for the pooled estimates.
Default is [-pre_window -2], which means using the same pre-treatment window as in the event study estimates.
Users can either specify only one integer as input, which is then used to replace pre_window,
or they can specify two integers to set a custom interval in the format (pooled_start pooled_end) (both positive integers).

weights(varname) Weight observations using the weights stored in variable varname.
Note 1: if rw is not selected, the weights provided are applied on top of the variance-based weights (as a standard weighted regression would do);
if rw is also selected, observations are weighted just based on varname.
Note 2: Since version 1.0.1, weights can be applied using the standard STATA syntax [weight],
like in the 'regress' command, but this option is still available for backward compatibility.

Reporting Options

level(#) Significance level for confidence intervals, default is 95.

nograph If specified, no graphical output.

only_pooled If specified, event study estimates are not computed (increases computational speed).

only_event If specified, pooled estimates are not computed (increases computational speed).

Description

lpdid performs the Local Projections Difference-in-Differences estimator (LP-DiD) proposed by Dube, Girardi, Jordà and Taylor (2023).

LP-DiD is a convenient and flexible regression-based framework for implementing Difference-in-Differences.
It uses panel data to estimate the average effect of a treatment under the assumptions of no-anticipation and (conditional) parallel trends.
It can provide both dynamic event study estimates that track the treatment effect path at each time horizon after treatment,
and 'pooled' estimates of the overall average effect in a post-treatment time window.
Treatment can be absorbing (once a unit gets treated, it stays treated) or non-absorbing
(units can enter and exit treatment multiple times).
If treatment is non-absorbing, the nonabsorbing() option must be specified.
The estimation sample is restricted to units entering treatment and 'clean' controls,
thus avoiding the 'negative-weights' bias of TWFE estimators. The baseline version estimates
a variance-weighted effect with strictly positive weights.
The reweighed version (implemented through the rw option) estimates an equally-weighted average effect.
LP-DiD offers flexibility in using either the last period before treatment (the default option) or an average of pre-treatment periods
(the pmd() option) as the pre-treatment base period.
It is possible to include pre-treatment lags of the outcome (or of other time-varying covariates) as control variables.
See Dube, Girardi, Jordà and Taylor (2023) for a detailed exposition.

Remarks

This program requires the user-written commands bootstrap, reghdfe, and the packages in egenmore.

Example with absorbing treatment

Upload simulated dataset with absorbing treatment

use http://fmwww.bc.edu/repec/bocode/l/lpdidtestdata1.dta

Run baseline version of LP-DiD (it estimates a variance-weighted average effect, with strictly positive weights)

lpdid Y, time(time) unit(unit) treat(treat) pre(5) post(10)

Run reweighted LP-DiD (estimates an equally-weighted average effect)

lpdid Y, time(time) unit(unit) treat(treat) pre(5) post(10) rw

Run reweighted LP-DiD, avoiding composition effects

lpdid Y, time(time) unit(unit) treat(treat) pre(5) post(10) rw nocomp

Run reweighted LP-DiD, avoiding composition effects and using only the never treated as controls

lpdid Y, time(time) unit(unit) treat(treat) pre(5) post(10) rw nocomp nevertreated

Run the PMD (pre-mean differenced) version

lpdid Y, time(time) unit(unit) treat(treat) pre(5) post(10) pmd(max)

Example with non-absorbing treatment

Upload simulated dataset with nonabsorbing treatment

use http://fmwww.bc.edu/repec/bocode/l/lpdidtestdata2.dta, clear

Run baseline version of LP-DiD (variance-weighted with strictly positive weights), with time-window of 5 periods to define clean controls

lpdid Y, time(time) unit(unit) treat(treat) pre(5) post(10) nonabs(5)

Use only non-yet treated as controls

lpdid Y, time(time) unit(unit) treat(treat) pre(5) post(10) nonabs(5, notyet)

Use only non-yet treated as controls and avoid composition effects

lpdid Y, time(time) unit(unit) treat(treat) pre(5) post(10) nonabs(5, notyet) nocomp

Stored Results

lpdid stores the following in e():

Macros

e(results) Event study estimates, with coefficients, standard errors, t-values, p-value, confidence interval (low), confidence interval (high), observation number

e(pooled_results) Pooled estimates, with coefficients, standard errors, t-values, p-value, confidence interval (low), confidence interval (high), observation number

Scalars

e(cmd) lpdid

e(cmdline) full command line with options selected

e(depvar) name of dependent variable

e(controls) name(s) of control variable(s)

e(absorb) name(s) of categorical variable(s) that identify additional fixed effects to be absorbed

e(ylags) number of lags of the dependent variable used on the rhs

e(dylags) number of first-differenced lags of the dependent variable used on the rhs

e(pre_window) number of pre periods

e(post_window) number of post periods

e(control_group) definition of control group used

e(treated_group) definition of treated group used

Authors

Alexander Busch

Massachusetts Institute of Technology (USA)

abusch@mit.edu

Daniele Girardi

King's College London (UK)

daniele.girardi@kcl.ac.uk

Acknowledgements

We are grateful to Enrique Pinzon (StataCorp), Liss Hall, Arin Dube, Òscar Jordà and Alan M. Taylor

If you use this package, please cite both the package and the paper introducing the LP-DiD method:

Busch A. and D. Girardi. 2023.
"LPDID : Stata module implementing Local Projections Difference-in-Differences (LP-DiD)."
Statistical Software Components S459273, Boston College Department of Economics.

and

Dube, A., D. Girardi, Ò. Jordà and A. M. Taylor. 2023.
"A Local Projections Approach to Difference-in-Differences."
NBER Working Paper 31184.