1 What Problem Does bdid Solve?
The staggered difference-in-differences literature has produced a family of frequentist estimators—Callaway-Sant'Anna, Sun-Abraham, Borusyak-Jaravel-Spiess, de Chaisemartin-D'Haultfoeuille—each recovering group-time average treatment effects (ATTs) under parallel trends. These estimators are well-understood and widely implemented. But they share a common limitation: they are frequentist, and their inference relies on asymptotic normal approximations that may be poor in small samples, particularly when the number of treatment cohorts is small.
Chib and Shimizu [2025] propose a fully Bayesian approach to staggered DiD, implemented in the bdid package (available for R, Stata, and MATLAB). The Bayesian approach has three practical advantages in the staggered setting:
- Finite-sample validity: Posterior credible intervals are exact in finite samples under the model, unlike frequentist confidence intervals that rely on n → ∞ approximations.
- Natural uncertainty aggregation: When aggregating group-time ATTs into a single summary, the Bayesian approach automatically propagates all estimation uncertainty through the aggregation step.
- Prior information: Prior distributions on treatment effects can incorporate economic knowledge about the plausible direction and magnitude of effects.
2 The Statistical Model
bdid models the staggered DiD setting using the potential outcome framework of Callaway and Sant'Anna [2021]. Define G as the cohort of treatment adoption (the first time period in which unit i is treated), and Yᵢₜ(g) as the potential outcome for unit i in period t under adoption cohort g. The group-time ATT is:
where Yᵢₜ(∞) denotes the never-treated potential outcome. The bdid model places a hierarchical prior on the ATT(g, t) values:
with hyperparameters μ₀, τ², a₀, b₀ that can be set by the researcher or estimated via empirical Bayes. The parallel trends assumption enters as a moment restriction. For pre-treatment periods t < g, the model imposes ATT(g, t) = 0 in expectation, with the posterior tightening around zero as the data confirm pre-trends are small.
3 Installation and Setup
Listing 1: Installing and loading bdid
4 A Minimal Working Example
We simulate a staggered DiD dataset with three treatment cohorts and estimate group-time ATTs using bdid.
Listing 2: Simulating staggered DiD data and estimating with bdid
Listing 3: Summarising and plotting the bdid output
5 Key Options and Pitfalls
5.1 Prior Sensitivity
Bayesian inference depends on the prior. With small samples or few treated cohorts, the prior on the ATTs can materially affect posteriors . bdid provides a sensitivity workflow:
Listing 4: Prior sensitivity analysis
5.2 Parallel Trends Diagnostic
The bdid model incorporates the parallel trends assumption through the prior on pre-treatment ATTs. The posterior mass on pre-treatment ATTs away from zero measures the data's evidence against parallel trends:
Listing 5: Pre-trend diagnostic
5.3 Computational Considerations
bdid uses Markov Chain Monte Carlo (MCMC) via Gibbs sampling, which is exact but slower than the frequentist estimators in did or fixest. For datasets with many units and periods, consider:
- Reducing MCMC iterations and using parallel chains to assess convergence (via R < 1.01).
- Using the n_cores argument to parallelise chains across CPU cores.
- The Variational Bayes approximation (method = "vb") runs 10-50x faster at the cost of approximate (but often accurate) posterior inference.
Table 1: Comparison of Staggered DiD Estimators
6 Comparison to Frequentist Alternatives
The key practical difference is uncertainty aggregation. When aggregating from group-time ATTs to a single overall ATT, the frequentist packages use delta-method or bootstrap approximations . bdid propagates the full posterior through the aggregation step, which tends to produce wider and more honest credible intervals when the group-time ATTs are estimated imprecisely.
7 When to Use bdid
Use bdid when:
- Your application has few treatment cohorts or few units per cohort, where asymptotic normal approximations may be unreliable.
- You have genuine prior information about the direction or magnitude of treatment effects (e.g., from prior studies or economic theory).
- You need to propagate uncertainty through a downstream decision analysis (e.g., Bayesian decision trees, value of information calculations).
Stick to frequentist estimators when:
- You have a large balanced panel with many treated cohorts, where asymptotic theory works well and computation time matters.
- Your application requires exact replication of existing frequentist results.
- Prior sensitivity is a concern and you want to avoid any influence of prior assumptions.
8 Conclusion
bdid fills a genuine gap in the staggered DiD toolkit by providing fully Bayesian inference. Its hierarchical model naturally accommodates the group-time structure of staggered treatments, and MCMC-based inference is exact under the model rather than asymptotic. For researchers with small samples, strong prior information, or downstream decision analyses, bdid is a valuable complement to the existing frequentist packages.
References
- Callaway, B. and Sant'Anna, P. H. (2021). Difference-in-differences with multiple time periods. Journal of Econometrics, 225(2):200-230.
- Chib, S. and Shimizu, M. (2025). Bayesian potential outcome modeling in difference-in-differences with staggered treatments. arXiv preprint, 2505.18391.
- Goodman-Bacon, A. (2021). Difference-in-differences with variation in treatment timing. Journal of Econometrics, 225(2):254-277.
- Rambachan, A. and Roth, J. (2023). A more credible approach to parallel trends. Review of Economic Studies, 90(5):2555-2591.
- Sun, L. and Abraham, S. (2021). Estimating dynamic treatment effects in event studies with heterogeneous treatment effects. Journal of Econometrics, 225(2):175-199.