Panel Event Studies (Difference-in-Differences)

Panel event study methodology with TWFE and Sun & Abraham (2021) estimator for staggered treatment designs.

Overview

Panel event studies combine the event study framework with Difference-in-Differences (DiD) estimation. This approach is particularly useful when studying policy changes or regulatory events that affect multiple firms at different times.

The R package v0.40.0 implements three panel estimators with cluster-robust standard errors.

When to Use Panel Event Studies

  • Staggered treatment: Firms are affected by a policy at different dates
  • Control group available: You have untreated firms for comparison
  • Policy evaluation: Measuring the causal effect of regulation, law changes, etc.
  • Long panel data: Multiple firms observed over many time periods

Static TWFE Estimator

The Two-Way Fixed Effects (TWFE) estimator includes firm and time fixed effects:

\[ Y_{i,t} = \alpha_i + \gamma_t + \beta \cdot D_{i,t} + \varepsilon_{i,t} \]

where:

  • \(\alpha_i\) = Firm fixed effects
  • \(\gamma_t\) = Time fixed effects
  • \(D_{i,t}\) = Treatment indicator (1 if firm \(i\) is treated at time \(t\))
  • \(\beta\) = Average treatment effect

Usage in R

library(EventStudy)

panel_task <- PanelEventStudyTask$new(
  data = panel_data,
  unit_id = "firm_id",
  time_id = "date",
  treatment = "treated",
  outcome = "return"
)

# Static TWFE
result <- panel_task$estimate_twfe()
summary(result)

Dynamic TWFE Estimator

The dynamic specification includes leads and lags around treatment:

\[ Y_{i,t} = \alpha_i + \gamma_t + \sum_{k \neq -1} \beta_k \cdot D_{i,t}^k + \varepsilon_{i,t} \]

This allows you to:

  • Test the parallel trends assumption using pre-treatment coefficients
  • Trace out the dynamic treatment effect over time
  • Identify whether effects are temporary or permanent
# Dynamic TWFE with leads and lags
result <- panel_task$estimate_twfe(dynamic = TRUE, leads = 5, lags = 10)
plot(result)

Sun & Abraham (2021) Estimator

When treatment is staggered (firms treated at different times), standard TWFE can produce biased estimates due to “forbidden comparisons” between early and late treated units. The Sun & Abraham (2021) interaction-weighted estimator resolves this:

# Sun & Abraham interaction-weighted estimator
result <- panel_task$estimate_sun_abraham(leads = 5, lags = 10)
summary(result)
plot(result)

Why Sun & Abraham?

  • Unbiased under staggered treatment timing
  • Robust to heterogeneous treatment effects across cohorts
  • Interpretable cohort-specific treatment effects

Cluster-Robust Standard Errors

All panel estimators compute cluster-robust standard errors via sandwich::vcovCL(), clustering at the firm level by default:

# Standard errors are automatically clustered at the unit level
result <- panel_task$estimate_twfe()
result$std_errors  # Cluster-robust SEs

Diagnostic Checks

  1. Pre-trend test: Check that pre-treatment coefficients are jointly zero
  2. Visual inspection: Plot dynamic coefficients with confidence intervals
  3. Placebo tests: Artificially shift treatment timing as a falsification test

References

  • Miller, D.L. (2023). An Introductory Guide to Event Study Models. Journal of Economic Perspectives, 37(2), 203-230.
  • Sun, L. & Abraham, S. (2021). Estimating dynamic treatment effects in event studies with heterogeneous treatment effects. Journal of Econometrics, 225(2), 175-199.
  • Goodman-Bacon, A. (2021). Difference-in-differences with variation in treatment timing. Journal of Econometrics, 225(2), 254-277.