Difference-in-Differences

Recent Methodological Advances and their Relevance to Empirical Work

Brantly Callaway

August 1, 2024

Plan for the Workshop

\(\newcommand{\E}{\mathbb{E}} \newcommand{\E}{\mathbb{E}} \newcommand{\var}{\mathrm{var}} \newcommand{\cov}{\mathrm{cov}} \newcommand{\Var}{\mathrm{var}} \newcommand{\Cov}{\mathrm{cov}} \newcommand{\Corr}{\mathrm{corr}} \newcommand{\corr}{\mathrm{corr}} \newcommand{\L}{\mathrm{L}} \renewcommand{\P}{\mathrm{P}} \newcommand{\independent}{{\perp\!\!\!\perp}} \newcommand{\indicator}[1]{ \mathbf{1}\{#1\} } \newcommand{\T}{T}\)

  1. Intro to DID & Textbook 2 Period Case

  2. Staggered Treatment Adoption

    • Issues with Traditional Regression Approaches
    • New Approaches
  3. Application/Code for Minimum Wage Policy

Additional Resources

Additional Workshop Materials: https://bcallaway11.github.io/CDC/

  • Slides, code, data, etc.

References:

  • Callaway (2023), Handbook of Labor, Human Resources and Population Economics

  • Baker, Callaway, Cunningham, Goodman-Bacon, Sant’Anna (2024), draft posted very soon

Advanced Materials: https://github.com/bcallaway11/lsu-workshop

  • Relaxing the parallel trends assumption by including covariates

  • Dealing with more complicated treatment regimes

  • Alternative identification strategies (e.g., conditioning on lagged outcome, change-in-changes, others)

Part 1: Introduction to Difference-in-Differences

Natural Experimental Setting

Exploit a data structure where the researcher observes:

  1. Multiple periods of data

  2. Some pre-treatment data for all units

  3. Some units become treated while other units remain untreated

(In my view) this particular data setup is a key distinguishing feature of difference-in-differences approaches relative to traditional panel data models (i.e., fixed effects, dynamic panel, etc.)

  • This setup also explains why the methods we consider today are often grouped among natural experiment types of methods such as IV or RD.

Running Example: Causal effects of a state-level minimum wage increase on employment

  • Widely studied using DID identification strategies (Card and Krueger (1994), many others)

  • For today: very simplified version with (1) no changes in federal minimum wage and (2) “binarized” state minimum wages (i.e., state minimum wage is either above the federal minimum wage or not)

High-Level Thoughts

Panel data gives researchers the opportunity to follow the same person, firm, location, etc. over multiple time periods

Having this sort of data seems fundamentally useful for learning about causal effects of some treatment/policy variable.

To see this, the fundamental problem of causal inference is that we can either see a unit’s treated or untreated potential outcomes (but not both)

However, with panel data “natural experiment” setting above, this is not 100% true.

  • We can see both a unit’s treated and untreated potential outcome outcome…just at different points in time

  • This seems extremely useful for learning about causal effects

Treatment Effect Heterogeneity

Modern approaches also typically allow for treatment effect heterogeneity

  • That is, that effects of the treatment can vary across different units in potentially complicated ways

This is going to be a major issue in the discussion below

We’ll consider implications for “traditional” regression approaches and how new approaches are designed to handle this

Notation for Setting with Two Periods

Data:

  • 2 periods: \(t=1\), \(t=2\)

    • No one treated until period \(t=2\)
    • Some units remain untreated in period \(t=2\)
  • \(D_{i,t}\) treatment indicator in period \(t\)

  • 2 groups: \(G_i=1\) or \(G_i=0\) (treated and untreated)

Potential Outcomes: \(Y_{i,t}(1)\) and \(Y_{i,t}(0)\)

Observed Outcomes: \(Y_{i,t=2}\) and \(Y_{i,t=1}\)

\[\begin{align*} Y_{i,t=2} = G_i Y_{i,t=2}(1) +(1-G_i)Y_{i,t=2}(0) \quad \textrm{and} \quad Y_{i,t=1} = Y_{i,t=1}(0) \end{align*}\]

Target Parameter

Average Treatment Effect on the Treated: \[ATT = \E[Y_{i,t=2}(1) - Y_{i,t=2}(0) | G_i=1]\]

Explanation: Mean difference between treated and untreated potential outcomes in the second period among the treated group

How to Use Panel Data to Learn about \(ATT\)

Notice that: \[\begin{align*} ATT = \underbrace{\E[Y_{i,t=2}(1) | G_i=1]}_{\textrm{Easy}} - \underbrace{\E[Y_{i,t=2}(0) | G_i=1]}_{\textrm{Hard}} \end{align*}\]

With panel data, we can re-write this as

\[\begin{align*} ATT = \color{green}{\E[Y_{i,t=2}(1) - Y_{i,t=1}(0) | G_i=1]} - \color{red}{\E[Y_{i,t=2}(0) - Y_{i,t=1}(0) | G_i=1]} \end{align*}\]

The first term is how outcomes changed over time for the treated group

  • Notice that: in our “natural experiment” setting, this is a difference between treated and untreated potential outcomes

  • We can directly estimate this from the data

How to Use Panel Data to Learn about \(ATT\)

Notice that: \[\begin{align*} ATT = \underbrace{\E[Y_{i,t=2}(1) | G_i=1]}_{\textrm{Easy}} - \underbrace{\E[Y_{i,t=2}(0) | G_i=1]}_{\textrm{Hard}} \end{align*}\]

With panel data, we can re-write this as

\[\begin{align*} ATT = \color{green}{\E[Y_{i,t=2}(1) - Y_{i,t=1}(0) | G_i=1]} - \color{red}{\E[Y_{i,t=2}(0) - Y_{i,t=1}(0) | G_i=1]} \end{align*}\]

The second term is how outcomes would have changed over time if the treated group had not been treated

  • This is not directly observed in the data \(\implies\) we need to make identifying assumptions
  • There are many possibilities here:
    1. Before-after: \(\color{red}{\E[Y_{i,t=2}(0) - Y_{i,t=1}(0) | G_i=1]} = 0\)

How to Use Panel Data to Learn about \(ATT\)

Notice that: \[\begin{align*} ATT = \underbrace{\E[Y_{i,t=2}(1) | G_i=1]}_{\textrm{Easy}} - \underbrace{\E[Y_{i,t=2}(0) | G_i=1]}_{\textrm{Hard}} \end{align*}\]

With panel data, we can re-write this as

\[\begin{align*} ATT = \color{green}{\E[Y_{i,t=2}(1) - Y_{i,t=1}(0) | G_i=1]} - \color{red}{\E[Y_{i,t=2}(0) - Y_{i,t=1}(0) | G_i=1]} \end{align*}\]

The second term is how outcomes would have changed over time if the treated group had not been treated

  • This is not directly observed in the data \(\implies\) we need to make identifying assumptions

  • There are many possibilities here:

    1. Lagged outcome unconfoundedness: \(\color{red}{\E[Y_{i,t=2}(0) - Y_{i,t=1}(0) | G_i=1]} = \E\Big[ \E[Y_{i,t=2}(0) | Y_{i,t=1}, G_i=0] - Y_{i,t=1}(0) \Big| G_i=1\Big]\)

How to Use Panel Data to Learn about \(ATT\)

Notice that: \[\begin{align*} ATT = \underbrace{\E[Y_{i,t=2}(1) | G_i=1]}_{\textrm{Easy}} - \underbrace{\E[Y_{i,t=2}(0) | G_i=1]}_{\textrm{Hard}} \end{align*}\]

With panel data, we can re-write this as

\[\begin{align*} ATT = \color{green}{\E[Y_{i,t=2}(1) - Y_{i,t=1}(0) | G_i=1]} - \color{red}{\E[Y_{i,t=2}(0) - Y_{i,t=1}(0) | G_i=1]} \end{align*}\]

The second term is how outcomes would have changed over time if the treated group had not been treated

  • This is not directly observed in the data \(\implies\) we need to make identifying assumptions

  • There are many possibilities here:

    1. Change-in-changes: \(\color{red}{\E[Y_{i,t=2}(0) - Y_{i,t=1}(0) | G_i=1]} = \E\Big[ Q_{Y_{i,t=2}(0)|G_i=0}\big(F_{Y_{i,t=1}(0)|G_i=0}(Y_{i,t=1}(0))\big) - Y_{i,t=1}(0) \Big| G_i=1\Big]\)

How to Use Panel Data to Learn about \(ATT\)

Notice that: \[\begin{align*} ATT = \underbrace{\E[Y_{i,t=2}(1) | G_i=1]}_{\textrm{Easy}} - \underbrace{\E[Y_{i,t=2}(0) | G_i=1]}_{\textrm{Hard}} \end{align*}\]

With panel data, we can re-write this as

\[\begin{align*} ATT = \color{green}{\E[Y_{i,t=2}(1) - Y_{i,t=1}(0) | G_i=1]} - \color{red}{\E[Y_{i,t=2}(0) - Y_{i,t=1}(0) | G_i=1]} \end{align*}\]

The second term is how outcomes would have changed over time if the treated group had not been treated

  • This is not directly observed in the data \(\implies\) we need to make identifying assumptions

  • There are many possibilities here:

    1. Difference-in-differences:

DID with Two Periods


Parallel Trends Assumption

\[\color{red}{\E[\Delta Y_i(0) | G_i=1]} = \E[\Delta Y_i(0) | G_i=0]\]

Explanation: Mean path of untreated potential outcomes is the same for the treated group as for the untreated group

Identification: Under PTA, we can identify \(ATT\): \[ \begin{aligned} ATT &= \E[\Delta Y_i | G_i=1] - \E[\Delta Y_i(0) | G_i=1] \end{aligned} \]

DID with Two Periods


Parallel Trends Assumption

\[\color{red}{\E[\Delta Y_i(0) | G_i=1]} = \E[\Delta Y_i(0) | G_i=0]\]

Explanation: Mean path of untreated potential outcomes is the same for the treated group as for the untreated group

Identification: Under PTA, we can identify \(ATT\): \[ \begin{aligned} ATT &= \E[\Delta Y_i | G_i=1] - \E[\Delta Y_i(0) | G_i=1]\\ &= \E[\Delta Y_i | G_i=1] - \E[\Delta Y_i | G_i=0] \end{aligned} \]

\(\implies ATT\) is identified can be recovered by the difference in outcomes over time (difference 1) relative to the difference in outcomes over time for the untreated group (difference 2)

Estimation

The most straightforward approach to estimation is plugin:

\[\widehat{ATT} = \frac{1}{n_1} \sum_{i=1}^n G_i \Delta Y_i - \frac{1}{n_0} \sum_{i=1}^n (1-G_i) \Delta Y_i\]

Alternatively, TWFE regression: \[Y_{i,t} = \theta_t + \eta_i + \alpha D_{i,t} + e_{i,t}\]

  • Even though it looks like this model has restricted the effect of participating in the treatment to be constant (and equal to \(\alpha\)) across all individuals, TWFE (in this case) is actually robust to treatment effect heterogeneity.
  • To see this, notice that (with two periods) the previous regression is equivalent to \[\begin{align*} \Delta Y_{i,t} = \Delta \theta_t + \alpha \Delta D_{i,t} + \Delta e_{i,t} \end{align*}\] This is fully saturated in \(\Delta D_{i,t}\) (which is binary) \(\implies\) \[\begin{align*} \alpha = \E[\Delta Y_{i,t}|G_i=1] - \E[\Delta Y_{i,t}|G_i=0] = ATT \end{align*}\]

TWFE Regression

It’s easy to make the TWFE regression more complicated:

  • Multiple time periods

  • Variation in treatment timing

  • More complicated treatments

  • Introducing additional covariates

Unfortunately, the robustness of TWFE regressions to treatment effect heterogeneity or these more complicated (and empirically relevant) settings does not seem to hold

  • Much of the recent (mostly negative) literature on TWFE in the context of DID has considered these types of “realistic” settings

  • Next, we will consider one of these settings: staggered treatment adoption

Part 2: Staggered Treatment Adoption

Setup with Staggered Treatment Adoption

\(\T\) time periods

Staggered treatment adoption: Units can become treated at different points in time, but once a unit becomes treated, it remains treated.

Examples:

  • Government policies that roll out in different locations at different times (minimum wage is close to this over short time horizons)

  • “Scarring” treatments: e.g., job displacement does not typically happen year after year, but rather labor economists think of being displaced as changing a person’s “state” (the treatment is more like: has a person ever been displaced)

Notation:

  • In math, staggered treatment adoption means: \(D_{i,t-1}=1 \implies D_{i,t}=1\).

  • \(G_i\) — a unit’s group — the time period that unit becomes treated.

    • Under staggered treatment adoption, fully summarizes a unit’s treatment regime
  • Define \(U_i=1\) for never-treated units and \(U_i=0\) otherwise.

Setup with Staggered Treatment Adoption

Notation (cont’d):

  • Potential outcomes: \(Y_{i,t}(g)\) — the outcome that unit \(i\) would experience in time period \(t\) if they became treated in period \(g\).
  • Untreated potential outcome: \(Y_{i,t}(0)\) — the outcome unit \(i\) would experience in time period \(t\) if they did not participate in the treatment in any period.
  • Observed outcome: \(Y_{i,t}=Y_{i,t}(G_i)\)
  • No anticipation condition: \(Y_{i,t} = Y_{i,t}(0)\) for all \(t < G_i\) (pre-treatment periods for unit \(i\))

Target Parameters

Group-time average treatment effects \[\begin{align*} ATT(g,t) = \E[Y_{i,t}(g) - Y_{i,t}(0) | G_i=g] \end{align*}\]

Explanation: \(ATT\) for group \(g\) in time period \(t\)


Event Study \[\begin{align*} ATT^{es}(e) = \E[ Y_{i,g+e}(G) - Y_{i,g+e}(0) | G_i \in \mathcal{G}_e] \end{align*}\]

where \(\mathcal{G}_e\) is the set of groups observed to have experienced the treatment for \(e\) periods at some point.

Explanation: \(ATT\) when units have been treated for \(e\) periods

Target Parameters

Overall ATT

Towards this end: the average treatment effect for unit \(i\) (across its post-treatment time periods) is given by: \[\bar{\tau}_i(G_i) = \frac{1}{\T - G_i + 1} \sum_{t=G_i}^{\T} \Big( Y_{i,t}(G_i) - Y_{i,t}(0) \Big)\]

Then,

\[\begin{align*} ATT^o = \E[\bar{\tau}_i(G_i) | U_i=0] \end{align*}\]

Explanation: \(ATT\) across all units that every participate in the treatment

Pros and Cons of Aggregating Causal Effect Parameters

Group-Time \(ATT(g,t)\)

  • More fully characterizes treatment effect heterogeneity.
  • Some theories may have testable implications on \(ATT(g,t)\) (e.g., on the sign of group-time average treatment effects).

Event Study \(ATT^{ES}(e)\)

  • Easier to estimate precisely
  • Easier to report - summarizes treatment effect dynamics in a two-dimensional plot.

Overall \(ATT^o\)

  • Easiest to estimate precisely
  • Easiest to report - summarizes causal effects into single number to report in abstract or introduction.

\(ATT(g,t)\) as a Building Block

To understand the discussion later, it is also helpful to think of \(ATT(g,t)\) as a building block for the other parameters discussed above. For example:

Overall ATT \[\begin{align*} ATT^o = \sum_{g \in \bar{\mathcal{G}}} \sum_{t=g}^{\T} w^o(g,t) ATT(g,t) \qquad \qquad \textrm{where} \quad w^o(g,t) = \frac{\P(G_i=g|U_i=0)}{\T-g+1} \end{align*}\]

Likewise, can show that \(ATT^{es}(e)\) is a weighted average of \(ATT(g,g+e)\)


\(\implies\) If we can identify/recover \(ATT(g,t)\), then we can proceed to recover \(ATT^{es}(e)\) and \(ATT^o\).

DID Identification of \(ATT(g,t)\)


Multiple Period Version of Parallel Trends Assumption

For all groups \(g \in \bar{\mathcal{G}}\) (all groups except the never-treated group) and for all time periods \(t=2,\ldots,\T\), \[\begin{align*} \E[\Delta Y_{i,t}(0) | G_i=g] = \E[\Delta Y_{i,t}(0) | U_i=1] \end{align*}\]


Using very similar arguments as before, can show that \[\begin{align*} ATT(g,t) = \E[Y_{i,t} - Y_{i,g-1} | G_i=g] - \E[Y_{i,t} - Y_{i,g-1} | U_i=1] \end{align*}\]

where the main difference is that we use \((g-1)\) as the base period (this is the period right before group \(g\) becomes treated).

Summary

The previous discussion emphasizes a general purpose identification strategy with staggered treatment adoption:

Step 1: Target disaggregated treatment effect parameters (i.e., group-time average treatment effects)

Step 2: (If desired) combine disaggregated treatment effects into lower dimensional summary treatment effect parameter

Notice that:

  • This amounts to breaking the problem into a set of two-period DID problems and then combining the results

  • It is also a general purpose strategy in that the same high-level idea is (1) not DID-specific and (2) can (possibly) be applied to more complicated treatment regimes

What Can Go Wrong with TWFE Regression?

With staggered treatments, traditionally DID identification strategies have been implemented with two-way fixed effects (TWFE) regressions: \[\begin{align*} Y_{i,t} = \theta_t + \eta_i + \alpha D_{i,t} + e_{i,t} \end{align*}\]

One main contribution of recent work on DID has been to diagnose and understand the limitations of TWFE regressions for implementing DID

Goodman-Bacon (2021) intuition: \(\alpha\) “comes from” comparisons between the path of outcomes for units whose treatment status changes relative to the path of outcomes for units whose treatment status stays the same over time.

  • Some comparisons are for groups that become treated to not-yet-treated groups 👍

  • Other comparisons are for groups that become treated relative to already-treated groups 👎

    • This can be especially problematic when there are treatment effect dynamics. Dynamics imply different trends from what would have happened absent the treatment.

What Can Go Wrong with TWFE Regression?

de Chaisemartin and D’Haultfœuille (2020) intuition: You can write \(\alpha\) as a weighted average of \(ATT(g,t)\)

First, a decomposition: \[\begin{align*} \alpha &= \sum_{g \in \bar{\mathcal{G}}} \sum_{t=g}^{\T} w^{TWFE}(g,t) \Big( \E[(Y_{i,t} - Y_{i,g-1}) | G_i=g] - \E[(Y_{i,t} - Y_{i,g-1}) | U_i=1] \Big) \\ & + \sum_{g \in \bar{\mathcal{G}}} \sum_{t=1}^{g-1} w^{TWFE}(g,t) \Big( \E[(Y_{i,t} - Y_{i,g-1}) | G_i=g] - \E[(Y_{i,t} - Y_{i,g-1}) | U_i=1] \Big) \end{align*}\]

Second, under parallel trends:
\[\begin{align*} \alpha = \sum_{g \in \bar{\mathcal{G}}} \sum_{t=g}^{\T} w^{TWFE}(g,t) ATT(g,t) \end{align*}\]

  • But the weights are (non-transparently) driven by the estimation method

  • These weights have some good / bad / strange properties such as possibly being negative

  • [More Details]

New Approaches

We’ll discuss:

  1. Callaway and Sant’Anna (2021), R: did, Stata: csdid, Python: csdid

  2. Sun and Abraham (2021), R: fixest, Stata: eventstudyinteract

  3. Wooldridge (2021), R: etwfe, Stata: JWDID

  4. Gardner et al. (2023) / Borusyak, Jaravel, and Spiess (2024), R: did2s, Stata: did2s and did_imputation

Not including:

  1. “Stacked Regression” (Cengiz et al. (2019), Dube et al. (2023)), Stata: stackedev

  2. de Chaisemartin and D’Haultfœuille (2020), R: DIDmultiplegt, Stata: did_multiplegt

See Baker, Larcker, and Wang (2022) and Callaway (2023) for more substantially more details.

Callaway and Sant’Anna (2021)

Intuition: Directly implement the identification result discussed above

  • Under parallel trends, recall that

\[\begin{align*} ATT(g,t) = \E[Y_{i,t} - Y_{i,g-1} | G_i=g] - \E[Y_{i,t} - Y_{i,g-1} | U_i=1] \end{align*}\]

Estimation:

\[\begin{align*}\widehat{ATT}^{CS}(g,t) = \frac{1}{n_g}\sum_{i=1}^n \indicator{G_i = g}(Y_{i,t} - Y_{i,g-1}) - \frac{1}{n_U}\sum_{i=1}^n \indicator{U_i = 1} (Y_{i,t} - Y_{i,g-1}) \end{align*}\]

2nd step: Recall: group-time average treatment effects are building blocks for more aggregated parameters such as \(ATT^{es}(e)\) and \(ATT^o\) \(\implies\) just plug in

  • \(\implies\) two-step estimation procedure: target local/disaggregated \(ATT(g,t)\) in first step, then (if desired) aggregate them into lower dimensional parameters

Sun and Abraham (2021)

Intuition: Paper points out limitations of event-study versions of the TWFE regressions discussed above:

\[\begin{align*} Y_{i,t} = \theta_t + \eta_i + \sum_{e=-(\T-1)}^{-2} \beta_e D_{i,t}^e + \sum_{e=0}^{\T} \beta_e D_{i,t}^e + e_{i,t} \end{align*}\]

and points out similar issues. In particular, the event study regression is “underspecified” \(\implies\) heterogeneous effects can “confound” the treatment effect estimates

Solution: Run fully interacted regression: \[\begin{align*} Y_{i,t} = \theta_t + \eta_i + \sum_{g \in \bar{\mathcal{G}}} \sum_{e \neq -1} \delta^{SA}_{ge} \indicator{G_i=g} \indicator{g+e=t} + e_{i,t} \end{align*}\]

2nd step: Aggregate \(\delta^{SA}_{ge}\)’s across groups (usually into an event study).

  • This sidesteps issues with the event study regression coming from treatment effect heterogeneity

  • For inference, need to account for two-step estimation procedure

Wooldridge (2021)

Intuition: Are issues in DID literature due to limitations of TWFE regressions per se or due to misspecification of TWFE regression?

Solution: Proposes running “more interacted” TWFE regression:

\[\begin{align*} Y_{i,t} = \theta_t + \eta_i + \sum_{g \in \bar{\mathcal{G}}} \sum_{s=g}^{\T} \alpha_{gt}^W \indicator{G_i=g, t=s} + e_{i,t} \end{align*}\]

This is quite similar to Sun and Abraham (2021) except for that it doesn’t include interactions in pre-treatment periods. [The differences about \((g,t)\) relative to \((g,e)\) are trivial.]

  • Like SA, this provides robustness to treatment effect heterogeneity by including more interactions

  • Like SA, unless mainly interested in \(ATT(g,t)\), have to do second step aggregation that (arguably) ends the “killer feature” of the TWFE regression to begin with

Gardner et al. (2023) / BJS (2023)

Intuition: Parallel trends is closely connected to a TWFE model for untreated potential outcomes \[Y_{i,t}(0) = \theta_t + \eta_i + e_{i,t}\]

Estimation:

  • Step 1: Split data into treated and untreated observations

  • Step 2: Estimate above model for the set of untreated observations

  • Step 3: “Impute” \(\hat{Y}_{i,t}(0) = \hat{\theta}_t + \hat{\eta}_i\) for the treated observations

  • \(\displaystyle \widehat{ATT}^{G/BJS}(g,t) = \frac{1}{n_g} \sum_{i=1}^n \indicator{G_i=g}\Big(Y_{i,t} - \hat{Y}_{i,t}(0)\Big) \xrightarrow{p} ATT(g,t)\)

Can compute other treatment effect parameters too (e.g., event study or overall average treatment effect)

Similarities and Differences

In my view, all of the approaches discussed above are fundamentally similar to each other.

In practice, it is sometimes possible to get different results though this is often driven by

  • Different estimation strategies trading off efficiency and robustness in different ways

  • Different choices in terms of default implementation details in computer code

Comparison 1: CS and SA

In post-treatment periods, these give numerically identical results: \(\widehat{ATT}^{CS}(g,t) = \hat{\delta}^{SA}_{t,t-g}\)

  • This is because a fully interacted regression (SA) is equivalent to taking differences in averages across groups (CS)

In pre-treatment periods, code will give different pre-treatment estimates, but this is due to different default choices

  • In SA, all results are relative to a fixed base period (typically the period right before treatment)

  • In CS, by default, in pre-treatment periods, estimates are of placebo policy effects on impact (i.e., the base period is always the most recent pre-treatment period)

Comparison 2: SA and Wooldridge

These are clearly closely related, with the difference amounting to whether or not one includes indicators for pre-treatment periods.

It is fair to see this as a way to trade-off robustness and efficiency

  • If parallel trends holds across all time periods, then Wooldridge can tend to deliver more efficient estimates (as effectively all pre-treatment periods are used as base periods)

  • If parallel trends is violated in some pre-treatment periods but holds post-treatment, Wooldridge estimates will be inconsistent, but SA estimates will be robust to violations of parallel trends in pre-treatment periods.

  • See Harmon (2023) for more details

Comparison 3: Wooldridge and Gardner/BJS

Wooldridge and Gardner/BJS give numerically the same estimates: \(\hat{\alpha}^W_{gt} = \widehat{ATT}^{G/BJS}(g,t)\)

Intuition: Including full set of interactions is equivalent to estimating separate models by groups

Comments

The above discussion emphasizes the conceptual similarities between different proposed alternatives to TWFE regressions in the literature.

The other major source of differences in estimates across procedures is different default options in software implementations. Examples:

  1. Different base periods
    • It’s possible to come up with an imputation estimator that uses the base period right before treatment only \(\implies\) \(\uparrow\) robustness, \(\downarrow\) efficiency
    • It’s also possible to do a version of CS with more base periods \(\implies\) \(\uparrow\) efficiency \(\downarrow\) robustness
      • Build-the-trend (i.e., path relative to average pre-treatment outcome) and GMM, Callaway (2023), Marcus and Sant’Anna (2021), Lee and Wooldridge (2023).

Comments

The above discussion emphasizes the conceptual similarities between different proposed alternatives to TWFE regressions in the literature.

The other major source of differences in estimates across procedures is different default options in software implementations. Examples:

  1. Different default target parameters
    • CS emphasizes the “overall” treatment effects discussed above
    • Default implementations of imputation run a regression of \(Y_{i,t}-\hat{Y}_{i,t}(0)\) on \(D_{i,t}\) which delivers the “simple” overall average treatment effect which just averages all available treatment effects

Comments

The above discussion emphasizes the conceptual similarities between different proposed alternatives to TWFE regressions in the literature.

The other major source of differences in estimates across procedures is different default options in software implementations. Examples:

  1. Different default comparison groups
    • CS and SA by default use the never-treated group as the comparison group
    • Wooldridge and Gardner/BJS by default use all untreated observations as the comparison group
    • But (again) it is straightforward to adapt CS to use the not-yet-treated group as the comparison group, or even a customized comparison group (e.g., not-yet-but-eventually-treated)

Comments

The above discussion emphasizes the conceptual similarities between different proposed alternatives to TWFE regressions in the literature.

The other major source of differences in estimates across procedures is different default options in software implementations. Examples:

  1. Handle covariates in different ways
    • By default, imputation (effectively) uses changes in the covariates over time in estimation
    • CS includes the level of the time-varying covariate in period \(g-1\).
    • In Caetano and Callaway (2023), we recommend including both changes and levels of covariates

Part 3: Empirical Example

Empirical Example: Minimum Wages and Employment

  • Use county-level data from 2003-2007 during a period where the federal minimum wage was flat
  • Exploit minimum wage changes across states

    • Any state that increases their minimum wage above the federal minimum wage will be considered as treated
  • Interested in the effect of the minimum wage on teen employment
  • We’ll also make a number of simplifications:
    • not worry much about issues like clustered standard errors
    • not worry about variation in the amount of the minimum wage change (or whether it keeps changing) across states

Goals:

  • Get some experience with an application and DID-related code

  • Assess how much do the issues that we have been talking about matter in practice

Code

Full code is available on GitHub.

R packages used in empirical example

library(did)
library(BMisc)
library(twfeweights)
library(fixest)
library(modelsummary)
library(ggplot2)
load(url("https://github.com/bcallaway11/did_chapter/raw/master/mw_data_ch2.RData"))

Setup Data


# drops NE region and a couple of small groups
mw_data_ch2 <- subset(mw_data_ch2, (G %in% c(2004,2006,2007,0)) & (region != "1"))
head(mw_data_ch2[,c("id","year","G","lemp","lpop","lavg_pay","region")])
      id year    G     lemp     lpop lavg_pay region
554 8003 2001 2007 5.556828 9.614137 10.05750      4
555 8003 2002 2007 5.356586 9.623972 10.09712      4
556 8003 2003 2007 5.389072 9.620859 10.10761      4
557 8003 2004 2007 5.356586 9.626548 10.14034      4
558 8003 2005 2007 5.303305 9.637958 10.17550      4
559 8003 2006 2007 5.342334 9.633056 10.21859      4


# drop 2007 as these are right before fed. minimum wage change
data2 <- subset(mw_data_ch2, G!=2007 & year >= 2003)
# keep 2007 => larger sample size
data3 <- subset(mw_data_ch2, year >= 2003)

TWFE Regression

twfe_res2 <- fixest::feols(lemp ~ post | id + year,
                           data=data2,
                           cluster="id")


modelsummary(list(twfe_res2), gof_omit=".*")
tinytable_ymxhqos7m1s7n6q0zz7l
(1)
post -0.038
(0.008)

\(ATT(g,t)\) (Callaway and Sant’Anna)

attgt <- did::att_gt(yname="lemp",
                     idname="id",
                     gname="G",
                     tname="year",
                     data=data2,
                     control_group="nevertreated",
                     base_period="universal")
tidy(attgt)[,1:5] # print results, drop some extra columns
             term group time    estimate   std.error
1  ATT(2004,2003)  2004 2003  0.00000000          NA
2  ATT(2004,2004)  2004 2004 -0.03266653 0.020496212
3  ATT(2004,2005)  2004 2005 -0.06827991 0.021357839
4  ATT(2004,2006)  2004 2006 -0.12335404 0.020370367
5  ATT(2004,2007)  2004 2007 -0.13109136 0.022255409
6  ATT(2006,2003)  2006 2003 -0.03408910 0.012275939
7  ATT(2006,2004)  2006 2004 -0.01669977 0.007746447
8  ATT(2006,2005)  2006 2005  0.00000000          NA
9  ATT(2006,2006)  2006 2006 -0.01939335 0.009302445
10 ATT(2006,2007)  2006 2007 -0.06607568 0.008937721

Plot \(ATT(g,t)\)’s

Compute \(ATT^o\)

attO <- did::aggte(attgt, type="group")
summary(attO)

Call:
did::aggte(MP = attgt, type = "group")

Reference: Callaway, Brantly and Pedro H.C. Sant'Anna.  "Difference-in-Differences with Multiple Time Periods." Journal of Econometrics, Vol. 225, No. 2, pp. 200-230, 2021. <https://doi.org/10.1016/j.jeconom.2020.12.001>, <https://arxiv.org/abs/1803.09015> 


Overall summary of ATT's based on group/cohort aggregation:  
     ATT    Std. Error     [ 95%  Conf. Int.]  
 -0.0571         0.008    -0.0728     -0.0414 *


Group Effects:
 Group Estimate Std. Error [95% Simult.  Conf. Band]  
  2004  -0.0888     0.0195       -0.1312     -0.0465 *
  2006  -0.0427     0.0084       -0.0610     -0.0244 *
---
Signif. codes: `*' confidence band does not cover 0

Control Group:  Never Treated,  Anticipation Periods:  0
Estimation Method:  Doubly Robust

Comments

The differences between the CS estimates and the TWFE estimates are fairly large here: the CS estimate is about 50% larger than the TWFE estimate, though results are qualitatively similar.

de Chaisemartin and d’Haultfoeuille weights

\(ATT^o\) weights

Weight Comparison

Discussion

To summarize: \(ATT^o = -0.057\) while \(\alpha^{TWFE} = -0.038\). This difference can be fully accounted for

  • Pre-treatment differences in paths of outcomes across groups: explains about 64% of the difference

  • Differences in weights applied to the same post-treatment \(ATT(g,t)\): explains about 36% of the difference. [If you apply the post-treatment weights and “zero out” pre-treatment differences, the estimate would be \(-0.050\).]

In my experience: this is fairly representative of how much new DID approaches matter relative to TWFE regressions. It does not seem like “catastrophic failure” of TWFE, but (in my view) these are meaningful differences (and, e.g., given slightly different \(ATT(g,t)\)’s, the difference in the weighting schemes could change the qualitative results).

  • Of course, this whole discussion hinges crucially on how much treatment effect heterogeneity there is. More TE Het \(\implies\) more sensitivity to weighting schemes [just looking at TWFE regression does not give insight into how much TE Het there is.]

Additional Comments on Weights

One more comment: there is a lot concern about negative weights (both in econometrics and empirical work).

  • There were no negative weights in the example above, but the weights still weren’t great.
  • But, in my view, the more important issue is the non-transparent weighting scheme.
    • Example 1: If you try using data3 (the data that includes \(G_i=2007\)), you will get a negative weight on \(ATT(g=2004,t=2007)\). But it turns out not to matter much, and TWFE works better in this case than in the case that I showed you.
    • [Example 2: Alternative treatment effect parameter] ➡

Conclusion

Pros and Cons of New Approaches Relative to Traditional TWFE Regressions

Not a Panacea

  • Good properties of new approaches are conditional on parallel trends holding

Possible Disadvantages:

  • Not yet available for all possible types of treatments where DID identification strategies are used

Advantages:

  • Off-the-shelf robust to treatment effect heterogeneity

  • Arguably, simpler and more transparent

  • Direct implementation of the DID identification strategy

Appendix

Event Study

attes <- aggte(attgt, type="dynamic")
ggdid(attes)

Back

How do these results work?

Consider a simplified setting where \(\T=2\), but we allow for there to be units that are already treated in the first period.

\(\implies\) 3 groups: \(G_i=1\), \(G_i=2\), \(G_i=\infty\)

Because there are only two periods, the TWFE regression is equivalent to the regression \[\begin{align*} \Delta Y_i = \Delta \theta_{i,t=2} + \alpha \Delta D_{i,t=2} + \Delta e_{i,t=2} \end{align*}\]

Moreover, \(\Delta D_{i,t=2}\) only takes two values:

  • \(\Delta D_{i,t=2} = 0\) for \(G_i=1\) and \(G_i=\infty\)

  • \(\Delta D_{i,t=2} = 1\) for \(G_i=2\)

Thus, this is a fully saturated regression, and we have that \[\begin{align*} \alpha = \E[\Delta Y_i | \Delta D_{i,t=2} = 1] - \E[\Delta Y_i | \Delta D_{i,t=2}=0] \end{align*}\]

TWFE Explanation (cont’d)

Starting from the previous slide: \[\begin{align*} \alpha = \E[\Delta Y_i | \Delta D_{i,t=2} = 1] - \E[\Delta Y_i | \Delta D_{i,t=2}=0] \end{align*}\] and consider the term on the far right, we have that \[\begin{align*} \E[\Delta Y_i | \Delta D_{i,t=2}=0] = \E[\Delta Y_i | G_i=1] \underbrace{\frac{p_1}{p_1 + p_\infty}}_{=: w_1} + \E[\Delta Y_i | G_i=\infty] \underbrace{\frac{p_\infty}{p_1 + p_\infty}}_{=: w_\infty} \end{align*}\]

where \(w_1\) and \(w_\infty\) are the relative sizes of group 1 and the never treated group, and notice that \(w_1 + w_\infty = 1\). Plugging this back in \(\implies\) \[\begin{align*} \alpha = \Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i | G_i=1]\Big) w_1 + \Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i|G_i=\infty]\Big) w_\infty \end{align*}\]

This is exactly the Goodman-Bacon result! \(\alpha\) is a weighted average of all possible 2x2 comparisons

TWFE Explanation (cont’d)

Let’s keep going: \[\begin{align*} \alpha = \underbrace{\Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i | G_i=1]\Big)}_{\textrm{What is this?}} w_1 + \underbrace{\Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i|G_i=\infty]\Big)}_{ATT(2,2)} w_\infty \end{align*}\] Working on the first term, we have that \[ \begin{aligned} & \E[\Delta Y_{i2} | G_i=2] - \E[\Delta Y_{i2} | G_i=1] \hspace{300pt} \end{aligned} \]

TWFE Explanation (cont’d)

Let’s keep going: \[\begin{align*} \alpha = \underbrace{\Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i | G_i=1]\Big)}_{\textrm{What is this?}} w_1 + \underbrace{\Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i|G_i=\infty]\Big)}_{ATT(2,2)} w_\infty \end{align*}\] Working on the first term, we have that \[ \begin{aligned} & \E[\Delta Y_{i2} | G_i=2] - \E[\Delta Y_{i2} | G_i=1] \hspace{300pt}\\ &\hspace{10pt} = \E[Y_{i2}(2) - Y_{i1}(\infty) | G_i=2] - \E[Y_{i2}(1) - Y_{i1}(1) | G_i=1] \end{aligned} \]

TWFE Explanation (cont’d)

Let’s keep going: \[\begin{align*} \alpha = \underbrace{\Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i | G_i=1]\Big)}_{\textrm{What is this?}} w_1 + \underbrace{\Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i|G_i=\infty]\Big)}_{ATT(2,2)} w_\infty \end{align*}\] Working on the first term, we have that \[ \begin{aligned} & \E[\Delta Y_{i2} | G_i=2] - \E[\Delta Y_{i2} | G_i=1] \hspace{300pt}\\ &\hspace{10pt} = \E[Y_{i2}(2) - Y_{i1}(\infty) | G_i=2] - \E[Y_{i2}(1) - Y_{i1}(1) | G_i=1] \\ &\hspace{10pt} = \E[Y_{i2}(2) - Y_{i2}(\infty) | G_i=2] + \underline{\E[Y_{i2}(\infty) - Y_{i1}(\infty) | G_i=2]} \end{aligned} \]

TWFE Explanation (cont’d)

Let’s keep going: \[\begin{align*} \alpha = \underbrace{\Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i | G_i=1]\Big)}_{\textrm{What is this?}} w_1 + \underbrace{\Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i|G_i=\infty]\Big)}_{ATT(2,2)} w_\infty \end{align*}\] Working on the first term, we have that \[ \begin{aligned} & \E[\Delta Y_{i2} | G_i=2] - \E[\Delta Y_{i2} | G_i=1] \hspace{300pt}\\ &\hspace{10pt} = \E[Y_{i2}(2) - Y_{i1}(\infty) | G_i=2] - \E[Y_{i2}(1) - Y_{i1}(1) | G_i=1] \\ &\hspace{10pt} = \E[Y_{i2}(2) - Y_{i2}(\infty) | G_i=2] + \underline{\E[Y_{i2}(\infty) - Y_{i1}(\infty) | G_i=2]}\\ &\hspace{20pt} - \Big( \E[Y_{i2}(1) - Y_{i2}(\infty) | G_i=1] - \E[Y_{i1}(1) - Y_{i1}(\infty) | G_i=1] + \underline{\E[Y_{i2}(\infty) - Y_{i1}(\infty) | G_i=1]} \Big) \end{aligned} \]

TWFE Explanation (cont’d)

Let’s keep going: \[\begin{align*} \alpha = \underbrace{\Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i | G_i=1]\Big)}_{\textrm{What is this?}} w_1 + \underbrace{\Big( \E[\Delta Y_i | G_i=2] - \E[\Delta Y_i|G_i=\infty]\Big)}_{ATT(2,2)} w_\infty \end{align*}\] Working on the first term, we have that \[ \begin{aligned} & \E[\Delta Y_{i2} | G_i=2] - \E[\Delta Y_{i2} | G_i=1] \hspace{300pt}\\ &\hspace{10pt} = \E[Y_{i2}(2) - Y_{i1}(\infty) | G_i=2] - \E[Y_{i2}(1) - Y_{i1}(1) | G_i=1] \\ &\hspace{10pt} = \E[Y_{i2}(2) - Y_{i2}(\infty) | G_i=2] + \underline{\E[Y_{i2}(\infty) - Y_{i1}(\infty) | G_i=2]}\\ &\hspace{20pt} - \Big( \E[Y_{i2}(1) - Y_{i2}(\infty) | G_i=1] - \E[Y_{i1}(1) - Y_{i1}(\infty) | G_i=1] + \underline{\E[Y_{i2}(\infty) - Y_{i1}(\infty) | G_i=1]} \Big)\\ &\hspace{10pt} = \underbrace{ATT(2,2)}_{\textrm{causal effect}} - \underbrace{\Big(ATT(1,2) - ATT(1,1)\Big)}_{\textrm{treatment effect dynamics}} \end{aligned} \]

Plug this expression back in \(\rightarrow\)

TWFE Explanation (cont’d)

Plugging the previous expression back in, we have that \[\begin{align*} \alpha = ATT(2,2) + ATT(1,1) w_1 + ATT(1,2)(-w_1) \end{align*}\]

This is exactly the result in de Chaisemartin and d’Haultfoeuille! \(\alpha\) is equal to a weighted average of \(ATT(g,t)\)’s, but it is possible that some of the weights can be negative.

Also, as they point out, a sufficient condition for the weights to be non-negative is: no treatment effect dynamics \(\implies ATT(1,1) = ATT(1,2)\) \(\overset{\textrm{here}}{\implies} \alpha = ATT(2,2)\).

  • In more complicated settings, this would guarantee no negative weights, but the you would still get a hard-to-understand weighted average of \(ATT(g,t)'s\).

[Back]

“Simple” Aggregation

Consider the following alternative aggregated treatment effect parameter \[\begin{align*} ATT^{simple} := \sum_{t=g}^\T ATT(g,t) \frac{\P(G_i=g | G \in \bar{\mathcal{G}})}{\sum_{t=g}^{\T} \P(G_i=g| G \in \bar{\mathcal{G}})} \end{align*}\] Consider imputation so that you have \(Y_{i,t}-\hat{Y}_{i,t}(0)\) available in all periods. This is the \(ATT\) parameter that you get by averaging all of those.

Relative to \(ATT^o\), early treated units get more weight (because we have more \(Y_{i,t}-\hat{Y}_{i,t}(0)\) for them).

By construction, weights are all positive. However, they are different from \(ATT^o\) weights

“Simple” Aggregation

“Simple” Aggregation

Besides the violations of parallel trends in pre-treatment periods, these weights are further away from \(ATT^o\) than the TWFE regression weights are!

In fact, you calculate \(ATT^{simple} = -0.065\) (13% larger in magnitude that \(ATT^o\))

Finally, if you are “content with” non-negative weights, then you can get any summary measure from \(-0.019\) (the smallest \(ATT(g,t)\)) to \(-0.13\) (the largest). This is a wide range of estimates.

In my view, the discussion above suggests that clearly stating a target aggregate treatment effect parameter and choosing weights that target that parameter is probably more important than checking for negative weights

[Back]

References

Baker, Andrew C, David F Larcker, and Charles CY Wang. 2022. “How Much Should We Trust Staggered Difference-in-Differences Estimates?” Journal of Financial Economics 144 (2): 370–95.
Borusyak, Kirill, Xavier Jaravel, and Jann Spiess. 2024. “Revisiting Event-Study Designs: Robust and Efficient Estimation.” Review of Economic Studies, rdae007.
Caetano, Carolina, and Brantly Callaway. 2023. “Difference-in-Differences When Parallel Trends Holds Conditional on Covariates.”
Callaway, Brantly. 2023. “Difference-in-Differences for Policy Evaluation.” In Handbook of Labor, Human Resources and Population Economics, edited by Klaus F. Zimmermann, 1–61. Springer International Publishing.
Callaway, Brantly, and Pedro HC Sant’Anna. 2021. “Difference-in-Differences with Multiple Time Periods.” Journal of Econometrics 225 (2): 200–230.
Cengiz, Doruk, Arindrajit Dube, Attila Lindner, and Ben Zipperer. 2019. “The Effect of Minimum Wages on Low-Wage Jobs.” The Quarterly Journal of Economics 134 (3): 1405–54.
de Chaisemartin, Clement, and Xavier D’Haultfœuille. 2020. “Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects.” American Economic Review 110 (9): 2964–96.
Dube, Arindrajit, Daniele Girardi, Òscar Jordà, and Alan M Taylor. 2023. “A Local Projections Approach to Difference-in-Differences Event Studies.”
Gardner, John, Neil Thakral, Linh T Tô, and Luther Yap. 2023. “Two-Stage Differences in Differences.”
Goodman-Bacon, Andrew. 2021. “Difference-in-Differences with Variation in Treatment Timing.” Journal of Econometrics 225 (2): 254–77.
Harmon, Nikolaj A. 2023. “Difference-in-Differences and Efficient Estimation of Treatment Effects.”
Lee, Soo Jeong, and Jeffrey M Wooldridge. 2023. “A Simple Transformation Approach to Difference-in-Differences Estimation for Panel Data.”
Marcus, Michelle, and Pedro HC Sant’Anna. 2021. “The Role of Parallel Trends in Event Study Settings: An Application to Environmental Economics.” Journal of the Association of Environmental and Resource Economists 8 (2): 235–75.
Sun, Liyang, and Sarah Abraham. 2021. “Estimating Dynamic Treatment Effects in Event Studies with Heterogeneous Treatment Effects.” Journal of Econometrics 225 (2): 175–99.
Wooldridge, Jeff. 2021. “Two-Way Fixed Effects, the Two-Way Mundlak Regression, and Difference-in-Differences Estimators.”