EconBase
← Back to paper

Synthetic learner: model-free inference on treatments over time

The exact contents of citations.db main_text.text for this paper — one flattened LaTeX string, title through conclusion, appendix excluded, unmodified except for removing email addresses. This is what our citation measures are computed over.

98,243 characters

Synthetic learner: Model-Free Inference on Treatments over Time



\if00
{
  \title{\bf Synthetic learner:
  Model-Free Inference on Treatments over Time\footnote{Draft version July, 2022. First version: June, 2019.  We thank the Editor, anonymous referees, and Graham Elliott,  Kaspar W\"{u}thrich, and Yinchu Zhu for helpful comments. }}
 \author{Davide Viviano$^1$\footnote{
 Present address: Stanford Graduate School of Business, 655 Knight Way, Stanford, CA 94305. Email: [email removed]. This work was mostly conducted while at the Department of Economics, University of California at San Diego, La Jolla, CA, 92093. }
   $\qquad$
    Jelena Bradic$^2$ \footnote{Department of  Mathematics and Halicio\u{g}lu Data Science Institute,
        University of California at San Diego, La Jolla, CA, 92093. Email: [email removed].} \footnote{Jelena Bradic gratefully acknowledges the support of the grant NSF-DMS \#1712481. } \\
 \textcolor{white}{a} Stanford GSB$^1$ $\qquad$   UC San Diego$^{1,2}$
}
    \date{}
  \maketitle
} \fi

\if10
{
  \bigskip
  \bigskip
  \bigskip
  \
 \\

 \
 \\


  \begin{center}
    {\LARGE\bf Synthetic Learner:
  Model-free Inference on Treatments over Time}
\end{center}
  \medskip
} \fi


\bigskip

\begin{abstract}


Understanding the effect of a particular treatment or a policy pertains to many areas of interest, ranging from political economics, marketing to healthcare.  In this paper, we develop a non-parametric algorithm for detecting the effects of treatment over time in the context of Synthetic Controls.
The method builds on counterfactual predictions from many algorithms without necessarily assuming that the algorithms correctly capture the model.
We introduce an inferential procedure for detecting treatment effects and show that the testing procedure is asymptotically valid for stationary, beta mixing processes without imposing any restriction on the set of base algorithms under consideration. We discuss consistency guarantees for average treatment effect estimates and derive regret bounds for the proposed methodology. The class of algorithms may include Random Forest, Lasso, or any
other machine-learning estimator. Numerical studies and an application illustrate the advantages of the method.






\end{abstract}

\noindent
{\it Keywords:} Synthetic Control, Difference In Differences, Causal Inference, Random Forests. \\
{\it JEL Code:} C10, C14, C20, C30.

\vfill

\spacingset{1.5}

  	\section{Introduction} \label{sec:intro}

This paper discusses estimation and inference on the effect of a policy intervention on a single unit observed over multiple periods and exposed to treatment from one point in time onwards. We consider an aggregate time-series set-up where researchers observe the outcome of the unit of interest $T_0$ periods before treatment and $T - T_0$ after the treatment. Researchers' main goal is to conduct inference on the effect of a trajectory of treatment effects over the post-treatment period.
Namely, by denoting $\tau_t = Y_{0t}^1 - Y_{0t}^0$ the difference between the two potential outcomes at time $t$, researchers want to test whether $\{\tau_t\}_{t > T_0} = \tau^o$, for some null trajectory of interest $\tau^o$. Their second goal is to precisely estimate the average effect over time.


In the same spirit of synthetic controls \citep{abadie2003economic, abadie2010synthetic}, and aggregate panel data models \citep{hsiao2012panel}, we construct counterfactuals using information from $n$ (possibly finitely many) control units and covariates observed over $T$ periods. We exploit information over the time series for conducting asymptotic inference. The applications of interest are those where we observe individuals at a relatively frequent level, e.g., quarterly or monthly, over multiple years. Examples are studying the effects of taxation \citep{bai2014property}, changes in welfare programs \citep{maclean2019losing}  or (geo-localized) marketing experiments \citep{brodersen2015inferring,varian2016causal}.  We discuss additional applications at the end of Section \ref{sec:lit}.


The first contribution of this paper is to derive an inferential procedure that is valid for general parametric and non-parametric (machine-learning) estimators.
We propose a resampling mechanism to guarantee exact asymptotic size control without imposing restrictions on the set of estimators. The key idea for inference is to combine the sample splitting procedure with the block-bootstrap \citep{politis1992circular} and exploit the differentiability properties of the proposed procedure. Our approach does not require correct model specifications.



As a second contribution, we introduce an ensemble procedure that combines many such estimators, e.g., Synthetic controls, factor models estimators, and fully non-parametric estimators such as Random Forest or Kernel Smoothing, into a single prediction. We penalize the methods with the worst out-of-sample performance over the pre-treatment period.
The method's goal is to increase precision. Also, it permits replacing heuristic model selection criteria whose properties are unknown with time-dependent observations with a theoretically grounded procedure. This has important implications for applied economists, who often face the difficult model selection choice from a dictionary that includes many methods  (e.g., factor models, synthetic control, difference-in-differences).\footnote{See also the discussion in \cite{athey2019ensemble}.} The ensemble method that we propose builds on the literature on exponential aggregation \citep{rigollet2012sparse, cesa2006prediction}, time-series and forecasts' combinations \citep{timmermann2006forecast, elliott2004optimal}, which we study here for causal inference.
We show that the procedure consistently recovers the average treatment effect through a bias adjustment, and it inherits strong oracle properties for its prediction performance.


Throughout the text, we assume exogeneity of the treatment time and stationarity for inference.
These conditions are common when conducting inference with Synthetic Controls in the presence of a long time series\footnote{For inference via Synthetic Control \cite{chernozhukov2018exact} impose stationarity of the residuals under correct model specification and similar stationarity assumptions as to the one discussed above under misspecification to show the validity of permutation tests.
Stationarity, strong mixing conditions on the joint distribution of the residual errors and covariates, are also imposed for valid inference in synthetic control settings in \cite{carvalho2018arco}, while covariance stationarity conditions are imposed in \cite{li2017estimation}. Further discussion is in Section \ref{sec:meth}. }, since they permit to conduct inference without relying on symmetry assumptions of placebo testing \citep{firpo2018synthetic, ben2018augmented}. They imply that a pre-post treatment comparison of the means returns a consistent (but possibly inefficient) estimate of the average effect on the treated.
In separate sections, we relax stationarity in two directions:
(i) allowing for time-varying fixed effects, encompassing popular two-way fixed-effect models; (ii) deriving prediction guarantees for arbitrary non-stationary settings.\footnote{These are in Section \ref{sec:time_fixed} and  Section \ref{sec:weights} respectively.}





















 We conclude our discussion with a simulation study and an empirical application. We show that our procedure leads to larger power than existing methods while controlling the size of the test. In an application, we study the effect of Tennessee's health-insurance dis-enrollment program on health-related outcomes. Using survey data from Behavioral Risk Factor Surveillance System Data, we show that the program decreased health insurance coverage and the likelihood of visiting a doctor.


The paper is organized as follows. In Section \ref{sec:meth} we introduce the set-up, and identification strategy. In Section \ref{sec:inference}, we introduce the method for estimating counterfactuals and inference on sharp nulls. In Section \ref{sec:average}, we discuss estimation of the average effect on the treated. In Section \ref{sec:weights} we discuss prediction guarantees under non-stationarity. Section \ref{sec:experiments} discusses numerical experiments. Section \ref{sec:real} discusses  applications in health economics. Finally, in Section \ref{sec:carryover} we provide extensions in the presence of carry-over effects.





\subsection{Related Work} \label{sec:lit}


While non-parametric estimators have found widespread use in microeconomic applications \citep{athey2019machine}, their analysis (and consequently their applicability) in the presence of aggregate data has received much less attention. However, with aggregate data, such estimators can improve precision and better disentangle the effect of the policy from idiosyncratic shocks.
This paper proposes a method that enables counterfactual prediction and hypothesis testing in the context of Synthetic Controls (SC) using predictions arising from many parametric and non-parametric estimators.





 Recent literature has proposed a wide variety of methods for predicting counterfactuals in the setting under consideration, including factor and panel data models \citep{bai2009panel, hsiao2012panel}, synthetic controls \citep{abadie2010synthetic, xu2017generalized,doudchenko2016balancing, arkhangelsky2019synthetic, ferman2016revisiting}, two-ways fixed effects models \citep{imai2021use}, ridge regression methods \citep{ben2018augmented}, kernel balancing  \citep{hazlett2018trajectory}, functional methods \citep{gunsilius2020distributional} among others.
Additional references include
\cite{athey2018matrix}  who proposes a matrix completion methods for SC;  \cite{athey2019ensemble} shows in a simulation exercise that ensemble methods outperform individual SC predictions on many economic data sets;
\cite{amjad2018robust} proposes singular value thresholding,  whereas matching has been discussed by \cite{imai2018matching}.  Difference-in-difference methods were recently discussed in \cite{athey2018design} and \cite{arkhangelsky2019synthetic} in the context of staggered adoption.

 However, selection among these methods remains an open research question \citep{hsiao2018panel}. Combining different predictions offers a simple data-adaptive procedure to exploit information from all these models while improving the prediction performance \citep{timmermann2006forecast}. As a result,
 our contribution can be viewed as complementary to this literature. To the best of our knowledge, we provide the first set of conditions under which predictions made by any or many machine learning methods, including Random Forests, can be used to develop valid tests for SC.



 A closely related method to our inference procedure is the permutation-based inference method, discussed in \cite{chernozhukov2017exact}. Their method accommodates a single (linear) model specification only and imposes stability conditions of the estimator. Also, while the permutation-based methods estimate counterfactuals using the entire sample (pre and post-treatment periods) as a training set, imposing the sharp null hypothesis of no treatment effects, here we estimate counterfactuals using the pre-treatment period only. This approach permits that estimation of the counterfactual does not depend on the outcomes observed over the post-treatment period. Our approach is particularly suited whenever the post-treatment period is proportional to the pre-treatment period as in the context of our empirical application.\footnote{In our empirical application, the post-treatment period is approximately twenty, and the pre-treatment period is approximately sixty. The reader may refer to Example \ref{exmp:mean} for an illustration of the benefits.}








Our paper relates more broadly to inference using penalized methods, including \cite{chernozhukov2018t} and \cite{carvalho2018arco}, which propose penalized linear regressors for asymptotic inference on treatment effects in an SC setup. However, \cite{carvalho2018arco} requires a consistent estimation of treatment effects, which is not required in our setting and focuses on a penalized model only. Differently,  \cite{chernozhukov2018t} proposes a bias-adjustment procedure for asymptotic inference, which in our framework is not required for hypothesis testing but used for average treatment effect on the treated (ATT) estimation. Our resampling mechanism allows for more generality than the tests in \cite{chernozhukov2018t} since we do not require the use of penalized linear regressor and the related conditions for estimation of counterfactuals, but we allow for general non-parametric estimators. Related literature also includes \cite{li2017estimation}, and \cite{hsiao2012panel}, which discuss properties of constrained least-squares methods under stationarity and correct model specification only. \cite{li2019statistical} discusses a sub-sampling procedure for inference with constrained least-squares estimators only.







Finally, we relate to
\cite{kunzel2017meta} who discuss model averaging with $i.i.d.$ data and classifies method into three classes, denoted as S, T, and X learners. This paper pioneers the idea of T-learning in Synthetic control setting, offering an alternative and simple weighting scheme which is inspired by the literature on boosting \citep{schapire2012boosting} and online learning \citep{cesa1997use, cesa1999prediction, cesa2006prediction}.



To conclude, we can list several applications of interest. The first set of relevant applications includes changes in policy at a regional or state level. For instance, studying the effects of (i) exogenous variations such as environmental disasters on policy-changes \citep{potrafke2020green}, or economic outcomes \citep{cavallo2013catastrophic}; (ii) of Medicaid expenditure expansions or contractions \citep{tello2016effects}; (iii) of tax-reform on prices \citep{bai2014property}; or (iv) of policy reforms on economic growth \citep{billmeier2013assessing}. The second avenue of interesting applications includes experiments on online platforms, for which synthetic controls are becoming increasingly popular, especially in the presence of geo-localized experiments \citep{varian2016causal, li2017estimating}. The third set of applications includes studying the effect of new algorithms or financial instruments \citep{xie2014impact, bojinov2019time}.









\section{Setup and Identification} \label{sec:meth}

Throughout this article for each unit $i$ we observe outcome variable $Y_{it}$. We denote with $Y_{0t}$ the unit treated if $D_t  = 1$ and under control otherwise;    the remaining $i=1,\cdots, n$ units, $Y_{1t}, \dots, Y_{nt}$  are units always observed in the control state. Additional covariate information for each unit are denoted in compact form as $Z_{it}$.  $Z_{it}$ may also contain past covariates and past outcomes.






\subsection{Estimands and Null Hypothesis}





Following the literature on panel data and synthetic control models  \citep[e.g.,][]{hsiao2018panel, abadie2010synthetic},
we define the treatment assignment and the outcome of interest, respectively as
\begin{equation}
D_t = 1\{t > T_0\}, \quad Y_{0t} = D_t Y_{0t}^1 + (1 - D_t) Y_{0t}^0,  \quad Y_{jt} = Y_{jt}^0, \quad j > 0
\end{equation}
where $Y_{0t}^1, Y_{0t}^0$ denote the potential outcomes under treatment and control for the unit of interest $i = 0$, and $Y_{jt}^0$ denotes the potential outcome under control of unit $j$. Our definition of potential outcomes implicitely imposes that SUTVA holds \citep{rubin1990formal} and no carry-over effects \citep{imai2013estimating}. Extensions in the presence of carry-overs are discussed in Section \ref{sec:carryover} .





 In applications, researchers may want to test whether the difference between two potential outcomes $Y_{0t}^1 - Y_{0t}^0$ equals zero for all post-treatment periods.  Namely, they may be interested in conducting inference on the time-specific treatment effects defined below.

 \begin{defn}[Time-specific treatment effect] The time-specific treatment effect is defined as follows: $\tau_t = Y_{0t}^1 - Y_{0t}^0$.
 \end{defn}

Here, $\tau_t$ defines the difference in potential outcomes at time $t$.
We begin our discussion by introducing the null hypothesis of interest.

 \begin{defn}[Sharp Null hypothesis] \label{defn:sharp} Define the sharp null hypothesis as
\begin{equation} \label{eqn:null}
 H_0:  \tau_t = \alpha_t^o, \quad  t \in \{T_0 + 1, \cdots, T\},
 \end{equation}
 for a known sequence $\{\alpha_t^o\}_{t > T_0}$.
 \end{defn}

 Equation \eqref{eqn:null} imposes that the potential outcome over the post-treatment period equals the potential outcome under control plus a known (possibly time-varying) constant.
 For example, we may consider $a_t^o = 0$ or we may consider also testing a linear trend of the form  $a_t^o = \delta (t - T_0)$  for an arbitrary $\delta \in \mathbb{R}$.
Our results also extend when we test the average of $\tau_t$.\footnote{Namely, we may also test $\mathbb{E}[\tau_t] = \alpha_t^o$, hence allowing potential outcomes under treatment and control having different idiosyncratic shocks. This is omitted for the sake of brevity only and discussed in the Appendix (Algorithm \ref{alg:alg4}) and Remark \ref{rem:average_null}.} Finally, note that more generally, we can incorporate a more general class of hypothesis
$H_0: Y_{0t}^1   = f(Y_{0t}^0,a_{t}^o), \  a_t^o \in \mathbb{R}, \  t > T_0,
$  for a function $f$ being invertible in its first argument, omitted for the sake of brevity.  We define
$$
Y_{0t}^o =
\begin{cases}
& Y_{0t} - \alpha_t^o \quad  t > T_0, \\
& Y_{0t}  \quad t \le T_0.
\end{cases}
$$
the (observed) potential outcome under control under the null hypothesis $H_0$.







Testing for treatment effects may not be satisfactory to researchers, who may also be interested in reporting estimates of average treatment effects.
This is defined below.


\begin{defn}[Average Treatment Effect on the Treated] \label{defn:estimand} The average treatment effect on the treated is defined as
\begin{equation}
\tau =  \frac{1}{T - T_0} \sum_{t > T_0} \mathbb{E}\Big[Y_{0t}^1 - Y_{0t}^0\Big].
\end{equation}
\end{defn}
Here, $\tau$ denotes the average effect on the treated, averaged also over the post-treatment period. The expectation is taken over the idiosyncratic shocks.\footnote{Note that whenever $\tau_t$ is non-random $\tau = \frac{1}{T - T_0} \sum_{t > T_0} \tau_t$.}




\subsection{Identification Conditions}




The first condition that we impose is stationarity. This is common in the literature on Synthetic Control, see  \cite{carvalho2018arco, li2017estimation, chernozhukov2018exact}.\footnote{Stationarity and beta-mixing conditions as stated above cover a large class of {\sc arma} processes \citep{pham1985some}, {\sc {\sc ar-arch}} processes \citep{lange2011estimation}, Markov Switching Processes \citep[see for example][]{lee2005probabilistic}, {\sc garch} \citep{carrasco2002mixing}, to cite some. }   We relax it in Section \ref{sec:weights}, where we allow for non-stationary observations.

\begin{ass}[Stationarity] \label{ass:stationarity}  Suppose that $(Y_{0t}^0, Y_{1n}, \cdots, Y_{nt}, Z_{0t}, \cdots, Z_{nt}) \sim \mathcal{D}_0$ is stationary.
\end{ass}


Assumption \ref{ass:stationarity} imposes stationarity. In Section \ref{sec:time_fixed} we show how our results for inference extend under non-stationarity, in the presence of an (unknown) time-varying fixed-effects.




The second condition we impose is an identification assumption.


\begin{ass}[Identification Condition] \label{ass:ident} Suppose that $T_0 \perp (Y_{0t}^0, Y_{0t}^1, Y_{1:n,t}, Z_{0:n,t})_{t=1}^T$.
\end{ass}


Assumption \ref{ass:ident} states that the timing of the treatment is exogenous. The same conditions can be found in previous literature on Synthetic Controls.
For instance, recent literature on Synthetic Control \citep{abadie2010synthetic, chernozhukov2018double, arkhangelsky2019synthetic, chernozhukov2018t, li2017estimation} treated $T_0$ as deterministic, in which case exogeneity of $T_0$ implicitely holds. See for example, the discussion in \cite{ferman2016revisiting} and \cite{bottmer2021design}. \cite{carvalho2018arco} also explicitely imposes exogeneity similarly to the above condition.



In the context of our empirical application, where the treatment consists of a dis-enrollment from Medicaid occurring in the early 2000s in Tennessee, and the outcomes are health-related outcomes, as argued in \cite{argys2017losing}, if the policy can be attributed to budget deficit interpretable as an exogenous variation, the assumption directly holds. We warn the reader, however, that failure of the assumption may invalidate the inferential strategy.

 Motivated by Assumption \ref{ass:ident} we will implicitely condition on $T_0$ throughout the rest of our discussion unless otherwise specified, since, conditional on $T_0$ the distribution of observables and unobserved potential outcomes remains invariant. We return instead to non-stationary conditions in Section \ref{sec:weights} where we relax Assumption \ref{ass:stationarity} and \ref{ass:ident}.





\begin{exmp}[Stationary factor models]
Suppose that
\begin{equation} \label{eqn:factor}
Y_{jt}^0 = \mu_j + \theta_t + \lambda_j F_t + \gamma(Z_{jt}) + u_{j,t}, \quad j \in \{0, \cdots, n\},
\end{equation}
with $u_{j,t}$ denoting stationary idiosyncratic errors. Let $\theta_t \sim \mathcal{N}(0,1)$ and exogenous, with, $F_t$ denoting common stationary unobserved exogenous factors and $\lambda_j$ the (exogenous) individual specific effect, and $\gamma(Z_{jt})$ a stationary components which depends on covariates. Then Assumption \ref{ass:stationarity} holds. \qed
\end{exmp}




\subsection{Testable Implications and Identification of Average Effects}


We conclude this discussion with two lemmas. The first lemma provides a testable implication for the sharp null hypothesis in Definition \ref{defn:sharp}. This is stated below.


\begin{lem}[Sharp Null: Testable Implication] \label{lem:identi2} Under the null hypothesis in Equation \eqref{eqn:null} and Assumptions \ref{ass:stationarity}, \ref{ass:ident}, then $(Y_{0t}^o, Y_{1t}, \cdots, Y_{nt}, Z_{0t}, \cdots, Z_{nt} )$ is stationarity and independent of $T_0$ for all $t \in \{1, \cdots, T_0, \cdots, T\}$.
\end{lem}


              The above condition implies that the distribution before and after the intervention period $T_0$ must remain invariant under the null hypothesis. This assumption is testable since we observe the empirical distribution of the above vector before and after the intervention time $T_0$. Lemma \ref{lem:identi2} is at the basis of our approach for testing the null hypothesis, which we discuss in Section \ref{sec:inference}.



 The second goal is to estimate the average effect. Identification of $\tau$ is discussed in the following lemma.

\begin{lem}[Identification of $\tau$] \label{lem:1} Let Assumptions \ref{ass:stationarity}, \ref{ass:ident} hold. Then
$$
\tau = \frac{1}{T - T_0} \sum_{t > T_0} \mathbb{E}\Big[Y_{0t}^1|T_0\Big] - \frac{1}{T_0} \sum_{s = 1}^{T_0} \mathbb{E}\Big[Y_{0s}^0|T_0\Big] .
$$
\end{lem}

Lemma \ref{lem:1} is an identification result. It states that the post-treatment difference in expectation equals the target estimand $\tau$.  While Lemma \ref{lem:1} is not invoked for constructing our test, it is used for estimating the average effect discussed in Section \ref{sec:average}.

The proofs of the lemmas are contained in Appendix \ref{app:lemmas}.



            \begin{rem}[Extensions with time fixed effects] In Section \ref{sec:time_fixed} we show how our results directly extend to the case where
  $$
  Y_{0t}^0 = \kappa_t^0 + \iota_j + \varepsilon_{j,t}^0, \quad \mathbb{E}[\varepsilon_{j,t}^0] = 0,
  $$
  where $\kappa_t^0$ denotes a time-fixed effect. This extension, while simple, has important implications: it permits incorporating non-stationary unobserved components.
For this case, stationary can fail as long as the control group is ``representative" of the treated unit, i.e., time fixed effects are the same between the control and treated unit. This follows in the same spirit of two-way fixed-effect models \citep{imai2021use} that are commonly encountered in applications see, for example, \cite{garthwaite2014public}.\footnote{For example, in the context of our application for studying the effect of Tennessee dis-enrollment health-insurance program, Obamacare between 2010 and 2014 may act as a time-varying confounder. Therefore, we use as the control group for the effect of dis-enrollment in Tennessee the outcome from the other Southern States that, similarly to Tennessee, did not expand Medicaid between 2010-2014 due to Obamacare.} In the presence of time-fixed effects, identification is achieved by a difference-in-difference as opposed to a pre-post treatment comparison as discussed in Lemma \ref{lem:1b}.
\qed
  \end{rem}







 \section{Counterfactuals Predictions and Hypothesis Testing} \label{sec:inference}


 In this section, we discuss the problem of estimating the counterfactual prediction $\hat{Y}_{0t}^0, t > T_0$ and conducting inference on the sharp null hypothesis in Definition \ref{defn:sharp}.

   Throughout our discussion, for expositional convenience, we denote in the compact form $$
   X_t =(Y_{1t}, \dots, Y_{nt}, Z_{0t}^\top, Z_{1t}^\top, \dots,Z_{nt}^\top) \in \mathcal{X}.
   $$



To test the null hypothesis of interest, we first estimate the true potential outcome $Y_{0t}^0, t > T_0$, unobserved over the post-treatment period. We define $\widehat{Y}_{0t}^0$ its estimate constructed as follows
\begin{equation} \label{eqn:jj}
 \widehat{Y}_{0t}^0 = w(F_0)^\top g(X_t).
 \end{equation}
 Here $w(F_0)$ denotes a generic functional of the empirical distribution $F_0$ of $(Y_{0t}, X_t)$ over the pre-treatment period, where $Y_{0t}$ serves as the main outcome of interest. The choice of $w(F_0)$ can be arbitrary, with the only condition required that $w(\cdot)$ is a Hadamard differentiable functional (see Assumption \ref{ass:df}).\footnote{Definition of Hadamard differentiability is provided in Appendix \ref{sec:definitions}.} In Section \ref{sec:weights} we provide explicit expressions for $w(\cdot)$.\footnote{Since the functions $g(\cdot)$ can contain an intercept, the component $w(F_0)^\top g(X_t)$ also estimates the (time-invariant) shift in mean after subctracting $\bar{Y}_t$. See, for instance, Example \ref{exmp:mean}.}



  It is important to note that the functions $g(X_t)$ can be data-dependent. Such functions are estimated as described in Algorithm \ref{alg:alg2}. Namely, first, we divide the pre-treatment period into two blocks
$t \in \{T_-, \cdots, 0\}$ and $t \in \{1, \cdots, T_0\}$. We define
$
F_-
$ the empirical distribution for $t < 1$ of $(Y_{0t}, X_t)$.  We construct the predictors as follows
\begin{equation} \label{eqn:pred}
\Big\{ x \mapsto g_j(x; F_-) \Big\}
\end{equation}
with $F_-$ denoting the training set for such predictors, and $g_j$ denoting some pre-specified regressor. For example $g_1(X_t; F_-)$ can denote the prediction of a Random Forest, trained over the sample $t < 0$, with empirical distribution $F_-$. Whenever clear from the context, we will omit the second argument $F_-$ from the function $g_j(\cdot)$. Throughout the rest of our discussion, we will fix the size of $T_-$ and consider asymptotics as $T \rightarrow \infty, T_0 \propto T$.


We conclude our discussion with two cases of interest.

\paragraph{Case 1: Ensemble} To gain further intuition on Equation \eqref{eqn:jj}, observe that we can interpret $w(F_0)$ as some data-dependent weights, while the functions $g(X_t)$ are interpreted as predictors or ``experts" that, based on information $X_t$, predict the counterfactual outcome $Y_{jt}$ (net of time-fixed effects) at time $t$. This follows in the same spirit of forecasts combinations \citep{timmermann2006forecast}, with $g_i$ denoting some ``experts" or learners. Section \ref{sec:weights} discusses examples and properties of weighting schemes. The construction of the weights is based on out-of-sample performance: it uses information $F_0$ which has not been used for the training of the algorithms $g(\cdot)$ (that instead use information before time $t = 0$).


 \paragraph{Case 2: Single Regressor}   Equation \eqref{eqn:jj} is, however, more general than only ensemble methods, since it also allows for estimation with a single regressor $g_1(X_t)$ (e.g., the Synthetic Control).






\begin{algorithm} [h]   \caption{Counterfactual Estimation with Sample Splitting}\label{alg:alg2}
    \begin{algorithmic}[1]
    \Require Observations $\{Y_{0t}, X_t\}_{t=T_{-}}^{T}$, time of the treatment-$T_0$,   learners  $F \mapsto g_1(\cdot,F),\dots, g_p(\cdot,F)$
    \State Split the pre-treatment period into two parts: $t \in [T_{-},0]$ and $t \in [1,T_0]$
    \State Form  predictions   $g_j(\cdot; F_-)$ with $F_-$ being the empirical distribution of $\{Y_{0t}, X_t\}_{t < 1}$ , $j \in 1,\dots,p$.
             \State  Use the second pre-treatment period,  $\{Y_{0t}, X_t\}_{t =1}^{T_0}$, to estimate the weights of the learners,  $w(F_0)$.
 \State  Compute the predicted counterfactual

\centerline{ $\hat Y_{0t} ^0 = \sum_{j=1}^p w_j(F_0) g_j(X_t)$ for  $ t > T_0$ }


        \Return the predictions $(\hat{Y}_{T_0 + 1}^0, \cdots, \hat{Y}_T^0)$.


         \end{algorithmic}
\end{algorithm}




 \subsection{Testing the Sharp Null Hypothesis}



Given $\widehat{Y}_{0t}$, we construct a test statistics and test with coverage $1 - \alpha$ having the following form:

 \begin{equation} \label{eqn:teststat1}
         \quad \mathcal{T} = (T - T_0)^{-1/2}\sum_{t = T_0 + 1}^T \left(Y_{0t}^o - \hat Y_{0t} ^0 \right)^2, \quad \phi_\alpha(\mathcal{T}) = 1\Big\{\mathcal{T} \ge q_{1- \alpha}^* \Big\}
        \end{equation}
        where $q_{1- \alpha}^*$ is the estimated $1 - \alpha$ quantile of $\mathcal{T}$. The test statistic depends on the prediction error between the estimated counterfactual outcome and the potential outcome \textit{under} the null hypothesis.
        Observe that under Equation \eqref{eqn:jj}, we can represent in compact form the test statistic as a functional of the \textit{empirical} distributions
        \begin{equation} \label{eqn:tt}
       \mathcal{T}(F_0, F_1) =  (T - T_0)^{1/2} \int \Big(y -  w(F_0) g(x)\Big)^2 dF_1(x, y) ,
        \end{equation}
        where $F_1$ denotes the \textit{empirical} distribution over the post-treatment period of $(Y_{0t}^o, X_t)$.

        We obtain the critical quantile $q_{1 - \alpha}^*$ using the block bootstrap \citep{politis1992circular, politis1994stationary}. Formally, we resample the entire vector $(Y_{0t}, X_t)_{t=1}^{T}$,  over the pre-treatment period, constructing first $T_0$ units serving as pre-treatment period's observations and $T - T_0$ units serving as post-treatment period's observations.
 We then construct the empirical measure of the bootstrapped sample $(F_0^*, F_1^*)$ and compute $\mathcal{T}^* = \mathcal{T}(F_0^*, F_1^*)$. A formal description is included in Algorithm \ref{alg:boot}.





The main intuition behind the inferential procedure is the following.
We use a portion of the data to train predictors, while the remaining observations are used for the bootstrap estimate of the critical value when conducting hypothesis testing. We only estimate learners once and not on each bootstrapped sample. Figure \ref{fig:algsketch} provides a graphical illustration.












\begin{algorithm}    \caption{Testing Sharp Nulls: Basic Algorithm}\label{alg:boot}
    \begin{algorithmic}[1]
    \Require Observations $\{Y_{0t}, X_t\}_{t > 1}$, predictors $g_1(\cdot), \cdots, g_p(\cdot)$ estimated as in Algorithm \ref{alg:alg2}.
      \For{$b=1,\dots, B$}
       \State Sample observations with replacement $\{Y_{0t}^o, X_t\}_{t > 1}$, and obtain bootstrap sample $\{Y_{0t}^{o*}, X_t^*\}_{t > 1}$ by performing circular block bootstrap  on  $\{Y_{0t}^o,X_t \}$ for $t \in \{1,\dots, T\}$;
       \item Construct the empirical measure from the bootstrap sample $F_0^*, F_1^*$, and the test statistic $\mathcal{T}^* = \mathcal{T}(F_0^*, F_1^*)$;
 \EndFor

           \State Compute $ q_{1-\alpha}^*$ as $(1-\alpha)$-th quantile  of the sample

        \Return Reject the null hypothesis if
           $\mathcal{T} >q_{1-\alpha}^*$.          \end{algorithmic}
\end{algorithm}

Below, we formalize the validity of the bootstrap.\footnote{Lemma \ref{lem:identi2} provides the main intuition. The lemma implies that the distribution before and after the treatment must remain the same under the null hypothesis. Therefore, intuitively, we may expect that $(F_0^*, F_1^*)$ centered around the true empirical distribution converges to the same empirical process (after appropriate rescaling) of the limiting process of $(F_0 - \mathcal{D}_0, F_1 - \mathcal{D}_0)$, under the null hypothesis. We can then invoke Hadamard differentiability properties to show the bootstrap's validity.  We use such properties in the derivation of the validity of the bootstrap. } We impose the following condition.


\begin{ass} \label{ass:stat} Assume that $\{Y_{0t}^0, X_t\}_{t \geq 1}$ is $\beta$-mixing with mixing coefficients  $\sum_{k=1}^{\infty} (k+1)^2 \beta(k) < \infty$. In addition,  $g(\cdot), Y_{0t}^0$ are uniformly bounded almost surely.
\end{ass}

\begin{ass} \label{ass:df} Suppose that $w(\cdot)$ is Hadamard differentiable at $\mathcal{D}_0$ and uniformly bounded.
\end{ass}

In Appendix \ref{sec:hadamrd} we show that Assumption \ref{ass:df} holds for exponential weights considered in the following sections. We now introduce the first theorem.

\begin{thm} \label{thm:1} \textit{Let Assumptions \ref{ass:stationarity}-\ref{ass:df} hold.
 Let $\lim\sup_{T \rightarrow \infty}  b(T)/ \sqrt{T} < \infty$ and $\lim_{T \rightarrow \infty}   b(T) \rightarrow \infty$.
  Then,  under the null hypothesis, whenever  $p < \infty$
$$
\begin{aligned}
\sup_x \Big|\mathbb{P}(\mathcal{T}^* - \mathcal{T}\le x|Y_{1:T},X_{1:T},T_0, H_0) -\mathbb{P}(\mathcal{T} - \mathbb{E}[\mathcal{T}] \le x| T_0, H_0) \Big| &= o_p(1) , \quad \text{ for } \quad T_0 \propto T \rightarrow \infty.
\end{aligned}
$$
}
\end{thm}


 \begin{cor}[Size control] Let the conditions in Theorem \ref{thm:1} hold. Then
 $
 \lim_{T \rightarrow \infty} P\Big(\phi_\alpha(\mathcal{T}) = 1 | H_0\Big) = \alpha.
 $
 \end{cor}
 The above corollary follows from the validity of the bootstrap \citep[see for example,][]{fang2014inference} and it guarantees exact asymptotic coverage.


 The proof of Theorem \ref{thm:1} is contained in Appendix \ref{sec:proof}. Theorem \ref{thm:1} does not impose any restriction on the predictor other than Hadamard differentiability. Conditions on Hadamard differentiability are often imposed in the literature \citep{belloni2017program}, and require that weights are smooth functionals of the data. These are satisfied under mild conditions, and simple examples of weights that satisfy such conditions include least squares \citep{lunde2017bootstrapping} or exponential weights we discuss in Section \ref{sec:weights} (see Appendix \ref{sec:hadamrd} for a formal discussion). Note that the theorem is valid under misspecification.

It is interesting to observe that if we were doing classical statistical inference, we would need to account for the estimation error generated by each individual prediction. Instead, the sample splitting procedure in Algorithm \ref{alg:alg2} combined with the resampling method in Algorithm \ref{alg:boot} guarantees valid inference, and it overcomes the complicated generated regressor problem. The key intuition is that the empirical distributions corresponding to the group of observations used for the training and those for the resampling are asymptotically independent under standard mixing conditions. As a result, \textit{sample splitting} guarantees that we can condition on the initial training period $F_-$, without affecting the asymptotic properties of the bootstrap.
In this sense, our analysis extends the standard sample-splitting procedures employed in the $i.i.d.$ setting \citep{rinaldo2019bootstrapping} to dependent observations.







\begin{figure}[h]
\spacingset{1}
\centering
\includegraphics[scale=0.4]{./plots/Algorithm1.png}
\caption{The algorithm, in the presence of multiple post-treatment periods, works as follows: train learners on an initial sample, compute the weights on a consecutive block of observations and then predict the counterfactual. The green color denotes the pre-treatment period while the orange color denotes the post-treatment period;   bootstrap observations after imposing the null hypothesis.  } \label{fig:algsketch}
\end{figure}





 \begin{exmp}[Inference with the sample mean] \label{exmp:mean}
For an illustrative example, consider the following simple model:
$$
Y_{jt} = \mu + \alpha 1\{t > T_0, j = 0\} + \varepsilon_{jt}, \quad \mathbb{E}[\varepsilon_t | T_0] = 0 \quad \forall t,
$$ and as estimator the difference-in-difference estimator
$$
\hat{Y}_{0t}  = \frac{1}{|T_-|} \sum_{s < 0} Y_{0s},
$$
where, for illustrative purposes, we use sample splitting for its construction.\footnote{Note that we could also have taken $\frac{1}{T_0} \sum_{s =1}^{T_0} Y_{0s}$, since the difference in means is Hadamard differentiable, with $w(F_0) g(X_t) = \int y dF_0(y)$ with $g(X_t) = 1$.}
Our corresponding test statistic takes the following form:
 $$
 \mathcal{T} = \frac{1}{\sqrt{T - T_0}} \sum_{t > T_0} \Big| \varepsilon_{0t} - \frac{1}{|T_-|} \sum_{s < 0}  \varepsilon_{0s} + \alpha\Big|^2.
 $$
It is interesting to compare to the test statistic obtained from the permutation based method. This constructs the estimated counterfactual using the sample mean over the time-window $t \in \{1, \cdots, T_0, \cdots, T\}$, imposing a sharp null hypothesis \citep{chernozhukov2018exact}. Its corresponding test statics takes the following form
\begin{equation}
\mathcal{T}^c = \frac{1}{\sqrt{T - T_0}} \sum_{t > T_0} \Big| \varepsilon_{0t} - \frac{1}{T} \sum_{t=1}^T  \varepsilon_{0t} + (1 - \lambda) \alpha \Big|^2, \quad \lambda  = \frac{T - T_0}{T}.
\end{equation}
To gain further intuition, let $\lambda \approx 1$ (i.e., the post-treatment period is larger than the pre-treatment period). Then, the distribution of $\mathcal{T}^c$, corresponding to the permutation-based approach, does not depend on the treatment effect $\alpha$, and therefore it cannot detect treatment effects. On the other hand, the dependence of the test statistic $\mathcal{T}$ with $\alpha$ remains invariant as $\lambda$ changes. \qed


\end{exmp}



 \begin{rem}[Choice of the test statistics] Alternative test statistics can be constructed by taking the $k$-norm of the residual error may also be considered \citep{chernozhukov2018exact},
        $$
\Big((T - T_0)^{-1/2}\sum_{t > T_0} \left(Y_{0t}^o - \hat Y_{0t} ^0 \right)^k\Big)^{1/k},
        $$
        for a general $k$ of the form. In this paper, the choice of $\mathcal{T}$ is motivated by two reasons: (i) the test statistics well captures permanent effects (i.e., effects exhibited over each post-treatment period) compared to test statistics having $k > 2$, which instead are better suited for the different case of large but temporary treatment effects, as in the case of $k = \infty$;\footnote{This is of interest also in our empirical applications, where the effects of a decrease in expenditures in Medicaid is expected to have long term effects on health-care outcomes, instead of large and temporary effects.} (ii) the test statistic presents desirable differentiable properties compared to the case of $k = 1$, which instead would not exhibit differentiability properties necessary for the validity of the resampling mechanism \citep[see, for example][]{fang2014inference}.
        \qed
 \end{rem}




\begin{rem}[Testing the weak null hypothesis] \label{rem:average_null}  Our framework for inference discussed in Section \ref{sec:inference} also extends to null hypothesis of the form
$$
H_0^{avg}: \mathbb{E}\Big[Y_{0t}^1 - Y_{0t}^0\Big] = a^o, \quad a^o \in \mathbb{R}, t > T_0.
$$
While we omit details for brevity, we note that, in this secenario, the test statistics takes the form $\mathcal{T}_A = \Big((T - T_0)^{-1/2} \sum_{t > T_0} \Big(Y_{0t}^o - \hat{Y}_{0t}^0\Big) \Big)^2$. The test statistics is attractive in the presence of additive treatment effects and small deviations,\footnote{See for example the discussion at Page 65 in \cite{imbens2015causal}.} while the square (instead of the absolute value) guarantees differentiability. \qed
\end{rem}









 \section{Average Treatment Effects, Bias Adjustment and Time-Varying Fixed Effects} \label{sec:average}


 In applications, we may also be interested in estimating the average treatment effect consistently in Definition \ref{defn:estimand}.
A direct corollary of Lemma \ref{lem:1} is that a simple treated and controls difference, under standard mixing conditions, provides a consistent estimate of the treatment effect. However, such an estimate can present significant variance since we do not control the variation captured by covariates $X_t$, which can be non-vanishing with high-dimensional controls.


An alternative estimator for the average treatment effect takes the following form instead:
$$
\frac{1}{T - T_0} \sum_{t > T_0 } \Big(Y_{0t} - \widehat{Y}_{0t}^0\Big).
$$

Unfortunately, such an estimator may be inconsistent for the true $\tau$, due to misspecification of the functions $g(x)$. We consider a bias adjustment instead.


The bias adjustment works as follows. Define $F_{0, -1/2}$ the empirical distribution of $(Y_t, X_t)$ for $t \in \{1, \cdots, T_0/2\}$, and $F_{0, 1/2}$ the empirical distribution of $(Y_t, X_t)$ for $t \in \{T_0/2  + 1, \cdots, T_0\}$. Then we construct an estimator of the form
\begin{equation} \label{eqn:tau_hat}
\begin{aligned}
\widehat{\tau} & = \frac{1}{T - T_0} \sum_{t > T_0 } \Big(Y_{0t} - \widehat{Y}_{0t}^0 \Big) - \frac{1}{T_0/2} \sum_{t = T_0/2 + 1 }^{T_0} \Big(Y_{0t} - \widehat{Y}_{0t, -1}^0 \Big), \quad \widehat{Y}_{0t, -1}^0 = w(F_{0, -1/2}) g(X_t)
\end{aligned}
\end{equation}
where $\widehat{Y}_{0t, -1}^0$ is the estimator whose weights are constructed using only the first half of the treatment period, and $g$ is constructed as in Algorithm \ref{alg:alg2}. The first difference is taken over the post-treatment period, with weights computed over the entire pre-treatment period. The second difference is taken over the second half of the pre-treatment period, but with weights computed over the first half. The second difference defines the bias adjustment.

To gain further intuition on the bias adjustment, note that we can write
$$
\hat{\tau} = \tau + o_p(1)  - \underbrace{\int \Big(w(F_0)g(x) - w(F_{0, -1/2})g(x)\Big) d(F_1(y, x) - F_{0, 1/2}(y, x))}_{ = o_p(1)}
$$
where $F_1$ denotes the empirical distribution over the treated period, $F_{0, -1/2}$ denotes the empirical distribution over the first half of the pre-treatment period, and $F_{0,1/2}$ denotes the empirical distribution over the second half. The above estimator is a difference in difference, where the first component converges to $\tau$ while the second component is of order $o_p(1)$ as shown in the following theorem.

We first impose the following condition.

\begin{ass}[Potential outcome $Y_{0t}^1$] \label{ass:pot1} Assume that
$$
Y_{0t}^1 = \mu_{0t}^1 + \varepsilon_{0t}^1, \quad \mathbb{E}[\varepsilon_{0t}^1] = 0,
$$
where $\mu_{0t}^1 < \infty$ denotes some (possibly non-stationary) expectation and $\varepsilon_{0t}^1$ is stationary.
\end{ass}

Assumption \ref{ass:pot1} states that the potential outcome under control can be decomposed into two components: a (possibly non-stationary) expectation and an additive stationary idiosyncratic shock. We can now introduce the following theorem.


\begin{thm} \label{thm:consistency} Let Assumption \ref{ass:stationarity}, \ref{ass:ident}, \ref{ass:df}, \ref{ass:pot1} holds.  Assume that $(\varepsilon_{0t}^1, Y_{0t}^0, X_t)$ is $\beta$-mixing with mixing coefficients  $\sum_{k=1}^{\infty} (k+1)^2 \beta(k) < \infty$, with $g(\cdot; F_-)$ uniformly bounded. Then
$
\hat{\tau} - \tau \rightarrow_p 0.
$
\end{thm}

Theorem \ref{thm:consistency} shows consistency of the estimated effect. It imposes standard mixing conditions. Its proof is in Appendix \ref{sec:proof}.



\subsection{Extension to Time-Varying Fixed Effects} \label{sec:time_fixed}


In this section, we turn to the case where time-fixed effects occur and illustrate how our results extend to this case without necessitating estimating the fixed effect.

We consider the following data generating process.



\begin{ass}[Fixed effects and Stationarity] \label{ass:stationarityb} Suppose that
$$
Y_{jt}^0 =  \kappa_t^0 + \iota_j^0 + \varepsilon_{jt}^0, \quad \mathbb{E}[\varepsilon_{jt}^0] = 0 \quad j \in \{0, \cdots, n\}, t \le T,
$$
where $\iota_j^0 < \infty, \kappa_t^0 < \infty$ denotes individual and time-fixed effect and
$
(\varepsilon_{0t}^0, \varepsilon_{1t}^0, \cdots, \varepsilon_{nt}^0, Z_{0t}, \cdots, Z_{nt}) \sim \mathcal{D} ,
$
define arbitrary unobservables and observables which follow a stationary process.
\end{ass}

The above assumption allows for the failure of stationary as long as the time fixed effects are the same between the control and treated unit. The following lemma illustrates identification for this case.

\begin{lem}[Identification of $\tau$] \label{lem:1b} Let Assumptions \ref{ass:ident}, \ref{ass:stationarityb} hold. Then
$$
\tau = \frac{1}{T - T_0} \sum_{t > T_0} \Big\{\mathbb{E}\Big[Y_{0t}^1|T_0\Big] - \frac{1}{n} \sum_{j > 0} \mathbb{E}\Big[Y_{jt}^0\Big|T_0\Big] \Big\} - \frac{1}{T_0} \sum_{s = 1}^{T_0} \Big\{\mathbb{E}\Big[Y_{0s}^0|T_0\Big]  - \frac{1}{n} \sum_{j > 0} \mathbb{E}\Big[Y_{js}^0\Big|T_0\Big] \Big\}.
$$
\end{lem}

The above lemma shows that we can identify the treatment effect by taking a difference in difference. The following lemma discusses testable implications for the sharp null hypothesis.

\begin{lem}[Sharp Null: Testable Implication] \label{lem:identi2b} Under the null hypothesis in Equation \eqref{eqn:null} and Assumptions \ref{ass:ident}, \ref{ass:stationarityb} then $(Y_{0t}^o - \bar{Y}_t, Y_{1t} - \bar{Y}_t, \cdots, Y_{nt} - \bar{Y}_t, Z_{0t}, \cdots, Z_{nt} )$ is stationarity and independent of $T_0$ for all $t \in \{1, \cdots, T_0, \cdots, T\}$, with $\bar{Y}_t = \frac{1}{n} \sum_{j = 1}^n Y_{jt}$.
\end{lem}

The proofs of the above lemmas are in Appendix \ref{app:lemmas}.
The counterfactuals' estimation follows similarly as before, with a minor modification: we subtract the controls' average outcome from the outcome of the treated unit and from the control unit to guarantee stationarity. This is illustrated below.
$$
\hat{Y}_{0t}^0 - \bar{Y}_t = w(\tilde{F}_0)g(\tilde{X}_t), \quad \bar{Y}_t = \frac{1}{n} \sum_{j = 1}^n Y_{jt}, \quad \tilde{X}_t = \Big(Y_{1t} - \bar{Y}_t, \cdots, Y_{nt} - \bar{Y}_t, Z_{0t}, \cdots, Z_{nt}\Big),
$$
where $\tilde{F}_0$ denotes the empirical distribution of $(Y_{0t} - \bar{Y}_t, \tilde{X}_t)$ over the pre-treatment period.
 Here, $\bar{Y}_t$ denotes the time-specific average of the \textit{control} units, but not of the treated. Theorem \ref{thm:1} and Theorem \ref{thm:consistency} directly follows once we subctract from the outcomes $(Y_{0t}, \cdots, Y_{nt})$ the controls' average $\bar{Y}_t$ to guarantee stationarity.










\section{Ensamble Weights and Prediction Guarantees under Non-stationarity} \label{sec:weights}


This section discusses a particular weighting scheme, exponential weights, and derives its properties in terms of prediction guarantees.


 \subsection{Ensamble: Exponential weights}	\label{subsec:weights}


Although least-squares have been considered \citep[see, e.g.,][]{kunzel2017meta,polley2010super, elliott2004optimal}, these can perform poorly when the number of learners is large compared to the sample size.\footnote{Observe that weights computed via least-squares are Hadamard differentiable \citep{lunde2017bootstrapping}, hence satisfying the conditions in Theorem \ref{thm:1}.} Equal weighting, on the other hand, can perform poorly in the presence of many uninformative learners. To equip the method to have a better performance in the presence of a large number of algorithms, some of which may potentially be ineffective,
 we discuss an alternative weighting scheme.

  With a slight abuse of notation, we index weights by the time period as $w(t)$, with $t \in \{1, \cdots, T_0\}$. For example $w(\tilde{t})$ denotes the weight estimated using the empirical distribution from time $t = 1$ to time $t= \tilde{t}$.

 The weigthing scheme we focus are exponential weights of the following form: we write
 \begin{equation}
	\label{eqn:expweights1}
	w^{(j)}(T_0) = \frac{ \exp \left\{ -\eta \sum_{s=1}^{T_0}  \Bigl(Y_{0s}  - g_{j}(X_s) \Bigl)^2\right\}}{\sum_{i=1}^{p} \exp\left\{ -\eta \sum_{s=1}^{T_0}   \Bigl(Y_{0s} -  g_{i}(X_s) \Bigl)^2 \right\} } .
	\end{equation}
 Such weights have been widely discussed in literature on exponential aggregation, see e.g., \cite{cesa1999prediction}, \cite{rigollet2012sparse} among others.

 By choosing the tuning parameter $\eta \propto 1/T_0$ exponential weights can be written as differentiable functionals of $F_0$. This is discussed in Appendix \ref{sec:hadamrd}.

We can motivate Equation \eqref{eqn:expweights1} as the solution to a penalized surrogate risk minimization, discussed below.

\begin{exmp}[Model average as a surrogate risk minimization problem] \label{exmp:jhg} Consider the following optimization problem \citep[e.g.,][]{rigollet2012sparse}
$$
\text{min}_{w \in \mathcal{W}} \{\sum_{t=1}^{T_0} w_j (Y_{0t} -  \sum_{j=1}^{p} g_j(X_t))^2 + \text{pen}(w) \}, \quad \mathcal{W}= \{ w \in \mathcal{R}^{p}: w_j \ge 0; \sum_{j=1}^{p} w_j = 1\},
$$
where $\text{pen}(w)$ denotes a penalty on the weights. Under convexity of the loss function, the above optimization problem is interpreted as minimizing a surrogate loss function of the penalized empirical risk.\footnote{Observe that we can write the risk as $\{\sum_{t=1}^{T_0} l(Y_{0t}, \sum_{j=1}^{p} w_j f_{j,t}) + \text{pen}(w) \}
$
where, by convexity, $\sum_{j=1}^p w_j l(Y_{0t}, \sum_{j=1}^{p} f_{j,t}) \ge l(Y_{0t}, \sum_{j=1}^{p} w_j f_{j,t})$. Surrogacy is often considered in decision problem for its computational appeals. }
By letting $\text{pen}(w) = \frac{1}{\eta} \sum_{j=1}^{p} w_j \text{log}(w_j)$, the solution to the problem reads as
\begin{equation} \label{eqn:exp1}
w^{(j)}(T_0) = \frac{ \exp(-\eta \sum_{t=1}^{T_0} (Y_{0t} - g_{j}(X_t))^2)}{\sum_{i=1}^{p} \exp(-\eta \sum_{t=1}^{T_0} (Y_{0t} - g_{i}(X_t))^2)}.
\end{equation}
Intuitively, the method assigns larger weights to those predictors that have the lowest out-of-sample loss function. These weights inherit oracle guarantees discussed in Section \ref{sec:pp}. \qed

\end{exmp}



\subsection{Prediction Guarantees}  \label{sec:pp}

We now derive prediction guarantees of the exponential weights without imposing stationarity conditions. Our result illustrates oracle guarantees of the exponential aggregation method \citep{cesa2006prediction}, here applied to the different contexts of counterfactual prediction.





 We study the behavior of our algorithm trained only on $t-1$ observation and evaluated at the $th$ observation, i.e., we are willing to provide theoretical guarantees on the following cumulative loss.
\begin{equation} \label{eqn:cum1}
T_0^{-1} \sum_{t=1}^{T_0} (\hat Y_{0t}^0( \mathcal{F}_{t-1}) - Y_{0t}^0)^2,
\end{equation}
where $\hat{Y}_t^0(\mathcal{F}_{t-1}) = w(t-  1) g(X_t)$. Here, $\hat Y_{0t}^0( \mathcal{F}_{t-1})$ denotes the prediction at time $t$ using only information at time $t-1$.
Since $\hat Y_{0t}^0( \mathcal{F}_{t-1})$ is estimated only on the previous data and evaluated at $X_t$, this notion of performance is rooted in out-of-sample performance metric.

We first study the cumulative loss in \eqref{eqn:cum1} compared to the smallest cumulative loss incurred by any of the algorithms under consideration, defined as
 \begin{align*}
 \mathcal{R} &=  T_0^{-1} \sum_{t=1}^{T_0} (\hat{Y}_t^0(\mathcal{F}_{t-1}) - Y_{0t}^0)^2 - \min_{i \in \{1,\dots,p\}} T_0^{-1} \sum_{t=1}^{T_0}  (g_i(X_t)  - Y_{0t}^0)^2.
\end{align*}



 In the following theorem, we consider the case where $T_0 = \lambda T$ where $\lambda \in (\gamma,1 - \gamma)$ is potentially a random variable for some constant $\gamma > 0$.
\begin{thm} \label{thm:regret0}
Suppose that $(Y_{0t},  g(X_t)) \in [-M, M]^{p + 1}$, for some $M< \infty$. Consider an exponential weighting scheme as in \eqref{eqn:expweights1} with $\eta \propto \sqrt{{\log(p)}/{T_0}}$.
Then with probability at least $1 - 2\delta$,
$
\begin{aligned}
&\mathcal{R}  \le C_0 \sqrt{\frac{ {\log}(p/\delta)}{ \gamma T}}
\end{aligned}
$
 for $C_0 < \infty$ being a   constant independent of $T_0$ or $p$.
\end{thm}




The proof is presented in Appendix \ref{app:5}.

\noindent Theorem \ref{thm:regret1} provides an error bound for the empirical one step ahead prediction error. Remarkably, it does not require any stationarity assumption.
 The bound scales logarithmically with the number of learners, and it scales at square-root $T$ with the length of the sequence.

In the following lines, we provide stronger guarantees with respect to the \textit{conditional} expectation of $Y_{0t}^0$. For the next theorem to hold, we need to introduce an additional condition, which replaces Assumptions \ref{ass:stationarity} and \ref{ass:ident} that we imposed in previous sections.

 \begin{ass} \label{ass:regretmodel} (Additive Error Model and Sequential Ignorability) Let the following hold
\begin{equation} \label{eqn:dgp1}
\begin{aligned}
&Y_{0t}^0  = \mu_t(X_t) + \varepsilon_{0t}.
\end{aligned}
\end{equation}
where   $\mathbb{E}[\varepsilon_{0t} |X_t, \mathcal{F}_{t-1}] = 0$. Assume in addition that $\varepsilon_{0t} \perp T_0 |X_t, \mathcal{F}_{t-1}$, where $\mathcal{F}_{t-1}$ denotes the filtration at time $t - 1$.
\end{ass}


Assumption \ref{ass:regretmodel} states that the potential outcome can be decomposed into two main components, a conditional expectation function $\mu_t(\cdot)$ and idiosyncratic shocks. Note that such a condition is only required to derive guarantees with respect to $\mu_t(\cdot)$.
It is natural to compare the cumulative loss in \eqref{eqn:cum1} with the smallest cumulative loss incurred by any of the algorithms under consideration. We define such a metric of comparison as the Conditional Mean Proxy Regret (CMPR).
\begin{align*}
 \mathcal{R} ^{\mu} &=  T_0^{-1} \sum_{t=1}^{T_0} (\hat{Y}_t^0(\mathcal{F}_{t-1}) - \mu_t(X_t))^2 - \min_{i \in \{1,\dots,p\}} T_0^{-1} \sum_{t=1}^{T_0}  (g_i(X_t)- \mu_t(X_t))^2.
\end{align*}
The above definition incorporates notions of performance with respect to the conditional mean function (as opposed to the outcome itself). Our definitions above combine definitions in the literature on prediction of individual sequences \citep{cesa1999prediction} with the literature on causal inference. The main difference with standard notions
of regret is that CMPR is based on the unobserved deviation of the predicted counterfactual from the
conditional mean evaluated at $X_t$, and not just on the cumulative loss of the predictor


\begin{thm} \label{thm:regret1}
 Let Assumption \ref{ass:regretmodel} hold and let $(Y_{0t}, \mu_t(X_t), g(X_t)) \in [-M, M]^{p + 2}$, for some $M< \infty$. Consider an exponential weighting scheme as in \eqref{eqn:expweights1} with $\eta \propto \sqrt{{\log(p)}/{T_0}}$.
Then with probability at least $1 - 2\delta$,
$$
\begin{aligned}
&\mathcal{R} ^{\mu} \le C_0 \sqrt{\frac{ {\log}(p/\delta)}{ \gamma T}} ,
\end{aligned}
$$
 for $C_0$ being a   constant independent of $T_0$ or $p$.
\end{thm}




The proof is presented in Appendix \ref{app:5}.

\noindent Theorem \ref{thm:regret1} provides an error bound for the empirical one step ahead prediction error with respect to the \textit{conditional mean}.


 If we are willing to assume more, in that our class of algorithms contains one learner that consistently estimates the unknown model, then previous results imply that our synthetic learner will preserve that consistency regardless of the number of learners in the entire class. We consider below asymptotics for $T \rightarrow \infty$ and $T_0 = \lambda T$ where $\lambda \in (0,1)$ is potentially a random variable.

\begin{cor}
Suppose that  the number of learners is such that $\log(p)/T^{1/2} = o(1)$ and conditions in Theorem \ref{thm:regret1} hold. Assume also that the following holds
$
\min_{i \in \{1, \dots,p\}} T_0^{-1}\sum_{t=1}^{T_0} |\mu_t(X_t) -  g_{i}(X_t)|^2 = o_p(1).
$
Then,
$$
T_0^{-1} \sum_{t=1}^{T_0}  (\hat{Y}_t^0(\mathcal{F}_{t-1}) - \mu_t(X_t))^2 = o_p(1).
$$
for $T\rightarrow \infty$, $T_0 = \lambda T$.
\end{cor}

















\section{Numerical Experiments} \label{sec:experiments}




In this section, we study the performance of the method in the presence of linear and non-linear outcome models, allowing for the presence of many non-informative methods. We compare the methodology to existing testing procedures, including permutation tests of Synthetic Control as well as the Difference-in-Difference method, and showcase a significant improvement.





 \subsection{Experimental Setups}

 We describe our experiments in terms of the outcome model as well as the model of the design of the covariates and the error terms. In our first experiment,  \textbf{DGP1},  we considered a simple Linear Outcome Model
 $$
Y_{0t} =  X_t \beta + a_t D_t + \epsilon_t
$$
and tested the ability of our method to detect changes in the treatment effect $a_t$. This example is intended to model a setting where classical Synthetic Control method is optimal.  Here we set
 $\beta_j = 1/(1+j)^2$, $j=1,\dots,p$, with the last beta chosen such that $ \sum_{j } \beta_j =1$, where we consider $p \in \{10, 50\}$.
 The parameter $\beta$ will be kept as above for all our experiments.
 We considered a simple  {\sc ar}  model for the errors $\epsilon_t$ with
  $\epsilon_t =  0.6\epsilon_{t-1} + v_t$ and  $v_t \sim \mathcal{N}(0,1 - 0.6^2)$.
Control units are generated according to a factor model as
$$
X_{j,t} = \mu_j + \theta_t +  \lambda_j F_t + u_t
$$
with unit specific term $\lambda_j = \mu_j =  (1+j)/j$ a time random effect $\theta_t \sim \mathcal{N}(0,1)$ and an unobserved factors  $F_t \sim \mathcal{N}(0,1)$. Errors $u_t$ follow an  {\sc ar}  model
$u_t = 0.6u_{t-1} + h_t$ with $h_t \sim \mathcal{N}(0, 1 - 0.6^2)$.   In our second experiment, \textbf{DGP2}, we considered a
 Logistic-like Outcome Model $$
Y_{0t} =a_t D_t + \exp(X_t \beta + \epsilon_t)/(1+\exp(X_t \beta + \epsilon_t))
$$
with $\epsilon_t = 0.5 \epsilon_{t-1} + 0.3 v_{t-1} + v_t$. This experiment has three settings: (a), (b) and (c). Setting (a) and (b) assume   $v_t \sim \mathcal{N}(0,\sigma^2)$ with $(a)\sigma = 0.1$ and $(b) \sigma = 1$, respectively. Setting (c) assumes $ \epsilon_t = 0.8 \epsilon_{t-1} + v_t$,  with
$
v_t = \sqrt{h_t} z_t, \quad h_t = 0.001 + 0.99 v_{t-1}^2
$
with $z_t \sim \mathcal{N}(0,1)$({\sc ar-arch} process). We report here (a) and (b).  In addition we let
$
X_t = h_t + u_t
$
with $h_t$ being i.i.d over time with  $ \mathcal{N}(0, \Sigma)$ distribution  with $\Sigma_{i,j} = 0.5^{|i-j|}$ and $u_t = 0.8 u_{t-1} + k_t$ with $k_t \sim \mathcal{N}(0,1 - 0.8^2)$. This setting is designed to test the ability of the proposed Synthetic Learner to adapt to nonlinear outcome model.
We consider our third setting, \textbf{DGP3}, that follows a factor model
 $$
Y_{0t} = 0.5  + a_t D_t + \theta_t + 0.5 F_t + \epsilon_t .
$$
Error and design structures are the same as that of \textbf{DGP1}.  \textbf{DGP4} considers an interaction outcome model that is polynomial in structure
$$
Y_{0t} = a_t D_t  +(X_{1,t} + X_{2,t} + \dots + X_{10,t})^2 + \epsilon_t
$$
with $\epsilon_t$ being the same as in  \textbf{DGP2}(a) design $X_t$ is the same as throughout   \textbf{DGP2}; \textbf{DGP5} postulates a cosine, hence periodic, type of outcome model
 $$
Y_{0t} =  \cos(X_t\beta + \epsilon_t)  + a_t D_t .
$$
Error and design setting have three components: (a), (b) and (c) that are following the setup of  \textbf{DGP2} (a), (b) and (c), respectively. Finally, \textbf{DGP6} is a simple non-stationary model, which follows similarly to DGP3, but with $F_t \sim \mathcal{N}(\mathrm{cos}(t), 1)$, with $\mathrm{cos}(t)$ capturing a non-stationary component.\footnote{Note that the component cannot be removed from simple transformations such as differentiating.}  As discussed in the following subsections, we choose $p = 10$ for smaller $T (T \in \{60, 80, 100\})$ and $p = 50$ for larger $T \ge 300$.





\subsection{Testing}

We consider testing the following hypothesis $H_0$:
$$
H_0: Y_{0t}^1 - Y_{0t}^0 = 0, \quad  t > T_0.
$$
We consider the Synthetic Learner with experts, including a naive XGboost (which uses the default tuning parameter of the package XGboost in R), Support Vector Regression, and {\sc arima}(0,1,1) with external regressors together with $50$ non-informative learners.  Non-informative experts are randomly drawn from a multivariate gaussian with a full covariance matrix.



\subsubsection{Power Study: Comparison with SC and DID}


First, we compare Synthetic Learner's performance to existing procedures whose theoretical properties are well studied. In particular, we compare the Synthetic Control (SC) with weights being constrained to sum to one  and an intercept according to Equation (7) and (8) in \cite{chernozhukov2017exact}, as well as
the Difference in Difference (DiD) estimator, namely
$$
\hat{Y}_t^{DiD} = \hat{\alpha} + (\hat{\beta} + \hat{\Delta})   \mathbbm{1}_{t > T_0}
$$
with coefficient computed as in a standard DiD with the two periods corresponding to pre and post-treatment periods.
 We consider the test statistics for
  Synthetic Control

\begin{equation} \label{eqn:t_stat_sc}
\frac{1}{\sqrt{T - T_0}} \sum_{t = T_0 + 1}^T |Y_{0t} - a_t^o - X_t \hat{w}^0_{SC}|^2
\end{equation}
where $\hat{w}_{SC}^0$ are computed via constrained Least Squares, with coefficients summing to one for Synthetic Control. Finally, we consider
\begin{equation} \label{eqn:t_stat_sc}
\frac{1}{\sqrt{T - T_0}} \sum_{t = T_0 + 1}^T |Y_{0t} - a_t^o - \hat{Y}_t^{DiD}|^2
\end{equation}
for Difference-in-Differences.
 In Figures \ref{fig:plotsim60}, \ref{fig:plotsim_non_stat} and \ref{fig:plotsim100} we compare the performance of our method to permutation tests where $\hat{w}_{SC}$ and $\hat{Y}_t^{DiD}$ must be computed on the entire sample, as described in \cite{chernozhukov2017exact}. We run the Synthetic Learner after training on the period running from $1$ to $T_- = T_0/2, T \in\{60, 100\}, p = 10, T - T_0 = 10$, and we use the remaining observations for computing weights and bootstrap. We consider different treatment effects, denoted by $\alpha$, and report on the x-axis the effect of the policy $\alpha$ divided by the (unconditional) standard deviation of the outcome.


We present power plots  across different $T$ in Figures \ref{fig:plotsim60},  and \ref{fig:plotsim100} for $T = 60$ and $T = 100$ respectively, while Figure \ref{fig:plotsim_non_stat} collects results for the non-stationary DGP.
Across all figures, we observe an improvement over permutation tests with both SC and DiD methods, with more significant improvements for the non-linear DGPs.


Improvements can be due to two factors: bootstrap outperforming permutation as well as Synthetic Learner's better performance in comparison to SC and DiD. Table \ref{tab:perm_vs_boot} (see the discussion below) and Appendix \ref{app:oracle_quantile} provide suggestive evidence that improvements are due to both factors.

In particular, in Appendix \ref{app:oracle_quantile} we also consider the oracle case where the critical value is known. This case permits to compute $\hat{w}_{SC}$ and $\hat{Y}_t^{DiD}$ only using information until time $T_0$, as discussed in \cite{doudchenko2016balancing}. We show improvements also in this setting.  In Appendix \ref{app:vary_T}, we report a more extensive study with $T_0$ and $T - T_0$ vary and show the robustness of our results to different settings.






\begin{figure}[!ht]
\centering
\includegraphics[scale=0.5]{./plots/plots_sim_2/comparison_60_10-eps-converted-to.pdf}
\includegraphics[scale=0.5]{./plots/plots_sim_2/pol_res1-eps-converted-to.pdf}
\caption{$T = 60, p = 10, T_0 = 50$. Percentage of rejections of the null hypothesis of no treatment effects over $300$ repetitions. The x-axis reports the policy's effect rescaled by the outcome's standard deviation. Synthetic learner has XGboost,Support Vector Regression and {\sc arima}(0,1,1) and $50$ additional non informative predictions. The blue line denotes the proposed method, the red line denotes the difference-in-differences, and the green line denotes the Synthetic Control. }
\label{fig:plotsim60}
\end{figure}




\begin{figure}[!ht]
\centering
\includegraphics[scale=0.4]{./plots/plots_sim_2/non_stat-eps-converted-to.pdf}
\caption{$DGP6, T \in \{60, 100\}, p = 10$. Percentage of rejections of the null hypothesis of no treatment effects over $300$ repetitions. The x-axis reports the policy's effect rescaled by the outcome's standard deviation. Synthetic learner has XGboost,Support Vector Regression and {\sc arima}(0,1,1) and $50$ additional non informative predictions.  The blue line denotes the proposed method, the red line denotes the difference-in-differences, and green line denotes the Synthetic Control. }
\label{fig:plotsim_non_stat}
\end{figure}

\begin{figure}[!ht]
\centering
\includegraphics[scale=0.5]{./plots/plots_sim_2/comparison_100_10-eps-converted-to.pdf}
\caption{$T=100, p = 10$ Percentage of rejections of the null hypothesis of no treatment effects over $300$ repetitions. The x-axis reports the policy's effect rescaled by the outcome's standard deviation.  Synthetic learner has XGboost,Support Vector Regression and {\sc arima}(0,1,1) and $50$ additional non informative predictions.  The blue line denotes the proposed method, the red line denotes the difference-in-differences, and the green line denotes the Synthetic Control. }
\label{fig:plotsim100}
\end{figure}







 \subsubsection{Size Control}


 Next, we study the size of our procedure for $T \in \{60, 80\}$ and $T^* = T - T_0 \in \{5, 10, 20\}$, as we vary the post-treatment period from small to longer post-treatment period. These are reported in Table \ref{tab:size}. We observe that in a finite sample, for $T$ relatively small, our test controls size across all DGP, except DGP3 and DGP6, where we observe a small size distortion of five percentage points for a short post-treatment period ($T^* = 5$). These results provide suggestive evidence of the correct size of the proposed test also in a finite sample.




 \begin{table}[!htbp] \centering
  \caption{Size of the Synthetic Learner for $T \in \{60, 80\}$ and varying post-treatment period length $T^*$, for tests with size $5\%$. The first panel reports the size for $T = 60$ and the second panel for $T = 80$. }
  \label{tab:size}
\begin{tabular}{@{\extracolsep{5pt}} cccc|ccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
 & $T = 60$ &  & & $T  = 80$ &  &  \\
\hline \\[-1.8ex]
 & $T^*  = 5$ & $T^*  = 10$ & $T^*  = 20$ & $T^*  = 5$ & $T^*  = 10$ & $T^*  = 20$ \\
\hline \\[-1.8ex]
DGP1 & $0.087$ & $0.063$ & $0.037$ & $0.077$ & $0.063$ & $0.030$ \\
DGP2(a) & $0.037$ & $0.017$ & $0.023$ & $0.050$ & $0.053$ & $0.037$ \\
DGP2(b) & $0.053$ & $0.027$ & $0.013$ & $0.080$ & $0.080$ & $0.023$ \\
DGP2(c) & $0.063$ & $0.043$ & $0.033$ & $0.080$ & $0.070$ & $0.033$ \\
DGP3 & $0.090$ & $0.087$ & $0.050$ & $0.097$ & $0.060$ & $0.040$ \\
DGP4(a) & $0.060$ & $0.040$ & $0.027$ & $0.040$ & $0.063$ & $0.033$ \\
DGP4(b) & $0.067$ & $0.047$ & $0.040$ & $0.090$ & $0.053$ & $0.043$ \\
DGP4(c) & $0.080$ & $0.057$ & $0.037$ & $0.057$ & $0.067$ & $0.020$ \\
DGP5(a) & $0.073$ & $0.047$ & $0.020$ & $0.060$ & $0.077$ & $0.037$ \\
DGP5(b) & $0.050$ & $0.063$ & $0.027$ & $0.067$ & $0.043$ & $0.030$ \\
DGP5(c) & $0.103$ & $0.040$ & $0.020$ & $0.060$ & $0.057$ & $0.040$ \\
DGP6 & $0.090$ & $0.070$ & $0.090$ & $0.107$ & $0.067$ & $0.040$ \\
\hline \\[-1.8ex]
\end{tabular}
\end{table}

 \subsubsection{Oracle Study: Learners' performance}


In Table \ref{tab:oracle_base} we study the performance of the algorithm and each base algorithm for $T = 60, T - T_0 = 10$. Table \ref{tab:oracle_base} reports the power of each base algorithm and its corresponding weight assigned by the Synthetic Learner. We observe two striking facts: first, the largest weight is assigned to the best performing algorithm; second, the Synthetic Learner always performs approximately the same or \textit{better} than any base algorithm under consideration. This result suggests the benefits of the ensemble procedure: the procedure combines predictions of different methods to maximize prediction (and ultimately power) optimally. For the sake of brevity, we report results for two linear DGPs (DGP1 and DGP2) and two non-linear ones.





 \begin{table}[!htbp] \centering
  \caption{$T = 60, p = 10$. Power of the Synthetic Learner and of each base algorithm. In each panel, the first two columns report the power for $\alpha \in \{0.1, 0.3\}$, and the third column reports the assigned weight of the Synthetic Learner.  }
  \label{tab:oracle_base}
\begin{tabular}{@{\extracolsep{5pt}} cccc|ccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
 & DGP1\textcolor{white}{(a)} &  &  & DGP2(a) &  & \\
 & 0.1 & 0.3 & Weights & 0.1 & 0.3 & Weights\\
\hline \\[-1.8ex]
Synthetic Learner  & $0.070$ & $0.110$ & $$  & $0.210$ & $0.910$ & $$ \\
XGBoost& $0.030$ & $0.047$ & $0.153$ & $0.157$ & $0.823$ & $0.345$\\
SVM  & $0.040$ & $0.037$ & $0.044$  & $0.213$ & $0.910$ & $0.375$  \\
Arima & $0.060$ & $0.103$ & $0.803$ & $0.163$ & $0.693$ & $0.280$ \\
\hline \\[-1.8ex]
\end{tabular}
\begin{tabular}{@{\extracolsep{5pt}} cccc|ccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
 & DGP2(b) &  &  & DGP3\textcolor{white}{(a)}  &  &  \\
 & 0.1 & 0.3 & Weights & 0.1 & 0.3 & Weights \\
\hline \\[-1.8ex]
Synthetic Learner & $0.030$ & $0.036$ & $$ & $0.080$ & $0.143$ & $$ \\
XGBoost & $0.020$ & $0.023$ & $0.132$ & $0.053$ & $0.056$ & $0.217$ \\
SVM & $0.030$ & $0.033$ & $0.831$  & $0.057$ & $0.050$ & $0.091$ \\
Arima & $0.020$ & $0.026$ & $0.037$ & $0.057$ & $0.106$ & $0.693$ \\
\hline \\[-1.8ex]
\end{tabular}
\end{table}







   \subsubsection{Endogenous time of intervention}

   Next, we study the problem in the presence of an endogenous time of the treatment.
   In Figure \ref{fig:plotsim2d} we report a representative set of results under the endogenous time of the treatment, where we simulate
   $$
   T_0 = 280 + \min\{50, 1 + (\exp(1/\lambda) - 1/\lambda) \vee 1\}
   $$
where we choose $\lambda = |\sum_{j,t} X_{j,t}|$. The model follows a proportional hazard type model, similar to what is discussed in \cite{shaikh2019randomization}, centered on $T_0 = 281$, with the time of treatment depending on other units' outcomes and constrained between $281$ and $320$.  Figure \ref{fig:plotsim2d} collects results with an endogenous time of treatment when critical quantiles are estimated via resampling, where the confidence intervals for the Synthetic Control and DiD are constructed using the permutation-based method in \cite{chernozhukov2017exact}. Results are consistent with the case of an exogenous treatment timing.













\begin{figure}[!ht]
\spacingset{1}
\centering


\includegraphics[scale = 0.4]{./plots/plots_sim_2/myplot_endogenous-eps-converted-to.pdf}

 \caption{Percentage of rejections   over $500$ repetitions with $T=400$, $T_0=280$, $p=50$ and $T_-=140$ when the critical quantile is estimated via resampling and the time of treatment is \textit{endogenous}. The x-axis reports the policy's effect rescaled by the outcome's standard deviation.
  } \label{fig:plotsim2d}
 \end{figure}


\subsubsection{Variability in the quality of the learners}

Next, we study the variability of the proposed method concerning the number and quality of learners included in learners' classes. We consider four different variations of the Synthetic Learner: Exponential and  Least Squares weighting with $10$ and $100$ new non-informative learners. To guarantee the feasibility of the optimization problem given a large number of learners, we consider a large $T = 300$.
Figure
  \ref{fig:plotsim3} contains the results. There we observe that many non-informative learners do little to nothing to the proposed Synthetic Learner. In sharp contrast, Least Squares' weighting suffers a substantial loss in power when the number of non-informative learners is increased.




\begin{figure} [!ht]
\spacingset{1}
\centering

\includegraphics[scale=0.5]{./plots/plots_sim_2/exp_vs_ls_all-eps-converted-to.pdf}
		\caption{Percentage of rejections of null hypothesis $H_0$ over $500$ repetitions with $T=300$, $T_0=280$, $J=50$ and $T_-=140, p = 50$. The x-axis reports the policy's effect rescaled by the outcome's standard deviation. As base learner we consider XGboost, Support Vector Regression, {\sc arima}(0,1,1) and either $100$ or $10$ additional non informative learners(NIL). We denote exp SL as the Synthetic Learner using exponential weights and LS SL as the Synthetic Learner using Least Squares weights.
   } \label{fig:plotsim3}
\end{figure}











\subsubsection{Bootstrap vs permutations}

We compare the performance of the circular bootstrap against permutations proposed in \cite{chernozhukov2017exact}. We consider only one learner: OLS. We compute the OLS coefficient for the bootstrap method using only the first $T_0/2$ observations, and we bootstrap the remaining ones. We estimate the full sample's coefficient for the permutation method after imposing the null hypothesis of no effect. We consider  the  true effect is either $\alpha_t = 0.2$ or $\alpha_t = 0.3$. We vary $T \in \{60, 80\}$ and we consider $T - T_0 = 10$.  Results are collected in Table \ref{tab:perm_vs_boot}.
For the non-linear design, we mostly observe significant improvements in power, up to approximately fifty percentage points. Only for a few designs we observe comparable performances or slightly inferior by one to three percentage points.










\begin{table}[!htbp]
\spacingset{1}
\centering
  \caption{We compare the percentage of rejection of the sharp null hypothesis $\alpha_t^o = 0$ over 300 replications. We use the bootstrap method, while rejections via permutations are presented in the parenthesis. We predict the counterfactuals only using Least Squares. $\alpha$ denote the true policy effect.  $T_0 = T - 10$.
  }
  \label{tab:perm_vs_boot}
\begin{tabular}{@{\extracolsep{0pt}} ccc|cccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
    &  $T = 80$ & & $T = 60$ &  & \\
      &$\alpha=0.2$ & $\alpha=0.3$ & $\alpha=0.2$ & $\alpha=0.3$  \\
\hline \\[-1.8ex]
DGP1    & $0.090(0.040)$ & $0.107(0.067)$ & $0.073(0.037)$ & $0.057(0.060)$  \\
DGP2(a)  & $0.697(0.507)$ & $0.940(0.793)$  & $0.420(0.317)$ & $0.747(0.667)$\\
DGP2(b)  & $0.030(0.067)$ & $0.040(0.087)$ & $0.040(0.047)$ & $0.030(0.070)$  \\
DGP2(c)  & $0.690(0.167)$ & $0.833(0.303)$ & $0.430(0.177)$ & $0.567(0.253)$ \\
DGP3    &$0.033(0.050)$ & $0.047(0.023)$ & $0.030(0.027)$ & $0.037(0.053)$ \\
DGP4(a) &  $0.143(0.087)$ & $0.300(0.280)$ & $0.113(0.107)$ & $0.213(0.203)$\\
DGP4(b) &  $0.070(0.040)$ & $0.090(0.077)$ & $0.043(0.053)$ & $0.063(0.037)$ \\
DGP4(c) &  $0.180(0.063)$ & $0.297(0.173)$ & $0.110(0.080)$ & $0.230(0.187)$ \\
DGP5 & $0.113(0.077)$ & $0.167(0.133)$ & $0.057(0.050)$ & $0.127(0.057)$ \\
DGP6 & $0.027(0.060)$ & $0.057(0.060)$ & $0.033(0.027)$ & $0.047(0.067)$ \\
\hline \\[-1.8ex]
\end{tabular}



\end{table}




















\section{The Effect of Public Health Insurance Ineligibility on Access to Medical Care} \label{sec:real}


Understanding the effect of public health insurance coverage on health care access is a major concern in health economics \citep{kolstad2012impact, long2009another, baicker2013oregon, anderson2012effect, garthwaite2014public}.

The TennCare dis-enrollment program represents the largest reduction in public health insurance coverage ever experienced in the US. Between 2005 and 2006, approximately 170,000 individuals lost public health insurance coverage. Most of these individuals were childless adults who gained public health insurance coverage approximately ten years before, in 1994, during the Medicaid program expansion in Tennessee. In this section, we study the effect of the reform over childless adults on delayed medical care access due to medical costs. This population is of particular interest since most of the Affordable Care Act expansions target childless adults.
\cite{tello2016effects} estimates that the TennCare dis-enrollment significantly decreased the likelihood of having health insurance between 2 and 5 percent.
The author estimates an increase of between two and three percentage points in the probability of not going to a medical center when sick.\footnote{The reader might refer to Panel C, Table 5 in \cite{tello2016effects}.}
Our analysis provides supportive evidence for the claim, with positive effects ranging between one and five percentage points but with higher uncertainty in the absence of stationary. Details are discussed in the following lines.





\subsection{Data}

We use BFRSS data\footnote{  Behavioral Risk Factor Surveillance System Data: \href{url}{https://www.cdc.gov/brfss/annual\_data/annual\_data.htm}.} to investigate the effect of the reform on the percentage of people who cannot afford healthcare expenses for medical costs. BFRSS is a national survey that has been continuously run over the years since 1984. The survey contains individual-specific information, including residence, state of health, access to health coverage, and others. The survey is run on a rolling basis, and the dataset can be organized as a long sequence of monthly and quarterly observations since we can cluster observations by the date of the interview. On average, we observe $150$ childless adults between $18$ and $64$ years old in Tennessee per month from $2017$ to $1993$. To overcome survey variability, we aggregate data at a \textit{quarter} level. The outcome variable is the percentage of childless adults who answered yes to the following survey question:``Was there a time in the past 12 months when you needed to see a doctor but could not because of the cost?''.






\begin{figure}[!ht]
\centering
\includegraphics[scale=0.5]{./plots/empirical_application_bfrss/Box_plot_Stat.jpeg}
\caption{Sample distribution of childless adults between $18$ and $64$ years old in Tennessee, the Southern States, and the US who were not able to afford health care expenses (left panel) and who are covered by health insurance (right panel). BFRSS data.
 }
\label{fig:boxplotstat}
\end{figure}



\begin{figure}[!ht]
\spacingset{1}
\centering
\includegraphics[height=5cm,width=12cm]{./plots/Smoothed_Childless_MEdcost_v2.jpeg}
\caption{BRFFS data. Percentage of adults in Tennessee (treated unit, red) and  Southern States (control, blue) who could not afford health care from January $1993$ to December $2017$.
} \label{fig:appl1}
\end{figure}









In Figure \ref{fig:boxplotstat}, we report the distribution of respondents who were not able to afford medical costs in the past $12$ months(left panel) and who are covered by health insurance\footnote{For the latter questions, we count the number of individuals who answer yes to the question: ``Do you have any kind of health care coverage, including health insurance, prepaid plans such as HMOs, or government plans such as Medicare or Indian Health Service?'' We consider observations who answer ``I do not know'' as not having a plan.}(right panel), after clustering over the period $1993$-$2005$, $2006$-$2012$ and $2013$-$2017$ for Tennessee, other Southern States, and the United States.
We observe a shift in the mean of Tennessee's outcome over these three periods, with a larger shift in the period just after the policy, between $2006$ and $2012$, while the variance remains approximately stable.

To check for stationarity of observed time-series, we test for unit roots at $95\%$ confidence level. We reject the null hypothesis of a unit root in the time series of interest displayed in Figure \ref{fig:appl1}.\footnote{We use an Augmented Dickey-Fuller test, with constant and without time trend, and include one, two,  or three lags. P-values are respectively $<0.01$ for the first two tests and $0.05$ for the latter.} However, we warn the reader that a lack of stationarity or confounders may invalidate the analysis. To accommodate failures of stationarity in the presence of time-varying fixed effects, we consider two alternative estimators with and without fixed effects adjustments, as discussed in the following subsection.












\subsection{Estimation}

As proposed in the Synthetic Control literature \citep{abadie2010synthetic}, we impute the potential outcome under no dis-enrollment using a set of control variables in the other states.
The starting date of the treatment corresponds to the second half of $2005$.\footnote{The overall dis-enrollment started in July 2005, and it lasted until June 2006. Most childless adults who dis-enrolled during this period were not able to requalify for Medicare \citep{garthwaite2014public}.}

While the dis-enrollment program may be mostly attributable to an exogenous budget deficit \citep{argys2017losing}, the series may still be affected by confounding sources over the period study, one of which is Obamacare's launch in $2014$.\footnote{The Affordable Health Care Act, also known as Obama Care, was officially approved in $2010$, but the major change entered into force in $2014$.}
To control for potential confounders related to Obamacare, we consider as the post-treatment period the series until $t = 2014$, while we replicate the analysis also including periods until $2017$ in Appendix \ref{sec:a_emp}. The selection into Obamacare from the states may reflect structural differences among different states. Motivated by this observation,
we use a pool of control units only those Southern States that, similarly to Tennessee, did not expand Medicaid between $2010$ and $2014$, namely South and North Carolina, Mississippi, Alabama, Florida, and Georgia. In the Appendix, we replicate the analysis with all the states.






We construct the ``Synthetic Control'' using the Synthetic Learner described in the current paper. We consider the share of individuals in other countries who could not afford necessary health care expenses as control variables. To allow for time-varying fixed effects, we consider two variations of the Synthetic Learner, with and without fixed effects adjustments (see Section \ref{sec:time_fixed}). We refer to the Synthetic Learner with fixed effect adjustment as ``Demeaned Synthetic Learner" and SL otherwise.





 We train Random Forest, Lasso, and a Factor model\footnote{To guarantee the validity of the algorithm through the sample splitting procedure, the factor model consists of estimating the principal component over the training period, regressing the principal component on the control states over the training period and making counterfactual predictions using the predicted factor on the remaining periods.}, and Diff-in-Diff mean proxy as discussed in \cite{doudchenko2016balancing} as base predictors.






Random Forest also contains additional covariates, such as the employment level in each state. Hyperparameters for the base predictors are chosen via cross-validation within the sample used to train such predictors. We construct weights with a tuning parameter $\eta = \frac{1}{\sqrt{T} \mathrm{Var}(Y_t)}$ where the rescaling by the variance guarantees that the estimated weights are scale-invariant.\footnote{Since the loss is the squared loss, by rescaling by the variance we have losses of the form $(Y_t - \hat{Y}_t)^2/\mathrm{Var}(Y_t) = (Y_t/\mathrm{SD}(Y_t) - \hat{Y}_t/\mathrm{SD}(Y_t))^2 $ which are unit free in the outcome's unit. We rescale by $1/\sqrt{T}$ following the theoretical results of predictions. In the Appendix, we report results also after choosing different rescaling. } In Appendix \ref{sec:a_emp}, we show the robustness of our results for several other choices of $\eta$. We consider two alternative sample splitting rules. First, observations between $1998$ and $2006$ are used to train the algorithms; observations between $1993$ and $1997$ are used to compute the weights and bootstrap. Second, the reverse is considered, where the training occurs over the earliest pre-treatment period. Observations from January $2006$ onwards are used to compute the test statistic.







\subsection{Results}




In Table \ref{table:effect1} we report the estimated test statistic for testing the null hypothesis of no effect, namely $H_0: Y_{0t}^1 - Y_{0t}^0 = 0, \  t > T_0$, over the post-treatment period 2010-2014.  The table reports the critical quantiles, the test statistic, and the estimated ATT when predictors are trained on the period closest to the post-treatment period (Period 1) or an earlier period (Period 2).
The ATT oscillates between one and four percentage points, and its sign remains robust throughout all the setups considered.
Significant effects are detected when training predictors on Period 1 for the test with a size of ten percent for Synthetic Learner.
 When estimating treatment effects by training the predictors more distant from the treatment timing (Period 2), results become non-significant, possibly reflecting higher uncertainty. Similarly, when we consider the adjustment for fixed effects, we observe p-values close to or larger than twenty percent, suggesting higher uncertainty for this case.



The Synthetic Learner predicts an effect larger than Lasso's one but smaller than a factor model. The reader may refer to the Appendix for further details.  In Appendix \ref{sec:a_emp}, we report results over the period 2010-2017, showing attenuated results over the time window 2010-2017.





\begin{table}[!htbp] \centering
  \caption{ $90\%$ and $80\%$ critical values, t-statistic, and ATT using the southern states as controls. The effect estimated is over the time window 2010-2014 (first row), and consecutive windows 2011-2014 ($m = 1yr$), 2012-2014 ($m = 2yr$), 2013-2014 ($m = 3yr$).  Period 1 collects results when learners are estimated using the window between $1998$-$2006$, and weights are estimated over the period $1993$-$1997$. Period 2 corresponds to the opposite scenario. Demeaned SL denotes the SL with time-varying fixed effects.}
  \label{table:effect1}
\begin{tabular}{@{\extracolsep{5pt}} ccccc|cccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
Period 1 & SL &  & & & Demeaned SL &  &  &  \\
 & CV90 & CV80 & t stat & ATT & CV90 & CV80 & t stat & ATT \\
\hline \\[-1.8ex]
m = 0 & $1.332$ & $1.249$ & $1.354$ & $1.844$ & $0.903$ & $0.846$ & $0.836$ & $0.994$ \\
m = 1yr & $1.261$ & $1.176$ & $1.281$ & $1.998$ & $0.794$ & $0.745$ & $0.729$ & $1.060$ \\
m = 2yr & $1.217$ & $1.133$ & $1.273$ & $2.166$ & $0.758$ & $0.711$ & $0.696$ & $1.104$ \\
m = 3yr & $1.160$ & $1.070$ & $1.229$ & $2.253$ & $0.714$ & $0.664$ & $0.651$ & $1.096$ \\
\hline \\[-1.8ex]
Period 2 & SL &  & & & Demeaned SL &  &  &  \\
 & CV90 & CV80 & t stat & ATT & CV90 & CV80 & t stat & ATT \\
\hline \\[-1.8ex]
m = 0 & $1.264$ & $1.173$ & $0.691$ & $5.223$ & $0.519$ & $0.471$ & $0.243$ & $3.137$ \\
m = 1yr & $1.211$ & $1.118$ & $0.622$ & $5.362$ & $0.460$ & $0.415$ & $0.163$ & $3.142$ \\
m = 2yr & $1.189$ & $1.100$ & $0.625$ & $5.516$ & $0.453$ & $0.407$ & $0.154$ & $3.202$ \\
m = 3yr & $1.154$ & $1.060$ & $0.611$ & $5.587$ & $0.450$ & $0.404$ & $0.149$ & $3.197$ \\
\hline \\[-1.8ex]
\end{tabular}
\end{table}


    In Table \ref{tab:weights} we collect the weights assigned to each base-algorithm. We observe that the Synthetic Learner assigns a larger weight to Lasso
in the absence of fixed effects, and a larger weight to Random Forest in the presence of fixed effects.


\begin{table}[!htbp] \centering
  \caption{Weights estimated by the Synthetic Learner and by the Synthetic Learner after subtracting the control's mean to allow for fixed effects over Period 1.}
  \label{tab:weights}
\begin{tabular}{@{\extracolsep{5pt}} ccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
 & Synthetic Learner & Demeaned Synthetic Learner \\
\hline \\[-1.8ex]
Factor & $0.242$ & $0.202$ \\
CV Lasso & $0.298$ & $0.253$ \\
Random Forest & $0.243$ & $0.295$ \\
DID & $0.217$ & $0.251$ \\
\hline \\[-1.8ex]
\end{tabular}
\end{table}


















     In Figure \ref{fig:placebo}, we report the test statistics and the acceptance region for Tennessee and for placebo tests performed on the other Southern States that did not adopt Medicaid expansion. A placebo test consists of testing a policy's effect from $2006$ to $2014$ in a state different from Tennessee. Since none of the other Southern States had significant changes in the Medicaid system, we would expect no rejections for all Southern States except Tennessee. This is shown in Figure \ref{fig:placebo}. We observe that we do not reject the null hypothesis when using only the simple DiD method, potentially due to the underpowered test. This result is consistent with what we observed in simulations, where the synthetic learner outperformed other methods in terms of power.







\begin{figure}[!ht]
\centering
\includegraphics[scale=0.3]{./plots/Placebo_test1.jpeg}
\includegraphics[scale=0.3]{./plots/Placebo_test2.jpeg}
\caption{We test significant changes in the percentage of childless adults who are not able to afford medical expenses in those Southern states that did not adopt Medicaid Obamacare. We report the test statistic (red dot) and $90\%$ confidence region for each of the states, including Tennessee, over Period 1. Left-panel reports the test when using Synthetic Learner. Right panel when only using Difference in Differences to predict the counterfactual. } \label{fig:placebo}
\end{figure}



\subsection{Discussion: Assumptions and Possible Sources of Confounding}

We conclude this section with a discussion on the assumptions and possible sources of confounding. The Tennessee dis-enrollment program was a result of a budget deficit. Whenever the budget deficit was due to an exogenous variation \citep{argys2017losing}, the variation in state-level Medicaid expenses can be interpreted as exogenous to childless adults' financial status validating the exogeneity of the treatment timing. In this scenario, the ATT estimator is a consistent estimator of the underlying treatment effect. However, this condition may not necessarily hold. For instance, the budget deficit may be attributed to the increase in Medicaid expenses in previous years \citep{garthwaite2014public}, which may itself depend on individuals' past average income. In such a case, exogeneity may be replaced by conditional exogeneity given the past filtration without violating the prediction guarantees of the proposed algorithm.

The results of our testing procedure should instead be interpreted as conditional on the treatment assignment mechanism, similar to what is discussed in \cite{ferman2016revisiting}. Here, the assumption of stationarity may fail if, for example, spillover effects of the dis-enrollment program occur over adjacent states, therefore changing the distribution of control units (see the discussion in Appendix \ref{sec:aa1}). While the study of Synthetic controls under spillovers goes beyond this paper's scope, we observe that in this scenario, it may be necessary to estimate counterfactuals also on the other states, which may be affected by the policy intervention.

Confounding may also result from other events, such as the 1996 Clinton welfare reform and the great depression. In the former case, although the reform in Tennessee was targeted at families with children (so-called Family First policies\footnote{The reader may refer to \url{https://haslam.utk.edu/sites/default/files/ffoct00.pdf}.}), which are excluded from our analysis, it may act as a confounder in our analysis in the presence of general equilibrium effects. Time-fixed effects can (partially) accommodate for these cases \textit{if} the confounder affects the mean only, and the effect is homogenous across the states considered in our analysis. These restrictions motivate studies that focus on sets of control units most similar to the treated, which, in our case, correspond to a subset of Southern States.











 \section{Extension: Carry-over Effects} \label{sec:carryover}

 In many applications, treatment effects may carry over in time \citep{imai2021use}. Here we extend the proposed framework to carry-over effects as follows.  We consider binary treatment and  denote the treatment path up to time $t$ as a vector $\mathbf{d} _{1:t}\in \{0,1\}^{t}$.
 Following the potential outcomes framework, we then
posit the existence of potential outcomes $\tilde{Y}_{0t}(\mathbf{d}_{1:t})$,
corresponding respectively to the
response the  treated subject would have experienced  at time $t$  while being exposed to the treatment
assignment contained in the treatment path $\mathbf{d}_{1:t}$.
Formulating treatments and potential outcomes as paths were introduced initially by \cite{robins1986new}.


   Notation implicitly assumes no lead effects \citep{athey2018design}. Also, we require that the realizations of potential outcomes do not depend on past $m$ lags or more. Using the same notation as in \cite{rambachan2019nonparametric}, for   $t \in \{T_-,  \dots ,0, 1,  \dots , T_0, \dots, T\}$  we assume throughout the rest of this paper that the following holds.
\begin{ass}[Finite carry-over]
For all $\mathbf{d}_{T_-:t}$, $\tilde{Y}_{0t}(\mathbf{d}_{T_-:t}) = Y_{0t}(\mathbf{d}_t, \cdots, \mathbf{d}_{t-m})$, for some function $Y_{0t}(\cdot)$
\end{ass}
The assumption explicitely defines carry-over effects of size $m$. The no-anticipation assumption has been previously discussed in \cite{abbring2007econometric}, \cite{athey2018design}, while the restricted carryover effect is analogous to the identification assumption stated in \cite{imai2018matching}, \cite{bojinov2018time}, \cite{blackwell2018make} among others.  The estimand of interest is now defined as follows
$$
\mathbb{E}\Big[Y_{0t}(\mathbf{1}) - Y_{0t}(\mathbf{0})\Big], \quad t > T_0 + m
$$
   which denotes the (long-run) ATT, comparing two policies always and never implemented.

   The key idea in this setting consists in estimating treatment effects after removing the $m$ lag components. Formally, we construct an ATT estimator of the form
   \begin{equation}
 \widehat{ATT}_m = {(T - T_0)}^{-1} \sum_{t > T_0 + m}  (Y_{0t}^1 -\hat Y_{0t} ^0 ) - (T_0/2)^{-1}\sum_{t = T_0/2 +1}^{T_0} (Y_{0t}^0 - \hat Y_{0t, -1} ^0 )
   \end{equation}
   where the estimator averages after $m$ periods that the policy has been implemented. Our testing procedure remains invariant (and valid) after removing the periods $t \in \{T_0, \cdots, T_0 + m\}$.


 \begin{exmp}[Why considering carry-overs?]   Wrongly assuming the absence of carry-over effects can lead to misspecified causal estimands and hence possibly biased estimates.
  For example, consider a simple case
\begin{equation} \label{exmp:3}
Y_t(\mathbf{d}_{(t-m):t}) = Y_t(\mathbf{0}) + \sum_{s=0}^m \alpha_{s+1} d_{t-s} \quad \Rightarrow \quad  Y_t(\mathbf{1}) - Y_t(\mathbf{0}) = \sum_{s=0}^m \alpha_{s+1} d_{t-s},
\end{equation}
  for a sequence of constants  $\alpha_{s} \in \mathbb{R}$. The naive ATE estimate, defined as a difference between pre- and post-treatment  averages is possibly biased. In fact, it's mean  equal
$
 |T - T_0|^{-1} {\sum_{s=0}^{m-1} (m - s) \alpha_{s+1}}{} + \sum_{s=0}^m \alpha_{s},
$
where $ |T - T_0|^{-1} {\sum_{s=0}^{m-1} (m - s) \alpha_{s+1}}{}$ defines its bias. \qed
\end{exmp}









\section{Discussion}


In this paper, we have introduced a novel strategy for estimating treatment effects and testing the null hypothesis of interest in the presence of time-dependent observations. We developed a novel algorithm, denoted as Synthetic Learner, that predicts the counterfactual building on multiple regression methods. Our framework provides a starting point for performing estimation and inference, which is valid regardless of the class of models under consideration.

The presence of one single treated unit at a given time of adopting the policy brings substantial challenges from an identification perspective. We considered three scenarios of interest. First, (i) the adoption date is deterministic, $T_0$ and fixed treatment effects similarly to \cite{chernozhukov2017exact}, \cite{chernozhukov2018t}, \cite{arkhangelsky2019synthetic} among others.
We show that, under stationarity and mixing conditions, our algorithm controls the nominal size regardless of the class of base algorithm under consideration, even in the presence of misspecification bias. Extending this result to non-deterministic $T_0$ is conceptually feasible in the presence of multiple units treated at different points in time.
(ii) We consider a random and exogenous time of treatment, and under stationarity assumptions, we show that the estimator for the average treatment effect is consistent under weak assumptions, letting $T_0$ be non-deterministic. Finally, (iii) we let the treatment time be \textit{sequentially} exogenous, without assuming any stationarity condition. We provide bounds on the predictive performance under this complex scenario.
Our paper also opens new questions on constructing valid machine learning methods for causal inference when units exhibit dependence. We leave it to future research its study for inference on conditional average treatment effects under heterogeneous effects and endogenous treatment time.





\bibliography{mybibliography2}
\bibliographystyle{chicago}

\newpage