Staggered DiD Panel Workflow: TWFE Bias, Bacon Decomposition, and Modern Estimators

Staggered policy rollouts can cause traditional two-way fixed effects regressions to flip signs under dynamic treatment effects. Here is how modern cohort estimators restore credible causal identification.

HumanPen Team

· 9 min read

Why Can Traditional Staggered Two-Way Fixed Effects Flip the Treatment Sign?

Standard two-way fixed effects (`TWFE`) regressions fail in staggered adoption panels because they implicitly use earlier-treated units as controls for later-treated units. When treatment effects grow or change over time, subtracting already-treated trends subtracts treatment gains, assigning negative weights that can flip positive policy impacts into negative estimates. Modern cohort-based estimators resolve this by restricting control pools to clean never-treated or not-yet-treated units.

When treatment effects vary across cohorts or evolve dynamically over time, standard TWFE can yield an aggregate negative estimate even if every single unit experiences a strictly positive treatment effect.

For decades, applied empirical research across economics, corporate finance, accounting, and health policy treated the standard specification `y_it = alpha_i + lambda_t + beta * D_it + epsilon_it` as the default workhorse for panel evaluations. Researchers assumed that unit fixed effects `alpha_i` and time fixed effects `lambda_t` adequately controlled for unobserved time-invariant confounders and common macroeconomic shocks, leaving `beta` to measure the average treatment effect on the treated (`ATT`). However, methodological advances have demonstrated that whenever treatment timing is staggered across groups, this homogeneous treatment effect assumption breaks down mathematically, leaving standard OLS estimates vulnerable to severe bias.

The Goodman-Bacon Decomposition: Why Earlier-Treated Units Make Toxic Controls

The core intuition behind this breakdown was established by Goodman-Bacon (2021) in the Journal of Econometrics. The Goodman-Bacon decomposition proves that the single `beta` estimated by a staggered TWFE regression is an analytical weighted average of all possible 2×2 difference-in-differences comparisons present in the panel. These comparisons fall into three distinct categories: early-treated cohorts compared against never-treated units, late-treated cohorts compared against never-treated units, and timing-based comparisons between early-treated and late-treated cohorts.

The severe bias originates entirely from timing-based comparisons that use already-treated units as controls. When an earlier-treated cohort serves as the counterfactual benchmark for a later-treated cohort, its outcome trajectory is already altered by the ongoing intervention. If the policy generates dynamic treatment effects—such as regulatory compliance learning curves or compounding organizational changes—the early cohort experiences ongoing growth during the late cohort's post-treatment window. Because difference-in-differences subtracts the control group's trend, the estimator subtracts this treatment growth, penalizing the later cohort and assigning negative weights that pull the aggregate estimate downward.

In a staggered panel with dynamic treatment effects, subtracting the trend of an already-treated unit treats real policy benefits as if they were counterfactual background growth, dragging down the estimated effect.

Researchers can determine whether their panel dataset is vulnerable to TWFE bias by evaluating four core diagnostic indicators:

  • 1. Staggered intervention rollout: Units such as provinces, municipalities, hospitals, or firms adopt the intervention across multiple distinct calendar periods rather than simultaneously at a single threshold date.
  • 2. Dynamic or compounding treatment effects: The causal mechanism takes several periods to manifest or mature, making constant treatment effect assumptions across post-adoption periods unrealistic.
  • 3. Substantial proportion of early-adopting units: A large share of sample units adopts the policy early in the panel timeline, causing contaminated early-versus-late comparisons to dominate total sample weights.
  • 4. Non-zero negative weight share from decomposition diagnostics: Running a Bacon decomposition reveals that early-treated comparisons carry non-trivial weight and negative signs in the sample weighting matrix.

Modern Robust Estimators: Callaway & Sant'Anna, Sun & Abraham, and Stacked DiD

To overcome the negative weighting trap, econometricians developed robust estimators that explicitly purge already-treated comparisons from the counterfactual pool. Rather than forcing heterogeneous cohort trajectories into a single static regression coefficient, modern solutions estimate clean cohort-specific or group-time average treatment effects (`ATT(g, t)`) and aggregate them using sample cohort shares. Three primary frameworks have achieved broad acceptance among journal editors and peer reviewers: Callaway & Sant'Anna (2021) implemented via the `did` package, Sun & Abraham (2021) implemented via `fixest::sunab`, and clean-control stacked difference-in-differences.

Estimator & PackageControl Group OptionsPrimary AdvantageModeling AssumptionsRecommended Use Case
Callaway & Sant'Anna (2021; did)Never-treated or not-yet-treatedSemiparametric doubly robust estimation; flexible aggregation by group, calendar time, or event timeConditional parallel trends based on pre-treatment covariates; no anticipationGeneral staggered panels with observed baseline covariates; standard for economics and finance empirical papers
Sun & Abraham (2021; fixest::sunab)Never-treated or last-treated cohortFast high-dimensional fixed-effect linear regression; explicit cohort interaction weightingParallel trends hold for each cohort relative to chosen clean control cohortLarge-scale microdata panels where computational speed and multi-way fixed effects are paramount
Stacked DiD (Clean Sub-experiments)Cohort-specific never-treated or not-yet-treatedIntuitive 2x2 stacking structure; directly estimable in standard OLS routines on expanded dataRequires duplicating clean control records across multiple event-specific panel windowsTransparent robustness check when reviewers request standard regression tables or Stata-compatible scripts

Choosing between never-treated and not-yet-treated comparison groups depends directly on your institutional setting. When an intervention eventually diffuses across all units in the sample, a permanent never-treated group does not exist, requiring researchers to rely on not-yet-treated observations. However, because cohorts adopting late in the sample window contribute fewer post-treatment periods, empirical researchers should truncate event-study horizons to avoid compositional shifts where distant post-treatment estimates reflect only a non-representative subset of early adopters.

Doubly robust estimation in Callaway & Sant'Anna protects identification if either the propensity score model or the outcome regression model is correctly specified.

Event-Study Dynamics: Reference Normalization and Treatment-Unit Clustering

Parallel trends cannot be evaluated credibly in staggered panels using naive TWFE event-study regressions. When researchers include two-way fixed effects alongside simple dynamic lead and lag indicators, post-treatment effect heterogeneity from other cohorts bleeds into the pre-treatment coefficients, creating phantom pre-trends or masking genuine anticipatory behavior. Both Sun & Abraham (2021) and Callaway & Sant'Anna (2021) demonstrate that valid dynamic testing requires estimating cohort-specific event coefficients before aggregating them with clean cohort weights.

Collinearity requires dropping at least one reference period prior to policy adoption. The standard econometric convention normalizes the coefficient at `t = -1` (the period immediately preceding treatment) to zero. In empirical settings where economic agents anticipate policy adoption—such as public disclosure mandates or facility licensing changes debated before enactment—researchers should shift the omitted reference period to `t = -2` and inspect whether `t = -1` exhibits significant pre-treatment adjustment. Furthermore, standard errors must be clustered at the primary level of policy assignment (such as the province, district, hospital network, or parent firm) rather than individual subunits, ensuring hypothesis tests account for arbitrary serial correlation within treatment clusters.

Before submitting an empirical manuscript relying on staggered adoption, researchers should complete four verification steps:

  • 1. Normalize the event study reference period to `t = -1` (or `t = -2` under suspected anticipation) and verify all pre-treatment coefficients are statistically indistinguishable from zero using simultaneous confidence bands.
  • 2. Report the Goodman-Bacon decomposition summary, presenting the aggregate weights and average estimates across early-versus-late, late-versus-early, and treated-versus-untreated 2×2 sub-experiments.
  • 3. Cluster standard errors at the primary policy assignment level and verify that the effective number of independent clusters is adequate to avoid small-cluster asymptotic distortion.
  • 4. Cross-check your empirical chapter using our methods and results revision checklist and run the final manuscript pre-submission checklist before distributing drafts to co-authors or journal editors.

Reproducible DiD Execution and Robustness Packaging in HumanPen Start Project

Transforming theoretical identification strategies into reproducible empirical submissions requires coordinating raw panel files, estimation pipelines, and formatted regression tables. In HumanPen Start Project, researchers can upload complex panel data alongside methodological guidelines to build reproducible econometric workflows. Attach your data and papers, describe what you need, approve the plan before work starts, and get the reviewed report, charts, and code ready to preview online or download.

Data handling follows rigorous technical standards: uploads support Excel, CSV, Word, PDF, zip archives, and multi-file folders up to 2 GB total. Computations execute inside an isolated sandbox running native Python or R environments. When previous drafts were drafted in Stata using packages like `reghdfe` or `bacondecomp`, equivalent validated pipelines are implemented in Python or R with verified standard error matching. If your empirical project relies on restricted commercial databases such as CNKI or Wind, raw panels must be exported beforehand and supplied by the researcher. GPU training is not supported. All project assets remain securely stored for 6 months (180 days) after the last activity, with an advance reminder 3 days prior to expiration, and can be permanently removed at any time.

For an end-to-end benchmark of microdata panel handling and fixed-effects estimation, explore the public 311 urban microdata empirical paper on the example projects page. That reproducible project matched 8.57 million geocoded urban service records across 2015–2024 with daily weather station metrics and neighborhood demographic covariates, running fixed-effects dose-response regressions and delivering full LaTeX sources, a 10-page compiled PDF, and end-to-end Python analysis scripts (`01_download` through `08_wordcount`).

Analysis code, baseline tables, and event-study figures generated in Start Project serve as a reproducible methodological and learning reference scaffold; researchers must independently verify assumptions, inspect raw estimation logs, and adhere to their institution's AI and data governance policies.

Frequently Asked Questions About Staggered DiD Panels

Can I still report standard Two-Way Fixed Effects alongside modern cohort estimators? Yes. Transparent empirical practice often reports the traditional TWFE model in Column 1 of the baseline regression table as an initial benchmark, reports the Goodman-Bacon decomposition in the text, and presents robust estimators such as Callaway & Sant'Anna or Sun & Abraham in subsequent columns. Reviewers appreciate seeing whether point estimates and inference remain consistent once potential negative weights are eliminated.

What should I do if my panel has no never-treated units? When an intervention eventually affects every unit in your sample, configure your estimator to use not-yet-treated units as the counterfactual pool. In the R package `did`, set `control_group = "notyettreated"`. Restrict your dynamic event-study window to periods where late-adopting cohorts provide balanced coverage, and avoid evaluating long-horizon post-treatment leads where all remaining units have already been treated.

How many clusters are needed for cluster-robust standard errors? Econometric consensus generally recommends at least 40 to 50 balanced clusters at the level of treatment assignment. If policy variation occurs across fewer units, such as 10 to 20 provinces or jurisdictions, standard asymptotic cluster-robust standard errors can severely underestimate variance; in those settings, researchers should report wild cluster bootstrap p-values or permutation inference to prevent false positives.

How does HumanPen handle custom panel datasets that need confidentiality? Project uploads are encrypted in transit and isolated in dedicated private execution environments. Data files are never used to train shared models or exposed across user accounts. Records remain accessible for 6 months after last activity and can be permanently deleted by the user at any moment.

Sources

KEEP READING