Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
brycewang-stanford avatar

Event Study

  • 4 installs
  • 3.2k repo stars
  • Updated August 4, 2026
  • brycewang-stanford/awesome-agent-skills-for-empirical-research

event-study runs causal-inference event studies and difference-in-differences designs in R, routing between a traditional TWFE specification and five modern estimators built for staggered treatment adoption.

About

Walks an R user through the full causal-inference event-study workflow on panel data: a three-step decision tree routes uniform treatment timing to a traditional TWFE event study with fixest and staggered adoption to five modern robust estimators, from Callaway and Sant'Anna's did package to Sun and Abraham via sunab(), Gardner's did2s, de Chaisemartin and D'Haultfoeuille, and Borusyak-Jaravel-Spiess imputation. Three reference files add joint pre-trend Wald tests, Bacon decomposition, placebo and permutation checks, and HonestDiD sensitivity analysis. Every plot follows the economics-journal standard the skill enforces: discrete point estimates with vertical 95% error bars, never connected lines with shaded ribbons.

  • Decision tree run before any code: uniform treatment timing gets TWFE with fixest, staggered gets robust estimators
  • Five modern estimators with runnable R code: Callaway-Sant'Anna, Sun-Abraham, did2s, DIDmultiplegt, and imputation
  • Diagnostics cover joint pre-trend Wald tests, Bacon decomposition, placebo checks, and permutation inference
  • Enforces economics-journal plots: discrete point estimates with vertical 95% error bars, never shaded ribbons
  • Flags Roth (2022) pre-test bias: flat pre-trends are necessary but not sufficient evidence of parallel trends

Event Study by the numbers

  • 4 all-time installs (skills.sh)
  • Ranked #1,625 of 2,064 Data Science & ML skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

event-study capabilities & compatibility

Capabilities
event study plot · difference in differences · parallel trends test · causal inference
Use cases
data analysis · research
From the docs

What event-study says it does

The parallel trends assumption states that, absent treatment, treated and control units would have followed the same trajectory.
SKILL.md
Pre-trend coefficients near zero are necessary (but not sufficient) evidence for this.
SKILL.md
npx skills add https://github.com/brycewang-stanford/awesome-agent-skills-for-empirical-research --skill event-study

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs4
repo stars3.2k
Last updatedAugust 4, 2026
Repositorybrycewang-stanford/awesome-agent-skills-for-empirical-research

What it does

Estimating dynamic treatment effects and testing parallel pre-trends on panel data in R, including staggered treatment adoption, and producing publication-ready event-study coefficient plots.

Who is it for?

Researchers and data scientists estimating dynamic treatment effects on panel data in R, especially under staggered treatment adoption

Skip if: Finance abnormal-return event studies around announcements, cross-sectional data without treatment timing, or non-R workflows

When should I use this skill?

The user asks for an event study plot, a parallel pre-trends test, dynamic treatment effects, or a difference-in-differences design with staggered treatment adoption in R

What you get

A defensible event-study analysis: an estimator matched to the treatment-timing structure, pre-trend and placebo diagnostics, and a publication-ready coefficient plot with unit-clustered standard errors.

  • Publication-ready event-study coefficient plot (geom_point plus geom_errorbar with 95% confidence intervals)
  • Dynamic treatment effect estimates with unit-clustered standard errors
  • Pre-trend joint tests, Bacon decomposition, placebo and permutation diagnostics

By the numbers

  • 3-step decision tree run before writing any code
  • 6-step workflow for any event study request
  • 8 key R packages in the package table

Files

SKILL.mdMarkdownGitHub ↗

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:

1. 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.

2. 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

3. 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:

1. Understand the data: Identify the panel structure (unit ID, time variable, treatment indicator, outcome). Ask the user if not clear. 2. Determine treatment timing: Is it uniform or staggered? 3. Choose the estimator: Use the decision tree above. 4. Estimate the model: Follow the relevant reference file. 5. Create the plot: Always produce a clean, publication-ready event study plot. 6. 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 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.

Key R Packages

PackagePurposeWhen to use
fixestTWFE event studies, Sun & AbrahamDefault starting point
didCallaway & Sant'Anna estimatorStaggered treatment, heterogeneous effects
did2sGardner (2022) two-stage DiDStaggered treatment, clean decomposition
DIDmultiplegtde Chaisemartin & D'HaultfoeuilleStaggered, robust to heterogeneity
bacondecompBacon decompositionDiagnosing TWFE problems
HonestDiDSensitivity analysis for pre-trendsRobustness checks on parallel trends
ggplot2PlottingAlways
modelsummaryRegression tablesWhen user needs tables

Plotting Standards

All event study plots should follow these defaults (user can override):

  • Use ggplot2 with theme_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 period t should 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.

Related skills

How it compares

Causal-inference event studies (difference-in-differences on panel data in R), not finance abnormal-return event studies; for market-reaction CAR analysis around announcements see grad-event-study instead.

FAQ

Which estimator does it recommend for staggered treatment?

Its guidance starts most applied work with Callaway and Sant'Anna via the did package as the most flexible and well-tested choice, suggests Sun and Abraham's sunab() for fixest users, and advises running two or three estimators to check that results are qualitatively similar.

Does passing a pre-trends test prove parallel trends?

No. The skill cites Roth (2022): pre-trend coefficients near zero are necessary but not sufficient, conditioning on passing the test introduces bias, and it recommends HonestDiD sensitivity analysis as a complement.

What plotting format does it enforce?

Discrete point estimates with vertical 95% error bars (geom_point plus geom_errorbar), dashed reference lines at t = 0 and y = 0, and an explicitly normalized reference period, the standard format in economics journals.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.