A Bayesian Alternative to Synthetic Control for Comparative Case Studies

Abstract This paper proposes a Bayesian alternative to the synthetic control method for comparative case studies with a single or multiple treated units. We adopt a Bayesian posterior predictive approach to Rubin’s causal model, which allows researchers to make inferences about both individual and average treatment effects on treated observations based on the empirical posterior distributions of their counterfactuals. The prediction model we develop is a dynamic multilevel model with a latent factor term to correct biases induced by unit-specific time trends. It also considers heterogeneous and dynamic relationships between covariates and the outcome, thus improving precision of the causal estimates. To reduce model dependency, we adopt a Bayesian shrinkage method for model searching and factor selection. Monte Carlo exercises demonstrate that our method produces more precise causal estimates than existing approaches and achieves correct frequentist coverage rates even when sample sizes are small and rich heterogeneities are present in data. We illustrate the method with two empirical examples from political economy.


Introduction
With the introduction of the synthetic control method (SCM) (Abadie and Gardeazabal 2003;Abadie, Diamond, and Hainmueller 2010), comparative case studies using time-series crosssectional (TSCS) data, or long panel data, are becoming increasingly popular in the social sciences.Compared with other quantitative social science research, comparative case studies have several unique features: (1) the sample includes a small number of aggregate entities; (2) a handful of units, or one, receive an intervention that is not randomly assigned; and (3) the treatment effect often takes time to present itself (Abadie 2020).As a result, comparative case studies face two main challenges given limited data: to "provide good predictions of the [counterfactual] trajectory of the outcome" of the treated unit(s) (Abadie, Diamond, andHainmueller 2015, p. 499, henceforth, ADH 2015); and to make credible statistical inferences about the treatment effects.
The SCM uses a convex combination of control outcomes to predict the treated counterfactuals.Inspired by the SCM, a fast-growing literature proposes various new methods to improve the SCM's counterfactual predictive performance and robustness, or to extend the SCM to accommodate multiple treated units.These methods can be broadly put into three categories: (1) matching or reweighting methods, such as best subset (Hsiao, Ching, and Wan 2012), regularized weights (Doudchenko and Imbens 2017), and panel matching (Imai, Kim, and Wang 2019); (2) explicit outcome modeling approaches, such as Bayesian structural time-series models (Brodersen et al. 2014), latent factor models (LFMs) (e.g., Bai 2009;Gobillon and Magnac 2016;Xu 2017), and matrix completion methods (Athey et al. 2018); and (3) doubly robust methods, such as the augmented SCM (Ben-Michael, Feller, and Rothstein 2020) and synthetic difference-in-differences (DiD) (Arkhangelsky et al. 2020).
However, both inference and prediction challenges are not fully addressed by existing methods.The SCM uses a placebo test as an inferential tool, but users cannot interpret it as a permutation test since the treatment is not randomly assigned (Hahn and Shi 2017).Hence, researchers cannot quantify the uncertainty of their estimates in traditional ways.Other frequentist inferential methods require a repeated sampling interpretation, 1 which is often at odds with the fixed population of units at the heart of many comparative case studies.Additionally, from a prediction perspective, researchers can use multiple sources of information in TSCS data for counterfactual prediction, including (1) temporal relationships between the known "past" and the unknown "future" of each unit, (2) cross-sectional information reflecting the similarity between units based on observed covariates, and (3) time-series relationships among units based on their outcome trajectories (Beck and Katz 2007;Pang 2010;Pang 2014).While better predictive performance can translate to more precise causal estimates, existing model-based approaches make relatively rigid parametric assumptions and therefore do not take full advantage of the information in data.
The Bayesian approach is an appealing alternative to meet these challenges.First, Bayesian uncertainty measures are easy to interpret.Bayesian inference provides a solution to the inferential problem by making "probability statements conditional on observed data and an assumed model" (Gelman 2008, 467).Second, Bayesian multilevel modeling is a powerful tool to capture multiple sources of heterogeneity and dynamics in data (Gelman 2006).It can accommodate flexible functional forms and use shrinkage priors to select model features, which reduces model dependency and incorporates modeling uncertainties.
In this paper, we adopt the Bayesian causal inference framework (Rubin 1978;Imbens and Rubin 1997;Rubin et al. 2010;Ricciardi, Mattei, and Mealli 2020) to estimate treatment effects in comparative case studies.This framework views causal inference as a missing data problem and relies on the posterior predictive distribution of treated counterfactuals to draw inferences about the treatment effects on the treated.Missingness under this assumption falls in the category of "missing not at random" (MNAR) (Rubin 1976) because the assignment mechanism is allowed to be correlated to unobserved potential outcomes.The basic idea is to perform a low-rank approximation of the observed untreated outcome matrix so as to predict treated counterfactuals in the (T × N ) rectangular outcome matrix.A key assumption we rely on is called latent ignorability (Ricciardi, Mattei, and Mealli 2020), which states that treatment assignment is ignorable conditional on exogenous covariates and an unobserved latent variable, which is learned from data.
Conceptually, the latent ignorability assumption is an extension of the strict exogeneity assumption.Existing causal inference methods using TSCS data rely on either of the two types of assumptions for identification: strict exogeneity, which is behind the conventional two-way fixed effect approach and implies "parallel trends" in DiD designs, and sequential ignorability, which has gained popularity recently (e.g., Blackwell 2013;Blackwell and Glynn 2018;Ding and Li 2018;Hazlett and Xu 2018;Strezhnev 2018;Imai, Kim, and Wang 2019).Strict exogeneity requires that treatment assignment is independent of the entire time series of potential outcomes conditional on a set of exogenous covariates and unobserved fixed effects.It rules out potential feedback effects from past outcomes on current and future treatment assignments (Imai and Kim 2019).Its main advantage is to allow researchers to adjust for unit-specific heterogeneity and to use contemporaneous information from a fixed set of control units to predict treated counterfactuals, a key insight of the SCM.Sequential ignorability, on the other hand, allows the probability of treatment to be affected by past information including realized outcomes.In this paper, we adopt the strict exogeneity framework because it is consistent with the assumptions behind the SCM.
Specifically, we propose a dynamic multilevel latent factor model (henceforth DM-LFM) and develop an estimation strategy using Markov Chain Monte Carlo (MCMC).It incorporates a latent factor term to correct biases caused by the potential correlation between the timing of the treatment and the time-varying latent variables that can be represented by a factor structure, such as diverging trends across different units.It also allows covariate coefficients to vary by unit or over time.Because the model is parameter-rich, we use Bayesian shrinkage priors to conduct stochastic variable and factor selection, thus reducing model dependency.The MCMC algorithm we develop incorporates both model selection and parameter estimation in the same iterative sampling process.
After estimating a DM-LFM, Bayesian prediction generates the posterior distribution of each counterfactual outcome by integrating out all model parameters.We then compare the observed outcomes with the posterior distributions of their predicted counterfactuals to generate the posterior distribution of a causal effect of interest, conditional on observed data.We can use the posterior mean as the point estimate and form its uncertainty measure using the Bayesian 95% credibility interval defined by the 2.5% and 97.5% quantiles of the empirical posterior distribution.The uncertainty measure is easily interpretable: conditional on the data and assumed model, the causal effect takes values from the interval with an estimated probability of 0.95.It captures three sources of uncertainties: (1) the uncertainties from the data generating processes (DGPs), or fundamental uncertainties (King, Tomz, and Wittenberg 2000); (2) the uncertainties from parameter estimation; and (3) the uncertainties from choosing the most suitable model, while existing frequentist methods, such as LFMs, only take into account the first two sources.
Several studies have used Bayesian multilevel modeling for counterfactual prediction.Some are interested in the time-series aspect of data (Belmonte, Koop, and Korobilis 2014;de Vocht et al. 2017), in short panels (e.g., two periods) (Ricciardi, Mattei, and Mealli 2020), in large datasets with many treated and control units (Gutman, Intrator, and Lancaster 2018), or in latent factor models without covariates (Samartsidis 2020).A few others have used the Bayesian approach to improve inference for comparative case studies.For example, Amjad, Shah, and Shen (2018) adopt an empirical Bayesian approach to construct error bounds of the treatment effects, but nevertheless rely on frequentist optimization to obtain weights of the SCM.Kim, Lee, and Gupta (2020) propose a fully Bayesian version of the SCM, focusing on the single treated unit case and aiming at estimating a uni-dimensional set of weights on controls.
Our method can be applied to comparative case studies with one or more treated units.Like the SCM, it requires a large number of pre-treatment periods and more control units than the treated to accurately estimate the treatment effect.Our simulation study suggests that the number of pretreatment periods for the treated units needs to be greater than 20 for the method to achieve satisfactory frequentist properties.Compared with the SCM or LFMs, our method is most suitable when one of the following is true: (1) the uncertainty measures bear important policy or theoretical implications; (2) researchers suspect the latent factor structure is complex, the number of factors is large, or some of the factors are relatively weak; (3) many potential pre-treatment covariates are available and their relationships with the outcome variable may vary across units or over time; or (4) researchers have limited knowledge of how to select covariates for counterfactual prediction.Compared to its frequentist alternatives, this Bayesian method is computationally intense.We therefore develop an R package bpCausal, whose core functions are written in C++, for researchers to efficiently implement this method.

Bayesian Causal Inference: Posterior Predictive Distributions
We start by introducing the basic setting and fixing notations.We then define causal quantities of interest and develop posterior predictive distributions of counterfactuals based on several key assumptions.When doing so, we will use two empirical examples.The first one is on German reunification from ADH (2015).It is appealing to illustrate our method for several reasons.First, only one unit (West Germany) in the dataset was treated, and the treatment-a historical eventtook place only once.Second, the control group consists of 16 Organization for Economic Cooperation and Development (OECD) member countries, and no single country in this group or their simple average can serve as an appropriate counterfactual for West Germany.Furthermore, the impact of reunification may emerge gradually over time.The second example concerns the effect of election day registration (EDR) on voter turnout in the United States.Xu (2017) uses this example to demonstrate a frequentist LFM (a.k.a. the generalized synthetic control method, or Gsynth).Compared to the first example, it represents a more general setting of comparative case studies in which there are multiple treated units and the treatment starts at different points in time.

Setup and Estimands
We denote i = 1, 2, . .., N and t = 1, 2, . ..,T as the unit and time for which and when the outcome of interest is observed.Although our method can accommodate imbalanced panels, we assume a balanced panel instead for notational convenience.We consider a binary treatment w i t that, once it takes a value of 1, cannot reverse back to 0 (staggered adoption).Following Athey and Imbens (2018), we define the timing of adoption for each unit i as a random variable a i that takes its values in º = {1, 2, . ..,T , c}, in which a i = c > T means that unit i falls in the residual category and does not get treated in the observed time window.We call unit i a treated unit if it adopts the treatment at any of the observed time periods (a i = 1, 2, . ..,T ); we call it a control unit if it never adopts the treatment by period T (a i = c).The number of pre-treatment periods for a treated unit is T 0,i = a i − 1. Suppose there are N co control units and N t r treated units; N co + N t r = N .In comparative case studies, N t r = 1 or a small integer.
Denote w i = (w i 1 , . ..,w iT ) as the treatment assignment vector for unit i. Staggered adoption implies that the adoption time a i uniquely determines vector w i : w i (a i ), in which w i t = 0 if t < a i and w i t = 1 if t a i , for t = 1, 2, . ..,T .We further define an (N ×T ) treatment assignment matrix, W = {w 1 , . .., w N }; similarly, W is fully determined by A = {a 1 , . .., a i , . .., a N }, the adoption time vector.Following Athey and Imbens (2018), we make the following two assumptions to rule out cross-sectional spillover and the anticipation effect.
Assumption 1 (Cross-sectional stable unit treatment value assumption (SUTVA)).Potential outcomes of unit i are only functions of the treatment status of unit i: This assumption rules out cross-sectional spillover effects and significantly reduces the number of potential outcome trajectories.For each unit i, because now there are only (T + 1) possibilities for w i , there are (T + 1) potential outcome trajectories, denoted by y i t (w i ), t = 1, 2, . ..,T .In the German reunification example, this assumption rules out the possibility that German reunification affects economic growth in the other 16 countries, which may, in fact, be a strong assumption.In the EDR example, this assumption implies that the adoption of EDR laws in State B does not affect State A's turnout with or without EDR laws.Because w i is fully determined by a i , we simply write y i t (w i (a i )) as y i t (a i ).
Assumption 2 (No anticipation).For all unit i, for all time periods before adoption t < a i : in which y i t (c) is the potential outcome under the "pure control" condition, that is, the treatment vector w i includes all zeros.This assumption says that the current untreated potential outcome does not depend on whether the unit gets the treatment in the future.The assumption is violated when anticipating that a unit will adopt the treatment in the future affects its outcome today.For example, if people anticipated German reunification to take place in 1990 and West Germany's economy adjusted to that expectation before 1990, the assumption would be violated.
Estimands.Under Assumptions 1 and 2, for treated unit i whose adoption time a i T , we define its treatment effect at t a i as In other words, we focus on the difference between the observed post-treatment outcome of treated unit i and the counterfactual outcome of the same unit that had never received the treatment by period T. In the German reunification example, the causal effect of interest is the difference between the observed gross domestic product (GDP) per capita of West Germany in reunified Germany since 1990 and that of the counterfactual West Germany had it remained separated from East Germany.
Because y i t (a i ) of treated unit i is fully observed for t a i , the Bayesian framework regards it as data.The counterfactual outcomey i t (c) of treated unit i for t a i , on the other hand, is an unknown quantity; we regard it as a random variable.We also define the sample average treatment effect on the treated (ATT) for units that have been under the treatment for a duration of p periods: , where N t r ,p is the number of treated units that have been treated for p periods in the sample.
Given that y i t (a i ) is observed in the post-treatment period, estimating δ i t is equivalent to constructing the counterfactual outcome y i t (c).Under Assumptions 1 and 2, we can denote Y(0), a (N ×T ) matrix, as the potential outcome matrix under W = 0 (i.e., a i = c, i ).Given any realization of W, we can partition the indices for Y(0) into two sets: S 0 ≡ {(i t )|w i t = 0}, with which y i t (c) is observed; and S 1 ≡ {(i t )|w i t = 1}, with which y i t (c) is missing.Additionally, S = S 0 ∪ S 1 .We denote the observed and missing parts of Y(0) as Y(0) obs and Y(0) mi s , respectively, and Y i (0) obs and Y i (0) mi s as the row vectors in Y(0) obs and Y(0) mi s corresponding to unit i, respectively.Rubin et al. (2010) lay down the fundamentals of Bayesian causal inference, which views "causal inference entirely as a missing data problem" (p.685).In general, using the observed outcomes and covariates, as well as the assignment mechanism, we can stochastically impute counterfactuals from their posterior predictive distribution Pr(Y(W) mi s |X, Y(W) obs , W).Since in this research the main causal quantity of interest is the (average) treatment effect on the treated, our primary goal is to predict counterfactuals Y(0) mi s , the untreated outcomes of the treated units.Because staggered adoption implies that W is fully determined by A, the adoption time vector, we write the posterior predictive distribution of Y(0) mi s as Pr(Y(0

The Assignment Mechanism
(1) The Bayes rule gives the equality in Equation ( 1), and we obtain the proportionality by dropping the denominator as a normalizing constant since it contains no missing data.Hence, two component probabilities, the underlying "science" Pr(X, Y(0)) and the treatment assignment mechanism Pr(A|X, Y(0)), help predict the counterfactuals.
Assumption 3 (Individualistic assignment and positivity).Pr(A|X, Y(0)) We assume that the treatment assignment is "individualistic" (Imbens and Rubin 2015, 31), that is, the adoption time of unit i does not depend on the covariates or potential outcomes of other units or their time of adoption, given X i and Y i (0).We also require that each i has some nonzero chances of getting treated.The first part of this assumption is violated if policy diffusion takes place-for example, State A adopts EDR following State B's policy shift-and such an emulation effect cannot be captured by a unit's pre-treatment covariates and untreated potential outcomes.The positivity assumption means that all units in the sample have some probability of getting treated, thus justifying using control information to predict treated counterfactuals.
The fact that Pr( ) implies that the treatment assignment mechanism may be correlated with Y i (0) mi s .To rule out potential confounding, one possibility is to impose further restrictions and make an ignorability assignment assumption Pr(a i |X i , Y i (0) obs ) (Rubin 1978).However, in the more general setting of MNAR, this restriction is unlikely to be true.For instance, the timing of a state's adopting an EDR law could be driven by legislators' concern about future voter turnout in the absence of such laws.Therefore, we rely on the latent ignorability assumption to break the link between treatment assignment and control outcomes.
Assumption 4 (Latent ignorability).Conditional on the observed pre-treatment covariates X i and a vector of latent variables , the assignment mechanism is free from dependence on any missing or observed untreated outcomes for each unit i, that is, (2) Note that X i can include both time-varying and time-invariant pre-treatment covariates.U i captures both unit-level heterogeneity, such as unit fixed effects, and unit-specific time trends (e.g., u i t = γ i • g (t ), in which g (•) is a function of time).We expect U i to be correlated with Y i (0); in fact, we will extract it from Y i (0) obs .Therefore, once we condition on X i and U i , the entire time series of Y i (0) is assumed to be independent of a i .Thus, we can understand Assumption 4 as an extension of the strict exogeneity assumption often assumed in fixed effects models.Like strict exogeneity, it rules out dynamic feedback from the past outcomes on current and future treatment assignments, conditional on U i .
The latent ignorability assumption is key to our approach.It is easy to see that the "parallel trends" assumption is implied by this assumption when U i is a unit-specific constant What does this assumption mean substantively?In the EDR example, suppose there is an unmeasured downward trend in voter turnout in all states since the 1970s, driven by unknown socioeconomic forces.Its impact may be different across states due to differences in geography, demography, party organizations, ideological orientation, and so on.At the same time, the adoption of EDR in a state is correlated with how much such a trend would affect the state's turnout in the absence of any policy changes.In this case, the "parallel time trends" assumption is invalid because u i t is a time-varying confounder; however, we can correct for the biases if we can estimate, then condition on, the state-specific impact of this common trend.Hence, we further make a feasibility assumption.
Assumption 5 (Feasible data extraction).Assume that, for each unit i, there exists an unobserved covariate vector U i for each unit i, such that the stacked (N × T ) matrix U = (U 1 , . .., U N ) can be approximated by two lower-rank matrices (r min{N ,T }), that is, This assumption is explicitly or implicitly made with the factor-augmented approach in the existing literature (Xu 2017;Athey et al. 2018;Bai and Ng 2020).It says that we can decompose the unit-specific time trends into multiple common trends with heterogeneous impacts.Assumption 5 is violated when U 1 , . .., U n have no common components; for example, when unit-specific time trends are idiosyncratic.

Posterior Predictive Inference
Under Assumption 4, we temporarily consider U as part of the covariates and write X and U together as X .Then we have the posterior predictive distribution of Y(0) mi s as (3) The first line is simply to re-write Equation (1) by replacing X with X ; we reach the second step using the latent ignorability assumption; the last step drops the treatment assignment mechanism Pr(A|X ) as a normalizing constant since it does not contain Y(0) mi s .Equation (3) says that the latent ignorability assumption makes the treatment assignment mechanism ignorable in counterfactual prediction; as a result, we can ignore it as long as we condition on X .In other words, under these assumptions, the task of developing the posterior predictive distributions of counterfactuals is reduced to model Pr(X , Y(0)).We need this trick because in comparative case studies, the number of treated units is small; as a result, we lack sufficient variation of the timing of adoption in data to model Pr(A|X ).To model the underlying "science," we further make the assumption of exchangeability: By de Finetti's theorem (de Finetti 1963), {(X i t , y i t (c))} can be written as i.i.d, given some parameters and their prior distributions.Note that Pr(X , Y(0)) is equivalent to Pr({(X i t , y i t (c))}), and we now can write the posterior predictive distribution of Y(0) mi s in Equation (3) as where θ are the parameters that govern the DGP of y i t (c) given X i t , and θ = (θ, U) when we regard the latent covariates U as parameters.Note that in Equation ( 4), the likelihood is based on observed outcomes while the posterior predictive distribution is for predicting the missing potential outcomes.The second proportionality is reached by de Finetti's theorem and under the assumption that the set of parameters that govern the DGP of the covariates X are independent of θ.See Supplementary Material for a formal mathematical development of the posterior predictive distribution.
Recall that our objective is to impute the untreated potential outcomes for treated observations.If we assume that the DGPs of the outcomes in S 0 and S 1 follow the same functional form f (•), we can build a parametric model and estimate parameters based on the likelihood and then predict y i t (c) mi s for i N co at t a i using the posterior predictive distribution.If we can correctly estimate π(U|X, Y(0) obs ), the posterior distributions of U, using a factor analysis, we can draw samples of treated counterfactuals y i t (c) mi s from its posterior predictive distribution as in Equation ( 1) by integrating out the model parameters.

Modeling and Implementation
In this section, we discuss the modeling strategy for the likelihood function and the posterior predictive distribution.We explain the proposed DM-LFM and discuss Bayesian shrinkage method for factor selection and model searching to reduce model dependency.

A Multilevel Model with Dynamic Factors
Assumption 7 (Functional form).The untreated potential outcomes for unit i = 1, . .., N at t = 1, . ..,T are specified as follows: Equation ( 5) is the individual-level regression, in which y i t (c) is explained by three components.The first one, X i t β i t , captures the relationships between observed covariates and the outcome.The double subscripts of β i t indicate that we allow these relationships to be heterogeneous across units and over time.Equation ( 6) decomposes β i t into three parts: β is the mean of β i t and shared by all observations, and α i and ξ t are zero-mean unit-and time-specific "residuals" of β i t , respectively.The second component, γ i f t , is the multifactor term, in which f t and γ i are (r × 1) vectors of factors and factor loadings, respectively.Consistent with Assumption 5, we use f t and γ i to approximate U i .The last component, i t , represents i .i.d .idiosyncratic errors.We further model the dynamics in ξ t and f t by specifying autoregressive processes as shown in Equation (7).We assume both transition matrices Φ ξ and Φ f are diagonal: Φ ξ = Diag(φ ξ 1 , . ..,φ ξ p 3 ) and Φ f = Diag(φ f 1 , . ..,φ f r ).2 Finally, we assume the individual-and group-level errors, i t , e t , and ν t , to be i.i.d.normal.
The DM-LFM allows the slope coefficient of each covariate to vary by unit, time, both, or neither.To illustrate this flexibility, we rewrite the individual-level model in a reduced and matrix format as The shaded nodes represent observed data, including untreated outcomes and covariates; the unshaded nodes represent "missing" data (treated counterfactuals) and parameters.Only one (treated) unit i is shown.T 0i = a i − 1 is the last period before the treatment starts to affect unit i.The focus of the graph is Period t.Covariates in periods other than t, as well as relationships between parameters and y i 1 (c), y iT 0i (c) , and y iT (c), are omitted for simplicity.
in which F = (f 1 , . .., f T ) is a (T × r ) factor matrix.Z i of dimension (T × p 2 ) are covariates that have unit-specific slopes (β + α i ).A i of dimension (T × p 3 ) are covariates that have time-specific slopes (β + ξ t ).Both A i and Z i are subsets of X i .When the kth covariate is in A i ∩ Z i , it has a slope coefficient that varies across units and over time, that is, Accordingly, β is a (p 1 × 1) coefficients vector, α i is a (p 2 × 1) vector, ξ = (ξ 1 , . .., ξ T ) is a (p 3 × 1) vector, and p 1 p 2 , p 3 .Because α i , ξ t , f t are centered at zero, the systemic part of the model is ¾[y i (c)] = X i β.The rest of the components define the variance of the composite errors as , which contains nonzero off-diagonal elements because of the components Z i and A i .Note that we allow Z i α i , A i ξ, and Fγ i to be arbitrarily correlated.
Figure 1 presents the model graphically, and the shrinkage parameters λ's in the figure will be discussed later.Note that this outcome model governs y i t (c) only.Without loss of generality, we can add δ i t w i t in the model in which δ i t is the causal effect for unit i at time t.This model is a dynamic and multilevel extension to several existing causal inference methods with TSCS data.For example, if we set Z i = A i = (1, 1, . .., 1) , and r = 0, Equation (8) becomes a parametric linear DiD model with covariates and two-way fixed effects: y i t = δ i t w i t + X i t β + α i + ξ t + i t .This is what Liu, Wang, and Xu (2020) call the fixed effects counterfactual model.When we put restrictions Z i t = ∅ and X i = A i is time-invariant, our model is reduced to a factor model that justifies the SCM (Abadie, Diamond, and Hainmueller 2010): Gsynth is also a special case of the model when we force the coefficients not to vary; that is, Z i t = ∅ and A i t = ∅ and y i t = δ i t w i t + X i t β + γ i f t + i t (Xu 2017).

Bayesian Stochastic Model Specification Search
One advantage of the DM-LFM is that it is highly flexible.However, the large number of specification options poses a challenge to model selection.Bayesian stochastic model searching reduces the risks of model mis-specification and simultaneously incorporates model uncertainty.We use shrinkage priors to choose the number of latent factors and decide whether and how to include a covariate.Specifically, we adopt the Bayesian Lasso and Lasso-like hierarchical shrinkage methods based on recent research. 3We apply the Bayesian Lasso shrinkage on β using the following hierarchical setting of mixture of a normal-exponential prior, The tuning parameter λ controls the sparsity and degree of shrinkage and can be understood as the Bayesian equivalent to the regulation penalty in a frequentist Lasso regression.Instead of fixing λ at a single value, we take advantage of Bayesian hierarchical modeling and give it a Gamma distribution with hyper-parameters a 1 and a 2 . 4o select the other components of the model, we impose shrinkage on α i , ξ t , or γ i to determine whether to include a Z j ( j = 1, 2, . .., p 2 ), A j ( j = 1, 2, . .., p 3 ), or f j ( j = 1, 2, . .., r ) in the model.We consider the Lasso-like hierarchical shrinkage approach with re-parameterization.Assume α i , γ i , and ξ t have diagonal variance-covariance matrices, ), respectively.To have a shrinkage effect, we should allow the variance parameters ω 2 to have a positive probability to take the value zero.Therefore, we re-parameterize α i , ξ t , and γ i as , ω ξ = (ω ξ 1 , . ..,ω ξ p 3 ) , and ω γ = (ω γ 1 , . ..,ω γ r ) are column vectors.After reparameterization, the variances ω 2 appear in the model as coefficients ω that can take values on the entire real line, and the new variance-covariance matrices become identity matrices.Now we assign Lasso priors to each ω α , ω ξ , and ω γ j to shrink varying parameters grouped by unit or time.Together with the shrinkage on β, the algorithm will decide de facto whether a certain covariate is included, whether its coefficient varies by time or across units, and how many latent factors are considered.Because the shrinkage priors do not have a point mass component at zero, parameters of less important covariates are not zeroed out completely.Instead, they stay in the model but with shrunk impacts and can be regarded as virtually excluded from the model.The posterior distribution of ω may be of different shapes.If it is clearly bimodal, it means that the associated parameter is included in the model; if it is close to unimodal and centered at zero, it means that the parameter is virtually excluded from the model; if, however, the posterior distribution of ω has three or more modes, it indicates that the data do not provide decisive information on whether the corresponding covariate or factor is sufficiently importantin some iterations, the parameter escapes the shrinkage while in others, it is trapped in a narrow neighborhood around zero.In each MCMC iteration, the algorithm samples a model consisting of the parameters that successfully escape the shrinkage, and posterior distributions of parameters generated by the stochastic search algorithm are based on a mixture of models in a continuous model space.In other words, this variable selection process is also a model-searching and modelaveraging process.5The DF-LFM has many parameters, but most of them, listed in Table 1(b), are included as part of Bayesian parameter expansion for computational convenience or as hyper-parameters to adjust for parameter uncertainties.They do not appear in the likelihood or can be integrated out of the likelihood given the effective parameters.The effective parameters, including β and the variance parameters, are reported in Table 1(a).Their number is usually much smaller than the number of observations.

Implementing a DM-LFM
We develop an MCMC algorithm to estimate a DM-LFM.The core functions of the algorithm is written in C++.Due to space limitations, we present the details of choices of priors and the iterative steps of MCMC updating in Section A.2 in online Supplementary Material.Broadly speaking, implementing a DM-LFM takes the following three steps: Step 1. Model searching and parameter estimation.We specify and estimate the DM-FLM model with Bayesian shrinkage to sample G draws (excluding draws in the burn-in stage) of the parameters from their posterior distributions, θ (g ) i t ∼ π(θ i t |D), where D = {(X i t , y i t (c) obs ) : i t ∈ S 0 } is the set of untreated observations.Because of Bayesian shrinkage, π(θ i t |D) is in effect a mixture of distributions.
Step 2. Prediction and integration.We conduct Bayesian prediction by generating draws of counterfactual y i t (c) mi s for each treated unit at a i t T from its posterior predictive distribution: Bayesian prediction is an empirical integration: a sample of the predicted counterfactual is generated by plugging each draw θ ) without any unknown quantities.
Step 3. Inference and diagnostics.We make inference about the causal effect δ i t at a i t T for each treated unit i, by summarizing the empirical posterior distribution δ i t formed by δ (g ) To summarize the results, we can obtain its posterior mean, variance, and the Bayesian 95% credibility interval.We can make inferences about other estimands, such as the ATT, by pooling the posterior draws of δ i t and summarizing their posterior distributions accordingly.We conduct Bayesian diagnostic tests on the convergence and mixing on main parameters' posterior distributions and find that the MCMC algorithm converges fast and mixes well in our simulation and empirical studies.

Simulation Studies
In this section, we first illustrate how the Bayesian DM-LFM works using a simulated example.We then study its properties by varying sample sizes and model and compare its relative performance against existing methods, including SCM and Gsynth, in the case of a single treated unit.We report more findings from Monte Carlo exercises in Supplementary Material.

A Simulated Example
We simulate a panel dataset of 50 units and 30 time periods based on the following DGP: in which w i t is the treatment indicator and δ i t is the treatment effect.X i t is a vector of 10 covariates including an intercept and nine time-varying variables, but only the intercept and the first three covariates have nonzero, unit-and time-varying coefficients.We re-parameterize Equation ( 9) as ∼ N (0, 1).This means the expected value of the treatment effect gradually increases as the treatment duration grows, for example, from 1 in Period 21 to 10 in Period 30.The factor vector f t is two-dimensional and both factors follow an AR(1) process.The probability of getting treated is positively correlated with the sum of a unit's factor loadings γi , which are also i.i.d.N (0, 1).The selection on the factor loadings will cause biases in the causal estimates if a model does not account for the factor term or the covariates.We provide the details of the DGP in Supplementary Material.
Figure 2 shows the estimated ATT (posterior means) with their 95% credibility intervals using a Bayesian DiD model (a) and a DM-LFM model (b).The DiD model assumes ω α = ω ξ = ω γ = 0; in other words, the coefficients for the covariates are assumed to be constant, and no factors are included in the model.Figure 2(a) shows that with the DiD estimator, multiple estimates in the pre-treatment periods are away from zero and significant biases exist for the ATT estimates in the post-treatment periods.On the contrary, the DM-LFM performs significantly better: we do not observe any pre-trend and the ATT estimates are close to the true values, which are covered by the corresponding 95% credibility intervals.show the invariant and time-varying components of the covariate coefficients, respectively.While β and ξ t for the intercept and the first three covariates are clearly nonzero, the coefficients for the other six covariates are close to zero, which is consistent with the DGP.The algorithm also correctly selects the non-zero α i , the unit-varying components of coefficients (reported in Supplementary Material).Figure 3c shows the posterior distributions of ω γ , which measures the relative importance of each of the 10 factors subject to selection.It shows that two factors (Factors 1 and 2) have a ω with clear bimodal posteriors, and the others all have spike-shaped unimodal ones.This means that the model correctly identifies the number of factors to be two.
This simulated example demonstrates that the DM-LFM performs well even when the sample size is relatively small and when researchers have limited knowledge about which covariates to put in, whether the covariates' relationships with the outcome change over time or across units, or how many latent factors to include in the model.

Additional Monte Carlo Evidence
In addition, we conduct several sets of Monte Carlo exercises to study the properties of the proposed method and compare its relative performance against existing methods.Due to space limitations, we provide the details of these exercises in Supplementary Material and only briefly summarize two exercises and the major findings below.
In the first exercise, we study the role of each of the main components of a DM-LFM in estimation and investigate how the sample size affects the model performance.We simulate samples using  (2) models that include 10 factors but no covariates; (3) models that include 10 factors and covariates with fixed coefficients; and (4) models that include 10 factors and covariates with varying coefficients.
the DGP as in Equation ( 9) while varying the sample size (both the total number of units N and the number of pre-treatment periods T 0 ).We estimate and compare the full DM-LFM model with its three simpler variants: a model with covariates but without factors, analogous to a DiD model including covariates with fixed coefficients; a model without covariates but with 10 latent factors, analogous to Gsynth without time-varying covariates; and a model with factors and covariates with fixed coefficients.Figure 4 shows the comparison when the number of units is relatively small (N = 40), and the full results are reported in Supplementary Material.In general, we find that DM-LFM outperforms the other three models in terms of bias, standard deviation, root mean squared errors (RMSE), and coverage.This exercise demonstrates that each of the key components of the model contributes to improving performance in causal effect estimation.The factor term seems to have the most impact, but covariates with varying coefficients also notably improve precision and coverage.
The second exercise compares the performance of the DM-LFM with SCM and Gsynth in the case of a single treated unit.Tables A5-A7 in Supplementary Material show that, compared with the SCM, the DM-LFM has a much smaller RMSE.The DM-LFM outperforms Gsynth in the realistic scenario when the true number of factors is unknown, and when the number of factors is large and each of them produces relatively weak signals.Note that our Bayesian approach becomes significantly more computationally demanding as the sample size grows.For example, in one simulation in which N = 50 and T 0 = 60, it takes about 30 seconds to run a DM-LFM on a 2019 6-core MacBook Pro while Gsynth takes less than a second.

Empirical Applications
We apply the Bayesian DM-LFM to the two running examples introduced earlier.To gain confidence that the DM-LFM is appropriate for an application, we recommend users conduct the following diagnostic tests after running the model: (1) conduct Bayesian diagnostic tests on convergence and mixing of the MCMC output of key parameters, for example, by plotting of the traces of estimates; (2) examine whether the model fits the pre-treatment outcome trajectories of the treated units reasonably well; and (3) conduct a placebo test using pre-treatment data of the treated units when there is a sufficient number of pre-treatment periods for the treated units.

Economic Impact of German Reunification
First, we build a DM-LFM incorporating all pre-treatment time-invariant covariates considered in ADH ( 2015), including pre-treatment averages of trade openness, inflation rate, industry share, schooling, and investment rate.The initial model we consider is in which X i represents the time-invariant covariates.We do not include unit fixed effects or unitvarying coefficients to be consistent with the SCM, but time-varying coefficients are included.Figure A3 in Supplementary Material shows that the intercept has a strong time trend, but all the covariate coefficients are almost constant over time.Our result suggests four to six factors, with their ω's clearly having bimodal posteriors while several other factors exhibit mixed posteriors (Figure A4 in Supplementary Material).
We then produce an empirical posterior distribution of GDP per capita for counterfactual West Germany had German reunification not happened.To check the goodness-of-fit, we also calculate the model prediction of its GDP per capita in pre-treatment years.In Figure 5, we compare the counterfactual predictions of the SCM (a) with that of the DM-LFM (b), in which we shade the 95% Bayesian credibility intervals in gray.The dashed vertical line indicates the year 1989, 1 year before the adoption time.The two methods yield similar results: the GDP per capita of the counterfactual West Germany is higher than that of the actual West Germany during most of the post-reunification period except for the first few years after reunification.
Finally, we draw inferences about the treatment effects.Figure 6(a) and Figure 6(b) report the estimated effects of reunification on West Germany using the SCM and Bayesian DM-LFM, respectively.The corresponding 95% credibility intervals are added in (b).To lend further credibility to our causal estimates, we conduct a placebo test by setting 1987-1989, 3 years before reunification, as the placebo period.Figure 6(c) shows that the estimated effects at each time point during the placebo period are close to 0, buttressing our confidence in the identification assumptions.

Election Day Registration and Voter Turnout
For this example, we specify a full DM-LFM model including the same time-varying covariates used in Xu (2017) (universal mail-in registration and motor voter registration) as well as 10 factors.Because there are only two covariates, we do not impose shrinkage on their β, but assign  shrinkage priors to α i , ξ t , and γ i .Our result suggests that at least six factors affect outcome prediction (Figure A9 in Supplementary Material).In contrast, Gsynth only includes two factors using a leave-one-out cross-validation procedure.As for α i and ξ t , the intercept varies in both time and space dimensions, but the varying parts of the slopes of the covariates are virtually shrunk to zero.We estimate the parameters using MCMC.Consistent with Xu (2017), we find that the two covariates do not explain much of the variation in turnout.
We then generate the posterior distributions of counterfactual outcomes for the nine treated states in their post-treatment years, based on which we estimate the effect of EDR on voter turnout.In Figure 7, we report the ATT for the same duration of adoption.To do so, we pool the posterior draws of the individual treatment effects of all treated states in p t h year after adoption for p = 1, 2, . .., 6.Using the posterior distributions of δp , we obtain their posterior means and Bayesian 95% credibility intervals.
Comparing the point and uncertainty estimates up to the sixth post-adoption presidential elections from Gsynth and the DM-LFM, the most notable difference between them is that the Bayesian 95% credibility intervals are considerably narrower than the 95% confidence intervals from Gsynth.We suspect that this is because our Bayesian approach has better predictive performance of individual counterfactuals than Gsynth as evidenced in Figure A11 in Supplementary Material, where we report the individual treatment effects on six treated states that have at least three post-treatment measures of the outcome using both Gsynth and the DM-LFM-our new method fits the trajectory of each treated unit in the pre-treatment period noticeably better than Gsynth.

Discussion
When is the DM-LFM applicable?And when is it more advantageous than existing methods?Table 2 summarizes its features in comparison to those of DiD, SCM, and Gsynth.The most important differences among the methods, we acknowledge, is that DiD and SCM adopt a clear design-based perspective and rely on more transparent identification assumptions-these assumptions are not necessarily weak, but they are widely understood and accepted by researchers.Moreover, the weights they impose on control units-uniform weights in DiD designs and non-negative weights with the SCM-are directly interpretable.Gsynth (a frequentist LFM) and Bayesian DM-LFM, on the other hand, use a model-based approach.Together with the SCM, they address potential failures of the "parallel trends" assumption by assuming a linear factor model.Unlike the SCM, they can easily accommodate comparative case studies with multiple treated units.On modeling choices, DiD, Gsynth, and the DM-LFM allow intercept shift by assuming unit fixed effects, while the SCM does not (Doudchenko and Imbens 2017).The SCM can accept only time-invariant covariates while DiD and Gsynth can accept only time-varying ones.The DM-LFM, however, can accommodate both types of covariates and allow their coefficients to vary by unit and time.In terms of model selection, the SCM uses held-out pre-treatment periods to tweak the weighting matrix; Gsynth uses a cross-validation scheme to select the number of factors; and the DM-LFM conducts model selection scholastically in a larger model space and averages model predictions simultaneously.
All in all, the Bayesian DM-LFM is especially well suited for comparative case study, particularly when researchers suspect the conventional "parallel trends" assumption is unlikely to hold; when there are multiple treated units; when researchers would like to have easily interpretable uncertainty estimates on average or individual treatment effects; when many pre-treatment covariates are available and their relationships with the outcome are complex; or when timevarying confounders are complex and/or subtle enough that they need a relatively large number of factors to represent or some of the factors are relatively weak.The biggest disadvantage of the Bayesian approach is that it is computationally more expensive than frequentist methods such as Gsynth when the sample size is large.We also find that the frequentist properties of our method are unsatisfactory when there are too few control units or the number of pre-treatment periods is too small, for example, T 0 < 20 (see Table A4 in Supplementary Material).
Because of the strengths and weaknesses of different methods, we recommend researchers use multiple methods at the same time whenever possible to triangulate their findings.Future research should consider extending the method beyond the setting of staggered adoption, jointly modeling the treatment assignment mechanism and the response surface, and addressing potential SUTVA violations, such as policy diffusion and spillover effects.

Figure 1 .
Figure1.A graphic representation of dynamic multilevel latent factor model (DM-LFM).The shaded nodes represent observed data, including untreated outcomes and covariates; the unshaded nodes represent "missing" data (treated counterfactuals) and parameters.Only one (treated) unit i is shown.T 0i = a i − 1 is the last period before the treatment starts to affect unit i.The focus of the graph is Period t.Covariates in periods other than t, as well as relationships between parameters and y i 1 (c), y iT 0i (c) , and y iT (c), are omitted for simplicity. https://doi.org/10.1017/pan.2021.

Figure 2 .
Figure 2.Estimated average treatment effect on the treated (ATT): difference-in-differences (DiD) versus dynamic multilevel latent factor model (DM-LFM).The above figures show the ATT estimates and their 95% credibility intervals from the DiD and DM-LFM estimators, both implemented with Bayesian Markov Chain Monte Carlo (MCMC) algorithms.The red dashed lines represent the true ATT of the five treated units.

Figure 3 .
Figure 3. Posterior distributions of coefficients.(a) and (b) show the posterior mean and 95% credibility intervals of the invariant component and time-varying component of β i t , respectively.(c) shows the posterior distribution of each ω γ , which captures the extent to which a factor influences the outcome.

Figure 3
Figure3(a) and Figure3(b) show the invariant and time-varying components of the covariate coefficients, respectively.While β and ξ t for the intercept and the first three covariates are clearly nonzero, the coefficients for the other six covariates are close to zero, which is consistent with the DGP.The algorithm also correctly selects the non-zero α i , the unit-varying components of coefficients (reported in Supplementary Material).Figure3cshows the posterior distributions of ω γ , which measures the relative importance of each of the 10 factors subject to selection.It shows that two factors (Factors 1 and 2) have a ω with clear bimodal posteriors, and the others all have spike-shaped unimodal ones.This means that the model correctly identifies the number of factors to be two.This simulated example demonstrates that the DM-LFM performs well even when the sample size is relatively small and when researchers have limited knowledge about which covariates to put in, whether the covariates' relationships with the outcome change over time or across units, or how many latent factors to include in the model.

Figure 4 .
Figure 4. Comparison of model performance: root mean square errors (RMSE) and coverage.The above figures show the RMSE (a) and the coverage rate of 95% credibility intervals (b) of the average treatment effect on the treated (ATT) estimates using three sets of models: (1) models that do not include factors or covariates;(2) models that include 10 factors but no covariates; (3) models that include 10 factors and covariates with fixed coefficients; and (4) models that include 10 factors and covariates with varying coefficients.

Figure 5 .
Figure 5. Actual and estimated counterfactuals for West Germany.This figure shows the per capita gross domestic product (GDP) of actual West Germany and the posterior means (with 95% credibility intervals) of its untreated outcome from 1960 to 2003.The within-sample prediction is very precise and the interval is too narrow to be seen in the figure between 1960 and 1989.

Figure 6 .
Figure 6.Estimated effect of reunification on West Germany.This figure shows the estimated treatment effect of reunification on West Germany's per capita gross domestic product (GDP) using the synthetic control method (SCM) (a) and dynamic multilevel latent factor model (DM-LFM) (b), as well as the result from a placebo test using DM-LFM in which the 1987-1989 period (before reunification) is taken as "treated" (c).

Figure 7 .
Figure 7.The effect of election day registration (EDR) on voter turnout.This figure shows the estimated average treatment effect of EDR on voter turnout in the United States using Gsynth (Xu 2017) (a) and dynamic multilevel latent factor model (DM-LFM) (b), respectively.On the x-axis, the positive integers indicate the duration of treatment while the pre-treatment years are labeled as nonpositive integers.Period 1 is the first presidential election year in which a state implements EDR.Because the treated states adopted EDR at different points in time, the number of treated units decreases as p increases.

Table 1 .
Total number of parameters.The variance parameters for ν, e, f t do not appear in the table because we assume they have standard normal priors.
that αi , ξt , and γi all have univariances.Seven units receive the treatment starting from Period 21 and remain treated till Period 30.The remaining 23 units are never treated.The heterogeneous treatment effects are governed by δ i t,t >20 = t − 20 + τ i t , in which τ i t i .i.d .

Table 2 .
Comparing TSCS methods for comparative case studies.