drdid Doubly Robust Difference-in-Differences Estimator

Syntax

drdid
depvar [indepvars]
[if] [in] [{weights}],
[ivar(varname)]
time (varname) treatment(varname)
[ options ]

Options

Model Specification

depvar Declares the dependent variable of outcome of interest.

indepvar Declares the independent variable or controls. Depending
on the estimation method, all declared variables will be used for the outcome regression model,
the propensity score estimator, or both.

DiD Model Specification

ivar Variable used as panel identifier. e.g., country. When declared, the model assumes the data
has a panel structure, and will apply panel estimators. When no variable is declared the command assumes data are
repeated crosssection (RC), and applies RC estimators.

time Variable to identify time. e.g., year. Periods do not need to be consecutive, but
it is expected to be strictly positive. It is also recommended periods have regular gaps.

treatment Categorical variable identifying the control and treated group. It does not
required to be coded as 0 and 1. However, lower value is assumed to be the control group, whereas
the higher one is the treated group, given the effective sample.
e.g., 1 control 3 treated group.

Estimation Method:

drimp (default) Sant’Anna and Zhao (2020) Improved doubly robust DiD estimator based on
inverse probability of tilting and weighted least squares.

Available for both Panel and Repeated Crossection

dripw Sant’Anna and Zhao (2020) doubly robust DiD estimator based on stabilized
inverse probability weighting and ordinary least squares

Available for both Panel and Repeated Crossection

reg Outcome regression DiD estimator based on ordinary least squares

Available for both Panel and Repeated Crossection

stdipw Inverse probability weighting DiD estimator with stabilized weights

Available for both Panel and Repeated Crossection

ipw Abadie (2005) inverse probability weighting DiD estimator

Available for both Panel and Repeated Crossection

ipwra Inverse-probability-weighted regression adjustment (via teffects)

Available for Panel data only

rc1 In combination with the methods and , this option request the doubly robust
but not locally efficient repeated crossection estimtors. Not available when using panel data.

all Request the computation of all Estimators available for the data structure.

This option is only for robusness purposes. One cannot use them to make test across estimations

Standard Error Options

By default, robust and asymptotic standard errors are estimated, using Influence Functions.
However other options are available.

wboot Request estimation of Standard errors using a multiplicative WildBootstrap procedure.
The default uses 999 repetitions using mammen approach

wboot(options) Request estimation of Standard errors using a multiplicative WildBootstrap procedure.
allowing to change default options.

reps(#) Specifies the number of repetitions to be used for the Estimaton of the WBoot SE. Default is 999

wtype(type) Specifies the type of Wildbootstrap procedure. The default is "mammen", but "rademacher" is also
avilable.

rseed(#) Specifies the seed for the WB procedure. Use for replication purposes.

gmm Request the estimation of the DID ATT's using generalized method of moments.

vce(opt) When the model is estimated via gmm, one can also request alternative Standard Errors.
See -gmm- for details. The default Standard errors should the the same as default standard errors.

cluster(clust var) Request the estimation of Clustered Standard errors. This option is for asymptotic Standard errors,
Wbootstrap Standard errors, and GMM.

Remark 1. When Panel estimators are used, asymptotic and Wbootstrap Standard errors are already clustered at the panel level.
When using cluster, one is effectively requesting a two-way cluster estimation.

Remark 2. When Panel estimators are used, The panel id (ivar) should be nested within cluster

level(#) Sets the confidence levels for the estimation of confidence intervals. Default is 95

Other Options

stub(str) Request the command to save a variable in the dataset under the neame stubatt. This
variable contains the Recentered Influence function associated with the DID ATT.

This option is not available when estination methods ipwra or all are requested.

replace If the variable stubatt already exists. This option requests replacing it.

noisily Request displaying all intermediate steps for the estimators. Not available with -ipwra-

While the estimator is recorded as importance weights (iweights), weights are treated as pweights internally.

Description

drdid implements the locally efficient doubly robust difference-in-differences (DiD) estimators
for the average treatment effect proposed by Sant'Anna and Zhao (2020). It also implements the IPW and Outcome
regression estimators for the DiD ATT.

drdid Doubly robust estimators combines inverse probability weighting and
outcome regression estimators to form estimators with more attractive statistical properties.
Namely, it the estimator is appropriate if either the propensity of treatment, or the outcome regression
is correctly specified.

It is also important to consider that the Panel data estimators assume that you are using time invariant variables.
Even if those variables are time variant, only the pretreatment values are used for the outcome model estimator or
the probability model estimation.

When repeated crosssection data is used, it is possible to use controls that vary across time are.
The underlying assumption is that control variables should be time constant. Sant'Anna and Zhao (2020) describes this
as stationarity assumption.

It is possible to add time varying covariates with panel data estimators, adding covariate changes as controls, in addition to the
pretreatment covariates. However, unless the controls are strictly exogenous (strong assumption), this may produce
inconsistent results, because the changes that would otherwise be capture in the ATT would be absorbed by the varying covariates.

Postestimation

It is possible to show the contents of the intermediate results, using the command:

drdid_display, bmatrix(name) vmatrix(name)

For all estimation metods except -ipwra-, it is also possible request the generation
of the IPW weights, or the propensity score using the following command:

drdid_predict newvarname, [weight pscore]

Remarks

In addition to the ATT and standard errors, the command also returns,
as part of e(), the coefficients and variance covariance matrixes associated with all intermediate sets.
See ereturn list after running the command.

Examples

use https://friosavila.github.io/playingwithstata/drdid/lalonde.dta, clear

Panel estimator with default drimp method

drdid re age educ black married nodegree hisp re74 if treated==0 | sample==2, ivar(id) time(year) tr(experimental)

Panel estimator using all estimators

drdid re age educ black married nodegree hisp re74 if treated==0 | sample==2, ivar(id) time(year) tr(experimental) all

Repeated crosssection using all estimators

drdid re age educ black married nodegree hisp re74 if treated==0 | sample==2, time(year) tr(experimental) all

Requesting Repeated crosssection estimators with cluster SE using ID

drdid re age educ black married nodegree hisp re74 if treated==0 | sample==2, cluster(id) time(year) tr(experimental) dripw

Requesting Panel estimators with wild bootstrap standard errors

drdid re age educ black married nodegree hisp re74 if treated==0 | sample==2, ivar(id) time(year) tr(experimental) dripw wboot

Authors

Fernando Rios-Avila

Levy Economics Institute of Bard College

Annandale-on-Hudson, NY

friosavi@levy.org

Pedro H. C. Sant'Anna

Vanderbilt University

Asjad Naqvi

International Institute for Applied Systems Analysis

References

Abadie, Alberto. 2005.
"Semiparametric Difference-in-Differences Estimators."
The Review of Economic Studies 72 (1): 1–19.

Sant’Anna, Pedro H. C., and Jun Zhao. 2020.
"Doubly Robust Difference-in-Differences Estimators."
Journal of Econometrics 219 (1): 101–22.

Rios-Avila, Fernando,
Pedro H. C. Sant'Anna, and Asjad Naqvi 2021.
“DRDID: Doubly Robust Difference-in-Differences Estimators for Stata.” SSC

Aknowledgement

This command was built using the DRDID command from R as benchmark, originally written by Pedro Sant'Anna.
Many thanks to Pedro for helping understanding the inner workings on the estimator.

Thanks to Asjad for starting this small project challenge.

Further thanks to Enrique, who helped with the gmm estimator and displaying set up

Also thank you to Miklos Koren, for helping setting up the original helpfile and github repository

If you use this package, please cite:

Sant'Anna, Pedro H. C., and Jun Zhao. 2020.
"Doubly Robust Difference-in-Differences Estimators."
Journal of Econometrics 219 (1): 101–22.

Also see

Help: csdid, didregress, xtdidregress