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

Difference-in-differences on 20 stores over 8 months: estimate, clustered interval and event study

ToolDifference-in-Differences and ITS
Sourceoriginal
LevelUndergraduate

Problem

Ten stores start a loyalty program in month 5 and ten do not. Monthly sales per store are recorded for 8 months (160 rows). Estimate the change in the program stores beyond the change in the comparison stores, with errors clustered by store, and check the gaps before the program.

Inputs to Enter

  • Rows: 160 seeded illustrative rows of unit, period, treated, outcome; first treated period 5
  • Standard errors: cluster-robust by unit; confidence level 95 %
Open the Difference-in-Differences and ITS tool

Answers

  • Means: treated 102.25 before and 115.26 after; comparison 105.69 before and 110.03 after
  • Estimate = (115.26 − 102.25) − (110.03 − 105.69) = 8.67 (8.665 from the unrounded means), 8.1 % of the counterfactual 106.59
  • Cluster-robust: SE 0.708, t = 12.23 on 19 degrees of freedom, p < 0.0001, interval 7.18 to 10.15
  • Classical and HC1 are the same number here, SE 1.681 (four cells of 40 rows each), interval 5.34 to 11.99
  • Event study, reference month 4: gaps before 1.64, 0.70, 0.97 with joint test F(3, 19) = 0.22, p = 0.8802; gaps after 9.52, 10.20, 10.03, 8.22

Notes

Open this case in the tool: /analysis-tools/statistics/regression/difference-in-differences/?try=clear-effect. Here the clustered error is smaller than the classical one (0.42 times): lasting differences between stores, which the classical error counts as noise, drop out of the before-to-after comparison within a store. Seeded illustrative data, no real program, place or person; every figure is checked against an independent numpy and scipy computation. The estimate is a statistical association under the stated assumption, not a finding of cause.

More Examples for This Tool