Tools › Statistics › Regression and Modeling › Difference-in-Differences and ITS


Difference-in-Differences and ITS

Paste rows of unit, period, treated and outcome (or enter four group means) and get the difference-in-differences estimate with classical, heteroskedasticity-robust and cluster-robust standard errors, a period-by-period event study with a joint test of the pre-period gaps, and a chart of the two groups with the counterfactual drawn in. Or paste one time series with an intervention time and get the segmented regression of an interrupted time series (level change and slope change) with Newey-West errors and residual diagnostics. The page reports a statistical association under stated assumptions; it does not establish that the change caused the difference. Use unit codes, not names, and do not paste data that identifies people.

  • Difference-in-differences from pasted rows: the estimate from the four means and the same number from the regression with an interaction, with three kinds of standard error side by side

  • Event study of leads and lags with a joint test of the pre-period gaps, when the data have three or more periods

  • Interrupted time series: level change, slope change, the change at the last observation and the average change, with Newey-West errors, Durbin-Watson and residual autocorrelations

  • A chart of the visitor's own case with the counterfactual dashed and the estimate bracketed and labeled

Difference-in-Differences and ITS

Design


Two lines over before and after: the comparison group rises a little, the treated group rises more; a dashed line continues the treated group parallel to the comparison group, and a bracket between the dashed line and the treated group after the change is the estimate
The same two-group picture with the four means named: treated before, treated after, comparison before, comparison after; the estimate is the treated change minus the comparison change
One series of points with a fitted line before the intervention time, the line continued dashed, and a second fitted line after it: the gap at the intervention time is the level change and the difference of the two slopes is the slope change

Rows: unit, period, treated, outcome

Sample rows S01, 4, 1, 112.6 and S01, 5, 1, 121.9 and S11, 4, 0, 104.3 under the column names unit, period, treated, outcome and an optional covariate




Treated group, before




Treated group, after




Comparison group, before




Comparison group, after





Rows: time, outcome

Sample rows 23, 262.4 and 24, 259.8 and 25, 231.0 under the column names time, outcome and an optional control series; the intervention time is the time of the first row after the change, here 25








Report






References

Bernal, J. L., Cummins, S., and Gasparrini, A. (2017). "Interrupted Time Series Regression for the Evaluation of Public Health Interventions: A Tutorial." International Journal of Epidemiology, Vol. 46, No. 1, pp. 348–355.

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

Newey, W. K., and West, K. D. (1987). "A Simple, Positive Semi-Definite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix." Econometrica, Vol. 55, No. 3, pp. 703–708.


DISCLAIMER: The methods and calculation on aNOWysis.com are provided as means to educate the reader. There is no warranty, expessed or implied, as to the relevance or accuracy of the methods or calculations. All calculations should be checked by a qualified analyst for appropriateness and accuracy. We will not be held liable for any damages, injuries or deaths caused by using methods or calculations from this site.