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

Goodman-Bacon decomposition: what your TWFE estimate is averaging (bacondecomp)

Source bacondecomp — Flack; Goodman-Bacon (2021)
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

A staggered-adoption panel

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

What happens here

Units switch treatment on at different dates. The TWFE coefficient you'd normally report hides a lot of structure.

Formula
y_{it}=\alpha_i+\gamma_t+\beta^{TWFE}D_{it}+\varepsilon_{it}
Reads fromNot specified Feeds intoNot specified
Key code
# unit, year, y, treated (0/1, turns on and stays on)

Reference / docs ↗

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-adoption panel: units adopting treatment at different times, with a binary treatment indicator.

Show data format & exampleHide example

Format — long panel: unit, time, outcome y, treatment treated (0/1, absorbing).

library(bacondecomp)
df_bacon <- bacon(y ~ treated, data = panel,
                  id_var = 'unit', time_var = 'year')
03
Read the evidence

Results & interpretation

1 figure Workflow discussion 2
01FigureGoodman-Bacon decomposition: each 2×2 DiD comparison's estimate vs. its TWFE weight, split by type — the 'later vs earlier treated' triangles are the risky ones.

Figures reproduced from bacondecomp — Flack; Goodman-Bacon (2021) — unofficial community showcase; all credit to the original authors.

Context & interpretation

⚠️ Unofficial community showcase of bacondecomp. Not affiliated with the authors; all credit to them.

A two-way fixed-effects DiD is a weighted average of all possible 2×2 comparisons — including 'forbidden' ones that use already-treated units as controls. This shows you the weights.

Peer notes

Discuss the workflow (2)

  • 2

    Every staggered-DiD paper should print this plot. Once you see the 'later vs earlier treated' weight, you can't unsee the TWFE problem.

  • 1

    Great diagnostic, but it's a diagnosis not a cure — pair it with Callaway-Sant'Anna or did2s when the bad comparisons carry weight.

IN THE MARGINS

Peer discussion