help diff 
-------------------------------------------------------------------------------

Title

diff -- Difference in differences estimation

Syntax

diff outcome_var [if] [in] [weight] ,[ options]

Description

diff performs several difference in differences (diff-in-diff) estimations of the treatment effect of a given outcome variable from a pooled baseline and follow up dataset: Single Diff-in-Diff, Diff-in-Diff controlling for covariates, Kernel-based Propensity Score diff-in-diff, and the Quantile Diff-in-Diff. diff is also suitable for estimating repeated cross section diff-in-diff (except for the kernel option).

Options

options Description ------------------------------------------------------------------------- Model - Required period(varname) Indicates the dummy period variable (0: base line; 1: follow up). treated(varname) Indicates the dummy treated variable (0: controls; 1:treated).

Optional cov(varlist) Specifies the pre-treatment covariates of the model. When option kernel is selected these variables are used to generate the propensity score. kernel Performs the Kernel-based Propensity Score diff-in-diff. This option generates _weights that contains the weights derived from the kernel density function, _ps when the Propensity Score is not specified in pscore(varname). This option requires the id(varname) of each individual, hence it is not compatible with repeated cross section. id(varname) Option kernel requires the supply of the identification variable. bw(#) Supplied bandwidth of the kernel. The default is the optimum bw estimated by Stata. See [R] kdensity ktype(kernel) Specifies the kernel function; the default is epanechnikov. See [R] kdensity qdid(quantile) Performs the Quantile Difference in Differences estimation at the specified quantile from 0.1 to 0.9 (quantile 0.5 performs the QDID at the medeian). You may combine this option with kernel and cov options. qdid does not support weights nor robust standard errors. This option uses [R] qreg and [R] bsqreg for bootstrapped standard errors pscore(varname) Supplied Propensity Score. logit Specifies logit estimation of the Propensity Score. The default is Probit. support Performs diff on the common support of the propensity score given the option kernel.

SE/Robust cluster(varname) Calculates clustered Std. Errors by varname. robust Calculates robust Std. Errors. bs performs a Bootstrap estimation of coefficients and standard errors. reps(int) Specifies the number of repetitions when the bs is selected. The default are 50 repetitions.

Balancing test test Performs a balancing t-test of difference in means of the specified covariates between control and treated groups in period == 0. The option test combined with kernel performs the balancing t-test with the weighted covariates. See [R] ttest

Reporting report Displays the inference of the included covariates or the estimation of the Propensity Score when option kernel is specified. nostar Removes the inference stars from the p-values.

-------------------------------------------------------------------------

Example

Install diff and/or check for updates.

ssc inst diff, replace

1. Diff-in-Diff with no covariates. We use the dataset form Card & Krueger (1994)*.

net get diff

use cardkrueger1994, clear

diff fte, t(treated) p(t)

For bootstrapped std. err.:

diff fte, t(treated) p(t) bs rep(50)

2. Diff-in-Diff with covariates.

diff fte, t(treated) p(t) cov(bk kfc roys) diff fte, t(treated) p(t) cov(bk kfc roys) report diff fte, t(treated) p(t) cov(bk kfc roys) report bs

3. Kernel Propensity Score Diff-in-Diff.

diff fte, t(treated) p(t) cov(bk kfc roys) kernel id(id) diff fte, t(treated) p(t) cov(bk kfc roys) kernel id(id) support diff fte, t(treated) p(t) kernel id(id) ktype(gaussian) pscore(_ps)

4. Quantile Diff-in-Diff.

diff fte, t(treated) p(t) qdid(0.25) diff fte, t(treated) p(t) qdid(0.50) diff fte, t(treated) p(t) qdid(0.75) diff fte, t(treated) p(t) qdid(0.50) cov(bk kfc roys) diff fte, t(treated) p(t) qdid(0.50) cov(bk kfc roys) kernel id(id)

5. Balancing test of covariates.

diff fte, t(treated) p(t) cov(bk kfc roys wendys) test diff fte, t(treated) p(t) cov(bk kfc roys wendys) test id(id) kernel

Saved results

diff saves the following list of scalars in r():

r(mean_c0) mean of output_var of the control group in period == 0 r(mean_t0) mean of output_var of the treated group in period == 0 r(diff0) difference of the mean of output_var between treated and control groups in period == 0 r(mean_c1) mean of output_var of the control group in period == 1 r(mean_t1) mean of output_var of the treated group in period == 1 r(diff1) difference of the mean of output_var between treated and control groups in period == 1 r(diffdiff) differences in differences - Treatment Effect r(se_c0) Standard Error of the mean of output_var of the control group in period == 0 r(se_t0) Standard Error of the mean of output_var of the treated group in period == 0 r(se_d0) Standard Error of the difference of output_var between the treated and control groups in period == 0 r(se_c1) Standard Error of the mean of output_var of the control group in period == 1 r(se_t1) Standard Error of the mean of output_var of the treated group in period == 1 r(se_d1) Standard Error of the difference of output_var between the treated and control groups in == 0 r(se_dd) Standard Error of the difference in difference

References

Single diff-in-diff:

Card, D., Krueger, A. "Minimum Wages and Employment: A Case Study of the Fast-Food Industry in New Jersey and Pennsylvania". The American Economic Review, Vol. 84, No. 4 (Sep., 1994), pp. 772-793.

Kernel diff-in-diff:

Heckman, J., Ichimura, H., Todd, P. "Matching As an Econometric Evaluation Estimator". The Review of Economic Studies, Vol. 65, No. 2 (Apr., 1998), pp. 261-294.

Quantile diff-in-diff:

Meyer, B., Viscusi, W., . "Workers' Compensation and Injury Duration: Evidence from a Natural Experiment". The American Economic Review, Vol. 85, No.3 (Jun., 1995), pp. 322-340.

Author

Juan M. Villa Brooks World Poverty Institute University of Manchester juan.villalora@postgrad.manchester.ac.uk

Please cite as: Villa, Juan M. 2011. DIFF: Stata Module to Perform Differences in Differences Estimation. Statistical Software Components. Boston College Department of Economics.

Update: Nov - 2012. Click here periodically to get the lastest version. *Acknowledgements to Kit Baum for valuable comments.