18/36
Part 3 of 6 · Parallel trendsLearn and do

An event study shows the gap week by week

The placebo checks one fake date. An event study checks every week.

for extra in (0.0, 0.3):
    y, treated, post, week = panel(0, extra_trend=extra)
    e = event_study(y, treated, week, 8)
    print(f"extra trend {extra}")
    print("  weeks -8 to -1:", " ".join(f"{v:5.2f}" for v in e[:8]))
    print("  weeks  0 to  7:", " ".join(f"{v:5.2f}" for v in e[8:]))
extra trend 0.0
  weeks -8 to -1:  0.21  0.46  0.43  0.33  0.34  0.51  0.52  0.00
  weeks  0 to  7:  2.54  2.71  2.18  2.40  1.94  2.12  2.04  2.43
extra trend 0.3
  weeks -8 to -1: -1.89 -1.34 -1.07 -0.87 -0.56 -0.09  0.22  0.00
  weeks  0 to  7:  2.84  3.31  3.08  3.60  3.44  3.92  4.14  4.83

The two-period estimate averages the effect over all post weeks and the trend over all pre weeks. An event study shows every week. It takes the treated-minus-control gap in each week and subtracts the gap in the last week before launch, the reference week. Here is the printed output as a plot:

Each week's gap against week -1, before noise
-2024-8-107weeks since launchthe gap
parallel trends treated cities trend 0.3 a week faster

Week -1 is the reference, at 0. With parallel trends the gap is flat before launch and steps up after.

Before launch the points should hover around zero with no slope. After launch they show the effect week by week: whether it lands at once, builds or fades.

A regression gives the same numbers plus a standard error for each. It uses dummies, columns of 0s and 1s. There's one for each city and one for each week, called city and week fixed effects, and one treated-times-week dummy for every week except the reference. In a balanced panel with one launch date, its coefficients match the numbers above to 1e-12 on the practice data. Their standard errors, clustered by city, run from 0.44 to 0.63 on this panel.

  • The parallel series is flat before launch and steps up by about 2 at launch. Its pre-launch points all sit a little above zero. That's because every point is measured against the same week, and that week's gap happened to come in low. Each is within one standard error of zero, two of them only just, so none comes near significance.
  • The other series climbs about 0.3 a week before launch and keeps climbing after. No amount of staring separates the effect from the trend. That's a failed check.

In the editor, write event_study(y, treated, week, start_week): the gap for every week, against week 7.