Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use this skill whenever the user wants to conduct an event study, create event study plots, test for parallel trends, implement difference-in-differences designs, or work with any panel data estimation that involves pre/post treatment comparisons. Trigger on phrases like "event study", "parallel trends", "pre-trends", "dynamic treatment effects", "leads and lags", "TWFE", "two-way fixed effects", "staggered adoption", "staggered treatment", "difference-in-differences", "DiD", "Sun and Abraham",
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 20% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 74% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 29% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 69% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 75% | 0% |
This skill covers everything needed to conduct event studies in R - from the traditional two-way fixed effects (TWFE) approach through modern robust estimators that handle staggered treatment timing and heterogeneous treatment effects.
Use this skill when the user wants to:
Before writing any code, determine the user's situation:
traditional-event-study.mdmodern-extensions.mdAn event study plot displays estimated coefficients for leads (pre-treatment periods) and lags (post-treatment periods) relative to a baseline period (typically one period before treatment). The key elements are:
the parallel trends assumption.
The parallel trends assumption states that, absent treatment, treated and control units would have followed the same trajectory. Pre-trend coefficients near zero are necessary (but not sufficient) evidence for this.
For any event study request, follow this general workflow:
indicator, outcome). Ask the user if not clear.
Read these as needed based on the user's situation:
traditional-event-study.md - Traditional TWFE event study with fixest.Read this for any event study request. It covers the baseline approach, plotting, and the assumptions behind it.
modern-extensions.md - Modern robust estimators for staggered designs.Read this when treatment timing varies across units or when the user asks about heterogeneous treatment effects, or any of the newer DiD methods.
diagnostics-and-testing.md - Pre-trend testing, placebo checks,Bacon decomposition, sensitivity analysis. Read this when the user wants to validate their design or when you spot potential issues.
| Package | Purpose | When to use | |---------|---------|-------------| | fixest | TWFE event studies, Sun & Abraham | Default starting point | | did | Callaway & Sant'Anna estimator | Staggered treatment, heterogeneous effects | | did2s | Gardner (2022) two-stage DiD | Staggered treatment, clean decomposition | | DIDmultiplegt | de Chaisemartin & D'Haultfoeuille | Staggered, robust to heterogeneity | | bacondecomp | Bacon decomposition | Diagnosing TWFE problems | | HonestDiD | Sensitivity analysis for pre-trends | Robustness checks on parallel trends | | ggplot2 | Plotting | Always | | modelsummary | Regression tables | When user needs tables |
All event study plots should follow these defaults (user can override):
ggplot2 with theme_minimal() or a clean custom themegeom_point + geom_errorbar),NOT connected lines with shaded ribbons (geom_line + geom_ribbon). Each period t should show an individual point with its own error bar. This is the standard format in economics journals.
(e.g., "-5+" and "5+") to avoid small-sample noise.
units as controls, which can introduce bias if treatment effects are heterogeneous.
necessary but not sufficient. Absence of evidence is not evidence of absence.
especially at the endpoints.
Other measured skills in the registry, with their headline benchmark lift.