Skip to content
StatsOtter A workspace for causal thinking
Method library WORKFLOW / 020
Research workflow/4 steps

Two-stage difference-in-differences (did2s)

Source did2s — Butts & Gardner
01
The method workspace

Follow the analysis.

Select a node to explore the method

Method mapInput → 4 steps → output
START WITHInput data
ARRIVE ATResults
Read step 01
Inside the methodReasoning, equations & implementation
Step 1 of 4
01
Data prep

Staggered panel + relative event time

Data preparation — shapes the raw inputs into what the estimator expects.

What happens here

Unit × period; treatment indicator and event time relative to first treatment.

Reads fromNot specified Feeds into#2
Key code
# id · year · treat · rel_year · y
Discussion on this step (0)
StatsOtterDiscussion starter · Editorial note

Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.

Questions to explore
  1. Which assumption matters most here, and what evidence could challenge it?
  2. What would you check before passing this output to the next step?

Peer discussion

  • Bring your experience, a question, or a different perspective.
02
Data contract

Inputs & data

A staggered panel: unit id, period, treatment indicator, relative event time.

Show data format & exampleHide example

Format — one row per (unit, period).

 id  year  treat  rel_year   y
  1  2003      0       -2    4.0
  1  2005      1        0    5.2
  2  2003      0       NA    3.9
03
Read the evidence

Results & interpretation

3 figures Workflow discussion 2
01Figuredid2s event-study estimates of the dynamic ATT.
02FigureTwo-stage estimates under heterogeneous treatment effects.
03Figuredid2s vs TWFE vs Callaway–Sant'Anna — the estimators side by side.

Figures reproduced from did2s — Butts & Gardner — unofficial community showcase; all credit to the original authors.

Context & interpretation

The did2s vignette. A lightweight alternative to Callaway-Sant'Anna for staggered designs. Unofficial summary.

Peer notes

Discuss the workflow (2)

  • 2

    Gardner's 2-stage trick is elegant: residualize on the untreated, then the second stage is just OLS. Fast on huge panels.

    2

    And it lines up with Callaway-Sant'Anna in practice — nice to show both agree.

  • 3

    did2s + fixest under the hood = blazing. My default for big staggered panels now.

IN THE MARGINS

Peer discussion