*! version 1.4 06Mar2015
help didq

Title

didq -- Difference-in-differences estimations under alternative Parallel-q assumptions.

Syntax

didq depvar [indepvars] [if] [in] [weight] , treated(treatvar) time(timevar) [options]

Model: Required
treated(treatvar) specifies the treatment variable

time(timevar) specifies the time variable

Model
begin(integer) sets the first period the treatment effect is estimated

end(integer) sets the last period the treatment effect is estimated

q(integer) specifies the highest Parallel-q assumption to be used

ff estimates the fully flexible model (the default option)

standard estimates the standard model with common flexible dynamics

linear as the standard model plus a linear trend difference between treated and controls

quadratic as the standard model plus a quadratic trend difference between treated and controls

force estimates auxiliary model even if the variance-covariance matrix X'X of controls is not invertible

SE/Robust
robust uses the Huber/White/sandwich estimator (the default option)

cluster(varname) uses the clustered sandwich estimator

Reporting
detail displays additional statistics

level(#) sets confidence level as a percentage

auxiliary displays regression output from auxiliary regression

depvar and indepvars must be numeric; see datatype

by is allowed; see prefix

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

Description

didq performs difference-in-differences estimations under alternative Parallel-q assumptions as proposed by Mora and Reggio (2012).

Options

Model: Required

treated(treatvar) specifies that treatvar indicates treatment. treatvar must take value 0
for observations from the control group and value 1 for observations from the treated group.

time(timevar) sets timevar as the time variable. timevar must be an integer variable (i.e., byte, int, or long).

Model

begin(#b) specifies the first period at which treatment effects are evaluated. Hence, using the notation of the output display, at timevar=#b, s=1.

end(#e) specifies the last period at which effects are evaluated. Values #b and #e must be such that min(timevar) < #b < #e < max(timevar).
If neither begin() nor end() are specified, then both are set equal to max(timevar), i.e., by default the last period in timevar is assumed to be the only post-treatment period.
If either begin() or end() is not specified, then it is set equal to the one specified.

q(#q) specifies the highest Parallel-q assumption to be used (only relevant with option ff). It must lie between 1 and the number of pre-treatment periods, Q.
For example, with only two pre-treatment periods, #q can be, at most, equal to 2. With #q equal to 2, the analysis is conducted under both Parallel Paths (q=1)
and Parallel Growths (q=2). If option q() is not specified or #q is set larger than Q, then #q is set equal to Q.

ff estimates the fully flexible model. This is the default if no model is specified.
When the fully flexible model is chosen, didq displays point estimates and standard errors of treatment effects under each Parallel-q assumption between Parallel-1 and Parallel-#q.
For each q, didq computes the treatment effects up to S periods, where S=#e-#b+1. By default, effects only up to s=3 are displayed.
To see the effects for s larger than 3, the option detail should be used.
For example, assume that there are 3 periods before treatment and we set #q=3, #b=4, and #e=5.
In this case, didq will obtain for Parallel-1, Parallel-2, and Parallel-3 assumptions the treatment estimates one period (s=1) and two periods (s=2) after treatment.
didq additionally displays tests for
(a) the equivalence of all Parallel-q assumptions between Parallel-1 and Parallel-Q;
(b) for each Parallel-q assumption where q=2,..,#q, the equivalence of Parallel-q and Parallel-(q-1);
and (c) for each Parallel-q assumption where q=1,..,#q, the absence of dynamics in treatment effects between #b and #e.

standard estimates the standard model with common flexible dynamics. This model implicitly assumes the equivalence of all Parallel-q assumptions between Parallel-1 and Parallel-Q
and the absence of dynamics in treatment effects. The output displayed includes the estimate and standard error of the diff-in-diff estimator as well as
tests for (a) the equivalence of all Parallel-q assumptions between Parallel-1 and Parallel-Q; and (b) the absence of dynamics in treatment effects between #b and #e.

linear estimates the standard model with common flexible dynamics and a linear trend difference between treated and controls. This model implicitly assumes
the equivalence of all Parallel-q assumptions between Parallel-2 and Parallel-Q and the absence of dynamics in treatment effects.
The output displayed includes the estimate and standard error of the diff-in-diff estimator as well as tests for
(a) the equivalence of all Parallel-q assumptions between Parallel-2 and Parallel-Q;
and (b) the absence of dynamics in treatment effects between #b and #e.

quadratic estimates the standard model with common flexible dynamics and a quadratic trend difference between treated and controls. This model implicitly assumes the
equivalence of all Parallel-q assumptions between Parallel-3 and Parallel-Q and the absence of dynamics in treatment effects.
The output displayed includes the estimate and standard error of the diff-in-diff estimator as well as tests for
(a) the equivalence of all Parallel-q assumptions between Parallel-3 and Parallel-Q;
and (b) the absence of dynamics in treatment effects between #b and #e.

SE/Robust

robust the default, uses the Huber/White/sandwich estimator

cluster(varname) clustered sandwich estimator (see vce_option)

Reporting

detail displays the treatment effects for s larger than 3 and also some additional statistics: t-ratios, p-values, and confidence intervals of all estimates (only relevant with ff).

level(#) sets confidence level as a percentage (only relevant with detail); default is level(95)

Remarks

The data must contain at least two observations per group and period combinations.
There must be at least one period before treatment starts and one period after treatment ends.
The data set must contain a variable that identifies the period from which each observation is drawn, and a time-invariant treatment variable that signals treatment.
The output and the treatment variables must be numeric.
The time variable must be an integer (i.e. must be either byte, int, or long).
In addition, for the computations in didq to be meaningful, the difference between any two consecutive periods should be equal to one.

Only one model may be specified.

didq is an e-class ado. It first estimates an auxiliary regression and then it computes the treatment effects as linear combinations of the estimates of the auxiliary regression.
In addition to the treatment effects and their standard errors, it also saves the vector of coefficient estimates of the auxiliary regression and their variance-covariance matrix.

Examples

Consider the following simulated data:

use didq_examples.dta, clear

describe

Variable t is the variable that describes the period of the observation. There are five periods and treatment takes place between periods 3 and 4.
Variable output measures the output on which we want to estimate the effects.
Variable D takes value 1 if treated and 0 otherwise. Variables x1 and x2 are additional controls.

Restrict the sample to periods 3 and 4: drop if t<3 | t>4. The following example estimates the treatment effect in the fourth period with the standard model under the Parallel Paths Assumption:

. didq output, treated(D) time(t) standard

Using the original data set:

. didq output if (t==3 | t==4), treated(D) time(t) standard

Assume now that we only want to use periods 2, 3, and 4. The following example provides two alternative estimates of the treatment effect (under Parallel-1, and under Parallel-2) using the fully flexible model:

. didq output if (t>1 & t<5), treated(D) time(t)

With only three periods, the treatment effect estimate under Parallel-2 is equivalent to the estimate of the treatment effect with the standard model and linear deterministic trends:

. didq output if (t>1 & t<5), treated(D) time(t) linear

With three pre-treatment periods (1,2,3) and two post-treatment periods (4,5), end can be either 4 or 5 and q can be 1, 2, or 3:

// fully flexible model, q=1,2,3, s=1

. didq output, treated(D) time(t) begin(4) end(4)

// fully flexible model, q=1,2, s=1,2

. didq output, treated(D) time(t) begin(4) end(5) q(2)

Additional controls can be added

. didq output x1 x2, treated(D) time(t) begin(4) end(4)

Saved results

didq saves the following in e():

Scalars

e(N) number of observations

e(common_trend) the Wald test of the joint significance of all interactions of pre-treatment time dummies and the treatment dummy

Matrices

e(alpha) #qxS matrix of effect estimates

e(std_alpha) #qxS matrix of standard errors of effect estimates

e(beta) vector of estimates in auxiliary regression. The first elements of e(beta) are the estimates of the coefficients for the interactions between the treatment variable and the time dummies in the fully flexible model.
For the standard, linear, and quadratic model, the first elements are the estimates of the coefficients of the interactions between the treatment variable and the corresponding polynomial elements (i.e., constant, linear, and quadratic terms).
In all models, the estimate of the treatment coefficient is next. Then, the estimates for the coefficients for the common time dummies follow.
Finally, e(beta) includes estimates for the coefficients for the additional controls (when available) and the constant

e(Vbeta) (co)variance estimates in auxiliary regression

e(tests) equivalence tests and tests on the equality of the effect on all post-treatment periods

e(p_values) p-values for the equivalence tests and tests on the equality of the effect on all post-treatment periods

Authors

Ricardo Mora & Iliana Reggio

Departament of Economics, Universidad Carlos III Madrid

Madrid, Spain

References

Mora, R. & I. Reggio 2012.
"Treatment Effect Identification Using Alternative Parallel Assumptions." WP 12-33. UC3M, Spain.

Link to UC3M e-Archivo database.

Update: March - 2015