CoChat

did2s: Two-Stage Difference-in-Differences

Open access
Butts, Kyle, Gardner, John · 2022 · The R Journal

The DOI matches its Crossref record; 17 of the 17 references it cites were found in a registry or an index; 10 of the 25 sources its claims cite were checked for support.

Abstract

Recent work has highlighted the difficulties of estimating difference-in-differences models when the treatment is adopted at different times for different units. This article introduces the R package did2s which implements the estimator introduced in @Gardner_2021. The article provides an approachable review of the underlying econometric theory and introduces the syntax for the function `did2s`. Further, the package introduces functions, event_study and plot_event_study, which uses a common syntax to implement all of the modern event-study estimators.

Overview

CoChat Summary

TL;DR

This article introduces the R package `did2s`, which implements Gardner’s (2022) two-stage difference-in-differences estimator for two-way fixed-effects models with staggered treatment timing and heterogeneous treatment effects. It also provides `event_study` and `plot_event_study` functions for estimating and plotting modern event-study estimators under a common syntax.

Key findings

  • The two-stage estimator first estimates group and time fixed effects using untreated/not-yet-treated observations, then regresses adjusted outcomes on treatment; this avoids the negative weighting problem in static and event-study TWFE when treatment effects are heterogeneous across groups and time.
  • In the simulated `df_het` static example, `did2s` estimates the overall treatment effect as 2.23048 (SE = 0.021408, t = 104.19, p < 2.2e-16) with 46,500 observations; the text says this is close to the true value.
  • Event-study estimates from `did2s` closely track the true effects: the true post-treatment effect starts at 1.5 and grows to 3 by post-period 20; OLS TWFE estimates show apparent pre-trend violations even though the data were simulated under parallel pre-trends.
  • `event_study` returns a tidy data frame of estimates and standard errors for multiple estimators, and `plot_event_study` produces ggplot comparisons; Table 2 summarizes assumptions including comparison group, parallel trends, limited anticipation, and correct specification of Y(0) for imputation estimators.

Methods

  • Design: package/software article reviewing modern DiD theory and introducing `did2s`, which implements Gardner (2022); also `event_study` and `plot_event_study` for robust event-study estimators.
  • Data: simulated dataset `df_het` with two treated groups and a never-treated group; the static example uses 46,500 observations, and event-study examples use the same simulated data.
  • Analysis: first stage estimates group and time fixed effects on `Dgt = 0` observations; second stage regresses adjusted outcomes on treatment or event-study leads/lags; inference uses GMM asymptotic variance; `event_study` compares estimators via a common syntax.

Limitations

  • The paper states further research is needed to determine which estimators work best in different settings, potentially via data-driven methods to assess assumption plausibility; more work is needed to formalize flexible covariate use, and no software yet exists for Caetano et al. (2022).
  • Evident from the text: the empirical illustration is based on simulated data (`df_het`), not a real-world application, so performance evidence is simulation-based.
  • Evident: the article notes the standard second-stage variance-covariance matrix would be incorrect without adjustment; it addresses this with GMM, but the text does not provide extensive finite-sample simulation evidence beyond the examples.

Model-written summary. Check it against the paper before relying on it.

Integrity signals

Registry

Crossref · 10.32614/rj-2022-048

Cites

17 of 17 references verified0 citation errors · 0 not checkable

Statistics

Nothing to recompute.

Figures

Figure 1 This figure plots simulated data with two treated groups and a never-treated group. Each line represents the average outcome (y-value) in a given year (x-value) for each of the three groups. In the absence of treatment, all three groups would exhibit parallel trends (staying around a value of 4 in each period). Each of the treated groups are experience different treatment effect magnitudes that grow over time. This treatment effect heterogeneity creates problems for the classical two-way fixed effect OLS estimator.
Figure 1 This figure plots simulated data with two treated groups and a never-treated group. Each line represents the average outcome (y-value) in a given year (x-value) for each of the three groups. In the absence of treatment, all three groups would exhibit parallel trends (staying around a value of 4 in each period). Each of the treated groups are experience different treatment effect magnitudes that grow over time. This treatment effect heterogeneity creates problems for the classical two-way fixed effect OLS estimator.From the PDF
Image 2
From the PDF
Figure 3 This figure adds the standard ordinary-least squares estimates to the true effect and the 'did2s' estimates present in Figure 2. The x-axis of this figure is the relative time to treatment, i.e. how many years pre-/post- treatment that period is. The y-axis is estimated treatment effects. There are three sets of points. The first two sets of points are the same as in Figure 2. The third set of points is the ordinary-least squares estimates. These points exhibit show evidence of parallel pre-trends failing.
Figure 3 This figure adds the standard ordinary-least squares estimates to the true effect and the 'did2s' estimates present in Figure 2. The x-axis of this figure is the relative time to treatment, i.e. how many years pre-/post- treatment that period is. The y-axis is estimated treatment effects. There are three sets of points. The first two sets of points are the same as in Figure 2. The third set of points is the ordinary-least squares estimates. These points exhibit show evidence of parallel pre-trends failing.From the PDF
Image 4
From the PDF

Verification

Claims the paper makes

10 Valid · 4 Not valid · 9 Not checked · 50 Own results and interpretations

27 more claims

Create a free account to see all 73 claims and to verify the 2 references still open.

See all claims — free account
  • Probably not a substantial claim. 32
  • It may state two separate claims as one. 15
  • The quote only partly states this claim. 1

Create a free account to see these claims.

Citations

Cites

Show all 17 references

Cited by

See all 133

Metadata

Authors
Butts, K., & Gardner, J.
Affiliations
  • University of Colorado Boulder (US)
  • University of Mississippi (US)
Venue
The R Journal
Published
2022-12-20
Volume
14
Issue
3
Pages
162-173
ISSN
2073-4859 (ISSN-L)
OpenAlex
W3199325769
Cited by
133
References
7
Citations by year
2026: 44 · 2025: 37 · 2024: 24 · 2023: 18 · 2022: 7
FWCI
13.62
Type
journal article
Language
en
Open access
Licence
cc-by
Locations
  • The R Journal (publishedVersion, cc-by)
  • RePEc: Research Papers in Economics (submittedVersion)
  • arXiv (Cornell University) (submittedVersion)
  • arXiv (Cornell University) (cc-by)
Topics
  • Physical Sciences › Mathematics › Statistics and Probability › Advanced Causal Inference Techniques
  • Physical Sciences › Mathematics › Statistics and Probability › Data Analysis with R
  • Social Sciences › Economics, Econometrics and Finance › Economics and Econometrics › Spatial and Panel Data Analysis
Keywords
staggered treatment adoption, treatment effect estimation

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

The claim verdicts this report counts are experimental: their accuracy is not yet measured.

A language model drew the claims from the paper on 2026-09-30, under version 3 of the claim definition (model deepseek-v4.1-flash, prompt extract-v3).

A second model labelled each claim on 2026-09-30 (model jev-1.13-20260917, definition revision gold-guideline-v0.2).

Cited sources are checked with a language model’s help (gpt-6-sol).

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review

How to cite

Cite CoChat for the checks on this page, and the paper for its own findings.

This page
CoChat. (2026). Citation check: did2s: Two-Stage Difference-in-Differences. https://app.cochat.ai/papers/10.32614/rj-2022-048
The paper
Butts, K., & Gardner, J. (2022). did2s: Two-Stage Difference-in-Differences. The R Journal. https://doi.org/10.32614/rj-2022-048

Data sources

Bibliographic data: Semantic Scholar, OpenAlex, Crossref.

Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).

Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.