event-study
Skill35 starsChanged 8 months agoMITView on GitHub
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", "Callaway and Sant'Anna", "de Chaisemartin", "Borusyak", "did_multiplegt", "fixest", "did2s", "bacon decomposition", or any reference to plotting coefficients around a treatment event. Also trigger when the user uploads panel data and wants to estimate treatment effects with variation in treatment timing. All code is in R.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- rgourley/quant-garagetheir own version, first seen Nov 1, 2026
- xjtulyc/awesome-rosetta-skillstheir own version, first seen Mar 17, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- xjtulyc/awesome-rosetta-skills★ 34same name
- rgourley/quant-garage★ 7same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- econ-abstract-writingSkill
- academic-writingSkill
- code-walkthroughSkill
- anti-hallucinationSkill
- econ-intro-writingSkill
- lit-review-tableSkill
- academic-paper-verifySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 15 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Use this skill when the user wants to:
- Distinctive: line 25
Create event study plots (coefficient plots around a treatment event)
- Distinctive: line 26
Test for parallel pre-trends in a difference-in-differences design
- Distinctive: line 34
Before writing any code, determine the user's situation:
- Distinctive: line 41
No strong reason → Traditional TWFE may still be OK, but consider robust alternatives.
- Distinctive: line 72
Choose the estimator: Use the decision tree above.
- Distinctive: line 73
Estimate the model: Follow the relevant reference file.
- Distinctive: line 74
Create the plot: Always produce a clean, publication-ready event study plot.
- Distinctive: line 79
Read these as needed based on the user's situation:
- Distinctive: line 82
Read this for any event study request.
- Distinctive: line 86
Read this when treatment timing varies across units or when the user asks about heterogeneous treatment effects, or any of the newer DiD …
- Distinctive: line 108
All event study plots should follow these defaults (user can override):
- Very specific: line 110
Use ggplot2 with theme_minimal() or a clean custom theme
- Very specific: line 114
NOT connected lines with shaded ribbons (geom_line + geom_ribbon).
- Distinctive: line 119
Use colorblind-friendly palettes when comparing multiple groups
- Distinctive: line 120
If comparing estimators, use facets or distinct colors/shapes with a legend
- Distinctive: line 124
Forgetting to set the reference period: Always drop one pre-treatment period.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Event Study Skill
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.
When to Use This Skill
Use this skill when the user wants to:
- Create event study plots (coefficient plots around a treatment event)
- Test for parallel pre-trends in a difference-in-differences design
- Estimate dynamic treatment effects
- Work with staggered treatment adoption (units treated at different times)
- Implement any of the modern DiD estimators (Callaway & Sant'Anna, Sun & Abraham, etc.)
- Diagnose problems with TWFE under treatment effect heterogeneity
Quick Decision Tree
Before writing any code, determine the user's situation:
- Is treatment timing the same for all treated units?
- Yes → Traditional TWFE event study is fine. See
traditional-event-study.md - No (staggered) → Go to step 2.
- Yes → Traditional TWFE event study is fine. See
- Is there reason to expect heterogeneous treatment effects across cohorts or over time?
- No strong reason → Traditional TWFE may still be OK, but consider robust alternatives.
- Yes or unsure → Use a robust estimator. See
modern-extensions.md
- What is the user's goal?
- Quick visualization of pre-trends → Traditional approach, fast and familiar.
- Publication-quality estimation → Recommend a robust estimator + traditional as comparison.
- Diagnostic check → Bacon decomposition to understand TWFE weights.
Core Concepts (Brief)
An 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:
- Relative time: Time reindexed so that treatment occurs at period 0 for each unit.
- Baseline/reference period: Usually t = -1 (omitted from regression, normalized to zero).
- Pre-trend coefficients: Periods before treatment. If these are close to zero, it supports the parallel trends assumption.
- Post-treatment coefficients: These capture the dynamic treatment effect over time.
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.
Workflow
For any event study request, follow this general workflow:
- Understand the data: Identify the panel structure (unit ID, time variable, treatment indicator, outcome). Ask the user if not clear.
- Determine treatment timing: Is it uniform or staggered?
- Choose the estimator: Use the decision tree above.
- Estimate the model: Follow the relevant reference file.
- Create the plot: Always produce a clean, publication-ready event study plot.
- Interpret results: Discuss pre-trends, post-treatment dynamics, and any concerns.
Reference Files
Read these as needed based on the user's situation:
traditional-event-study.md- Traditional TWFE event study withfixest. 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.
Key R Packages
| 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 |
Plotting Standards
All event study plots should follow these defaults (user can override):
- Use
ggplot2withtheme_minimal()or a clean custom theme - Include a vertical dashed line at t = 0 (treatment onset)
- Include a horizontal dashed line at y = 0 (null effect)
- IMPORTANT: Use discrete point estimates with vertical error bars (
geom_point+geom_errorbar), NOT connected lines with shaded ribbons (geom_line+geom_ribbon). Each periodtshould show an individual point with its own error bar. This is the standard format in economics journals. - Show 95% confidence intervals as error bars (vertical lines at each point)
- Label axes clearly: "Periods Relative to Treatment" (x) and the outcome name (y)
- Normalize the reference period coefficient to 0 explicitly
- Use colorblind-friendly palettes when comparing multiple groups
- If comparing estimators, use facets or distinct colors/shapes with a legend
Common Pitfalls to Watch For
- Forgetting to set the reference period: Always drop one pre-treatment period.
- Binning endpoint periods: With limited pre/post periods, bin the endpoints (e.g., "-5+" and "5+") to avoid small-sample noise.
- Not-yet-treated as controls: In staggered settings, TWFE uses not-yet-treated units as controls, which can introduce bias if treatment effects are heterogeneous.
- Interpreting pre-trends as proof of parallel trends: Pre-trends being zero is necessary but not sufficient. Absence of evidence is not evidence of absence.
- Unbalanced panels: Missing observations can distort event study estimates, especially at the endpoints.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

