Beginner's Corner

Event Studies from Scratch: How to Plot and Interpret Treatment Dynamics

1 Motivation:

Policies Have Dynamics The basic difference-in-differences (DiD) estimator gives a single number: the average treatment effect. But most policies do not have a single, constant effect. A minimum wage increase might cause immediate employment changes, followed by longer-run adjustment. A training programme might have modest short-run effects but large long-run effects as workers gain experience. An event study allows you to estimate and plot the full time path of a treatment effect not just its average.

Event studies serve two purposes:

  1. Credibility: Pre-treatment coefficients that are statistically indistinguishable from zero support the parallel trends assumption.
  2. Dynamics: Post-treatment coefficients reveal whether effects are immediate, delayed, growing, or fading.

2 The Motivating Example

Suppose a government raises the minimum wage in some states in 2016 and other states remain unaffected. You have annual data on fast-food employment from 2010 to 2022 for all states. You want to know: (a) did employment trends look similar in the two groups before 2016?  (b) what happened to employment in the years after the wage increase? An event study answers both questions in a single figure.

3 The Event Study Specification

3.1 Relative Time

The key building block is relative time: the number of periods before or after treatment for each treated observation. Define:

$$k_{it} = t - g_i$$
(1)

where gi is the year unit i was first treated (for untreated units, this is undefined or set to ∞). An observation at relative time $k=-2$ is two years before treatment; at $k=+3.$ three years after.

3.2 The Regression

The event study regression replaces the single treatment indicator with a full set of relative-time dummies:

$$Y_{it} = \alpha_i + \lambda_t + \sum_{\substack{k=-K \\ k \neq -1}}^{H} \beta_k \cdot \mathbf{1}[k_{it} = k] + \varepsilon_{it}$$
(2)

Here αt are unit fixed effects (absorbing time-invariant differences between states), λt are time fixed effects (absorbing common trends), and βk are the event-study coefficients. The period k=-1 (one year before treatment) is omitted as the reference category: all coefficients are estimated relative to outcomes in the period just before treatment.

The coefficients are interpreted as follows:

  • ˆβ−2, ˆβ−3,...: pre-treatment differences between treated and control groups, relative to k =−1. Under parallel trends, these should be zero (or at least statistically insignificant).
  • ˆβ0, ˆβ+1, ˆβ+2,...: post-treatment effects at each horizon, relative to outcomes one period before treatment.

4 A Numerical Example

Table 1 shows stylised data for two states: State A (treated in 2016) and State B (never treated), with employment measured as log fast-food jobs. The difference is constant at -0.3 before 2016 (parallel pre-trends), then falls to -0.6, -0.7, and -0.8 after treatment.

The event study coefficients, relative to k = -1, would be:

Table 1: Stylised employment data: treated (A) and control (B) states
Year State A (D = 1) State B (D = 0) Difference (A–B) Relative time
201310.210.5−0.3k = −3
201410.410.7−0.3k = −2
201510.610.9−0.3k = −1
201610.511.1−0.6k = 0
201710.611.3−0.7k = +1
201810.711.5−0.8k = +2

This suggests the minimum wage caused employment to fall by 0.3 log-points immediately and by 0.5 log-points two years later a growing negative effect.

5 Reading an Event Study Plot

Figure 1 illustrates a typical event study plot.

$$\text{MDE} = (z_{1-\alpha/2} + z_{1-\kappa}) \cdot \sqrt{\frac{1}{nP(1-P)}} \sigma \tag{10}$$

Figure 1: Stylised event study plot. Blue circles: pre-treatment coefficients (near zero, supporting parallel trends).  Red circles: post-treatment coefficients (negative and growing). Vertical lines are 95% confidence intervals.

Key features to look for:

  1. Pre-trend coefficients near zero: All pre-treatment ˆβk should be close to zero and statistically insignificant. A pre-trend (systematic drift before treatment) is evidence against parallel trends.
  2. Post-treatment coefficients: Their sign, magnitude, and trajectory tell you about the treatment effect. Immediate effects point to ˆβ̂₀ ≠ 0 delayed effects show up as ˆβ1,ˆβ2 growing over time.
  3. Confidence intervals: Wide intervals in early pre-periods are common (fewer observations at long leads). The key test is whether intervals include zero.

6 R Code: Running an Event Study library (fixest)

R Code: Event study using fixest
library(fixest)

# Assume df has columns: unit, year, y (outcome),
#   treat_year (year of treatment, NA if never treated)

# Create relative-time variable
df$rel_time <- df$year - df$treat_year
df$rel_time[is.na(df$treat_year)] <- NA

# Estimate event study using fixest
# i() creates relative-time dummies; ref=-1 drops k=-1
es <- feols(y ~ i(rel_time, ref = -1) | unit + year,
            data = df, cluster = ~unit)

# Plot the event study
iplot(es, main = "Event Study", xlab = "Relative time")

The i() syntax in fixest creates all the relative-time dummies automatically. iplot()generates a publication-quality event study figure with confidence intervals.

7 Common Mistakes

  • Forgetting the reference period: Without omitting k = -1, the model is collinear. Always normalise to one pre-period.
  • Pooling relative-time bins: When the pre-treatment window is long, coefficients at k = -6 and beyond often have wide confidence intervals. Binning the endpoints (e.g. k ≤−5 as a single indicator) is common and acceptable.
  • Confusing pre-trend tests with proof: Flat pre-trends are consistent with parallel trends but do not prove it. As Roth [2022] shows, pre-trend tests can have low power if the treatment is anticipated or if the pre-period is short.
  • Staggered treatment: When units are treated at different times, the standard TWFE event study can be biased. Use Sun and Abraham [2021] (via sunab() in fixest) or Callaway and Sant'Anna [2021] instead.

8 Where to Learn More Good next steps include:

  • Callaway and Sant'Anna [2021] for staggered DiD event studies
  • Rambachan and Roth [2023] for sensitivity analysis when pre-trends are not flat
  • Roth [2022] on the power of pre-trend tests
  • The fixest vignette for event study plotting in R

9 Conclusion

The event study is one of the most powerful and communicative tools in applied econometrics. It is simultaneously a credibility check (pre-trends) and a policy-relevant result (dynamic treatment effects). Mastering it is essential for any researcher working with panel data and difference-in-differences.

References

  1. Callaway, B. and Sant'Anna, P. H. C. Difference-in-differences with multiple time periods. Journal of Econometrics, 225(2):200-230, 2021.
  2. Rambachan, A. and Roth, J. A more credible approach to parallel trends. Review of Economic Studies, 90(5):2555-2591, 2023.
  3. Roth, J. Pre-test with caution: Event-study estimates after testing for parallel trends. American Economic Review: Insights, 4(3):305-322, 2022.
  4. Sun, L. and Abraham, S. Estimating dynamic treatment effects in event studies with heterogeneous treatment effects. Journal of Econometrics, 225(2):175-199, 2021.

Continue Reading

Browse All Sections →
Home
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.

Article Title