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

Title

diff-- Difference in differences estimation

Syntax

diffoutcome_var[if] [in] [weight],[options]

Description

diffperforms 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.diffis also suitable for estimating repeated cross section diff-in-diff (except for the kernel option).

Options

optionsDescription ------------------------------------------------------------------------- Model - Requiredperiod(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 optionkernelis selected these variables are used to generate the propensity score.kernelPerforms 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 inpscore(varname). This option requires theid(varname)of each individual, hence it is not compatible with repeated cross section.id(varname)Optionkernelrequires the supply of the identification variable.bw(#)Supplied bandwidth of the kernel. The default is the optimum bw estimated by Stata. See[R]kdensityktype(kernel)Specifies the kernel function; the default is epanechnikov. See[R] kdensityqdid(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 withkernelandcovoptions.qdiddoes not support weights nor robust standard errors. This option uses[R]qregand[R] bsqregfor bootstrapped standard errorspscore(varname)Supplied Propensity Score.logitSpecifies logit estimation of the Propensity Score. The default is Probit.supportPerforms diff on the common support of the propensity score given the optionkernel.SE/Robust

cluster(varname)Calculates clustered Std. Errors byvarname.robustCalculates robust Std. Errors.bsperforms a Bootstrap estimation of coefficients and standard errors.reps(int)Specifies the number of repetitions when thebsis selected. The default are 50 repetitions.Balancing test

testPerforms a balancing t-test of difference in means of the specified covariates between control and treated groups in period == 0. The optiontestcombined withkernelperforms the balancing t-test with the weighted covariates. See[R]ttestReporting

reportDisplays the inference of the included covariates or the estimation of the Propensity Score when optionkernelis specified.nostarRemoves the inference stars from the p-values.

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

ExampleInstall

diffand/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

diffsaves the following list of scalars inr():

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

ReferencesSingle 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.

AuthorJuan 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.