help tfdiff

Title

tfdiff - Pre- and post-treatment estimation of the Average Treatment Effect (ATE) with binary time-fixed treatment

Syntax

tfdiff
outcome
treatment
[varlist]
[if] [in]
[weight],
datatype(datatype)
tvar(time_variable)
t(#)
[pvar(panel_variable)
test_pt
graph
ci(#)
vce(vcetype)
save_graph(graphname)
save_results(filename)]

fweights, iweights, and pweights are allowed;
see weight.

Description

tfdiff estimates Average Treatment Effects (ATEs) when the treatment is binary and fixed to a specific point in time. It works both with the availability of a panel (or longitudinal) dataset or a cross-section.
Using tfdiff, the user can estimate
the pre- and post-intervention effects by selecting the intervention time t. The results are plotted in an easy-to-read graphical representation. In order to assess the reliability of the causal results achieved by
the user's specified model, tfdiff allows to test the "parallel trend" assumption via a joint significance test on the pre-treatment effects. The model estimated by tfdiff is a generalization of the Difference-In-Differences (DID) approach to more than one pre- and post-treatment period and fixed treatment time.

According to the tfdiff syntax:

outcome: is the target variable over which measuring the impact of the treatment

treatment: is the binary treatment variable taking 1 for treated, and 0 for untreated units

varlist: is the set of pre-treatment (or observable confounding) variables

Options

datatype(datatype) specifies the type of dataset employed, where datatype must be one out of these two alternatives:
"cross-section" (for a cross-section dataset), or "panel" (for a longitudinal dataset).
It is always required to specify one data type.

tvar(time_variable) specifies the time variable. It has to be numeric.

t(#) allows to specify the time of treatment.

pvar(panel_variable) specifies the panel variable. It has to be numeric.

test_pt allows for performing the parallel trend test using the pre-treatment periods.

graph allows for a graphical representation of results.

ci(#) sets the statistical significance level for ATE(t). It takes values 1, 5, 10 (meaning 1%, 5%, and 10% significance respectively).

vce(vcetype) allows for robust and clustered regression standard errors in model's estimates.

save_graph(graphname) allows to save in the hard-disk the graph of results.

save_results(filename) allows to save in the user's hard-disk a new dataset named filename containing the ATE(t) function and relative confidence intervals.

Post-estimation results

tfdiff creates these variables:

_D2, ..., _DT: are time dummies used to build the treatment effects estimation.

tfdiff returns the following scalars:

e(N) is the total number of (used) observations.

e(N1) is the number of (used) treated units.

e(N0) is the number of (used) untreated units.

e(T) is the number of times.

e(t) is the treatment time.

Remarks

- The treatment has to be a 0/1 binary variable (1 = treated, 0 = untreated).

- It is assumed that the model is correctly specified.

- Please remember to use the update query command before running
this program to make sure you have an up-to-date version of Stata installed.

Examples

********************************************************************************
* SIMULATED DATASET
********************************************************************************
. clear all
. set scheme s1mono
********************************************************************************
. global E=2 // average effect of the policy
********************************************************************************
. global Nobs=100
. global T=21
. set obs $Nobs
. set seed 1234
. gen H=_n if _n<=$T
. centile H , c(50)
. global t_star=1999+r(c_1)
********************************************************************************
. gen id=_n
. expand $T
. gen w=(id<=$T)
. bys id: gen time=_n+1999
. gen x=uniform()
. gen y=rnormal(0,0.5)
********************************************************************************
. replace y=rnormal($E,1) if (time >= $t_star) & w==1
********************************************************************************
. keep id time y w x
********************************************************************************
. tsset id time
********************************************************************************
. tfdiff y w x , t(2010) pvar(id) tvar(time) datatype(panel) ///
ci(10) graph vce(cluster id) save_results(RES_tfdiff)
********************************************************************************

References

Cerulli, G. (2015). Econometric Evaluation of Socio-Economic Programs: Theory and Applications,
Springer.

Cerulli, G. and Ventura, M. (2019). TVDIFF: Estimation of pre-and posttreatment average treatment effects with binary time-varying treatment using Stata, The Stata Journal, 19, 3, 2019.

Authors

Giovanni Cerulli

IRCrES-CNR

Research Institute on Sustainable Economic Growth, National Research Council of Italy

E-mail: giovanni.cerulli@ircres.cnr.it

Also see

Online: teffects, tvdiff