# Causal inference for N-of-1 trials

Marco Piccininni  Digital Health - Machine Learning Research Group, Hasso
Plattner Institute for Digital Engineering, Potsdam, Germany  Digital
Engineering Faculty, University of Potsdam, Potsdam, Germany  Mats J. Stensrud
Department of Mathematics, Ecole Polytechnique Fédérale de Lausanne, Lausanne,
Switzerland
Zachary Shahn  CUNY School of Public Health, New York, New York, USA  Stefan
Konigorski  Digital Health - Machine Learning Research Group, Hasso Plattner
Institute for Digital Engineering, Potsdam, Germany  Digital Engineering
Faculty, University of Potsdam, Potsdam, Germany

###### Abstract

The aim of personalized medicine is to tailor treatment decisions to
individuals’ characteristics. N-of-1 trials are within-person crossover trials
that hold the promise of targeting individual-specific effects. While the idea
behind N-of-1 trials might seem simple, analyzing and interpreting N-of-1
trials is not straightforward. In particular, there exists confusion about the
role of randomization in this design, the (implicit) target estimand, and the
need for covariate adjustment. Here we ground N-of-1 trials in a formal causal
inference framework and formalize intuitive claims from the N-of-1 trial
literature. We focus on causal inference from a single N-of-1 trial and define
a conditional average treatment effect (CATE) that represents a target in this
setting, which we call the U-CATE. We discuss the assumptions sufficient for
identification and estimation of the U-CATE under different causal models in
which the treatment schedule is assigned at baseline. A simple mean difference
is shown to be an unbiased, asymptotically normal estimator of the U-CATE in
simple settings, such as when participants have stable conditions (e.g.,
chronic pain) and interventions have effects limited in time (no carryover).
We also consider settings where carryover effects, trends over time, time-
varying common causes of the outcome, and outcome-outcome effects are present.
In these more complex settings, we show that a time-varying g-formula
identifies the U-CATE under explicit assumptions. Finally, we analyze data
from N-of-1 trials about acne symptoms. Using this example, we show how
different assumptions about the underlying data generating process can lead to
different analytical strategies in N-of-1 trials.

##  1 Introduction

The conventional causal estimand in parallel-group randomized control trials
(RCTs) is the “average causal effect” in a given population [1, 2]. Recent
interest in “personalized” medicine, however, has challenged the reliance on
conventional RCTs for identifying clinically relevant causal effects [3].
Individuals might respond differently to treatment or have different treatment
preferences [3, 4]. Thus, only knowing that a treatment is effective “on
average” in a given population is insufficient to fully inform a personalized
treatment decision [5, 6]. In some cases no RCT is available [6, 7], the
patient of interest does not even fulfill the eligibility criteria of the
available published RCTs [6, 7, 8, 9], or the treatment effect is highly
heterogeneous (and therefore the RCT results may be not of direct use) [6, 8,
9, 10, 11].

N-of-1 trials have been proposed as an alternative design to advance
personalized medicine [3, 4]. These trials, which are also called single-case
experimental designs [6, 12] or self-controlled experiments [10], aim at
assessing the response to an intervention in a specific individual [3, 5, 6,
11]. The key feature of this design is that the same individual receives the
treatment and the comparator in designated, sequential time periods. N-of-1
trials are “within-patient, randomized, double-blind, cross-over comparisons
of a treatment with either placebo or another treatment” [13]. While there are
other definitions of N-of-1 trials, the typical N-of-1 trial is characterized
by a multiple crossover design, multiple measurements of the outcome over
time, random allocation of the treatment sequence, and blinding [6, 3, 11,
13]. The outcome is frequently chosen to be directly relevant to the specific
patient’s well-being [6, 9].

Although N-of-1 trials require careful methodological and ethical
considerations and are not universally suitable for all treatments and
outcomes [12, 3, 8, 10, 6], they have the potential of allowing identification
of individual-level rather than population-level causal effects [4].
Therefore, N-of-1 trials hold the promise of going beyond clinical decision
making informed by effect estimates for the “average patient” [14, 10, 11, 7,
5, 9]. Results of a single N-of-1 trial may not generalize beyond the
individual that is studied [6, 8, 4], but series of N-of-1 trials of distinct
individuals can be aggregated and analyzed together to yield efficient
estimates of population average treatment effects [3, 8]. These aggregated
N-of-1 trial results have been informally shown to converge towards the
results of a multi-crossover RCT [6] or a parallel-group RCT [7, 15].

The basic idea behind an N-of-1 trial is far from new. Clinicians routinely
assign their patients to different therapies sequentially to evaluate
individual responses [8, 6, 13, 9, 16]. However, such “trials of therapies”
with unstructured pre-post comparison of treatment responses have been shown
to be prone to both false positive and false negative results due to placebo
effects, desire to please, and natural courses of diseases [6, 8, 13, 9, 16].
In 1986, Guyatt et al. [6] argued for the N-of-1 randomized trial as a
solution to address the validity concerns of uncontrolled individualized
trials of therapy and the impossibility of applying RCT results to specific
individuals; that is, N-of-1 trials can be thought of as more rigorous
versions of the common clinical strategy of sequentially trying different
treatments in the same individual [13, 9]. Similar study designs have been
used for decades in experimental psychology to study behavioral interventions
[6, 12, 17, 9], where units are assigned to different interventions over time.
The recent emergence of new technologies to automate data collection, such as
mobile electronic health devices, wearables, and cell-phone-based diaries, has
renewed interest in N-of-1 trials [4, 8] and their integration into the
healthcare ecosystem [18].

While the idea behind N-of-1 trials might appear to be simple, these trials
need to be analyzed and interpreted with care. In this article, we use a
formal causal inference framework to clarify some of the methodological
subtleties. In particular, N-of-1 trials are often interpreted as one-person
RCTs and confusion frequently arises around the concepts of confounding and
the guarantees given by randomization in this study design. For example, it
has been claimed that N-of-1 trials “do not generally require causal inference
methods” if treatment is randomized [19, 20]. Some work has characterized
randomization as a way to eliminate confounding due to autocorrelation and
carryover effects [19, 20], while other work has highlighted the need to
account for autocorrelation and carryover effects even in randomized N-of-1
trials [21]. Randomization in N-of-1 trials has also been described as a way
to balance time-varying confounding factors [22, 23], or as a way to minimize
confounding and selection bias [22]. Confusion about the foundation of the
study design may result in suboptimal data analysis strategies, and misleading
interpretation of the results.

###  1.1 Aim

The aim of this work is to present an explicit causal framework for N-of-1
trials and formalize intuitive claims from the N-of-1 trial literature. We
will define causal estimands for this study design and discuss the assumptions
needed for their identification under different data generating mechanisms.
This, in turn, motivates estimators.

We focus on inference from single N-of-1 trials, i.e., when only data from a
crossover trial conducted in one individual are available. We will
specifically focus on designs where the participant receives treatment
according to a treatment schedule that is assigned at the beginning of the
study and repeats itself cyclically over time, as these designs are common in
practice [24, 25]. Nevertheless, we will show in Section 3.1 how our data
generating process accommodates other designs for randomized N-of-1 trials in
finite time, and discuss aggregation of results from series of N-of-1 trials
in Section 12.

###  1.2 Related work

Beyond the classical literature on N-of-1 trials [26], which does not
explicitly consider a causal framework, our work is related to previous
research in causal inference. Robins et al. [27] discussed identification of
the subject-specific causal effect in an observational setting with time-
varying exposure, confounders, and outcome measurements. They formalized the
subject-specific effect as a conditional effect, where the conditioning is on
a potentially unobserved and high dimensional subject-specific baseline
variable. Assuming correct model specification and a form of stationarity
given the baseline covariate, they observed that g-computation can be used to
consistently estimate subject-specific treatment effects as observation time
increases [27].

Relying on a similar idea, Daza later proposed a counterfactual methodology
specifically for N-of-1 trials [28]. He discussed causal effect estimation in
settings with autocorrelation of outcome measurements, carryover effects,
presence of trends and confounding [28]. He leveraged the assumption of
regularity over time (i.e., some stationarity assumptions) for the
identification of the causal effects [28, 19] and suggested g-computation and
inverse probability of treatment weighting for estimation [28, 19]. We
consider a different causal estimand from the one proposed by Daza (see
Section 4), and rely on different identification arguments to justify our
results.

In 2016, Neto et al. [29] developed an instrumental variable approach to
estimate causal effects in N-of-1 randomized trials with imperfect compliance.
The authors described their assumptions about the data generating process
using directed acyclic graphs (DAGs), and relied on some stationarity
assumptions. They proved identifiability of the causal effect in a sequential
randomized experiment under additivity assumptions, assuming that the causal
effect was constant over time. More recently, Qu et al. [30] developed an
alternative two-stage Bayesian latent structural model approach for the same
purpose, using study treatment randomization as an instrumental variable and
assuming randomization only at the beginning of the treatment periods. In our
work, we do not require strong parametric assumptions for identifiability, and
rely on a frequentist framework for the inference. However, we do not
specifically address issues with non-compliance, which could be an extension
in future work.

Our work is also related to the broader field of causal inference for time
series data, see, e.g., Runge et al. 2023 [31] and Eichler and Didelez 2009
[32]. Particularly important is the work from Bojinov and Shephard [33], who,
relying on randomization-based inference, defined estimators for a class of
causal estimands in the setting of time series experiments in which the
treatment is randomized at each time point. More recently, also based on
randomization inference, Malenica et al. discussed anytime-valid inference in
N-of-1 trials [34], while Liang and Recht [35] discussed identification and
estimation of causal effects in N-of-1 trials. Liang and Recht assumed a
linear time-invariant outcome model to identify causal effects when a very
long carryover of the treatment is expected. Unlike Liang and Recht [35], we
do not invoke specific functional relationships for identifiability and do not
present identification results for scenarios where the full treatment history
affects directly the outcome at any given point. Furthermore, unlike Bojinov
and Shephard [33], Malenica et al. [34] and Liang and Recht [35], we do not
rely on randomization-based inference but on a superpopulation framework. We
do not require randomization at all times; we show that our results also hold
in absence of randomization.

Our work can also be seen as related to research in the field of reinforcement
learning that aims to adaptively learn optimal subject-specific policies [36,
37, 38]. Even though the aim of reinforcement learning agents is typically not
post-study inference, the problem of causal inference in N-of-1 trials can be
seen as a causal bandit [39, 40] problem. In recent years, different
algorithms have been proposed for adaptive designs of N-of-1 trials, which aim
at learning individual-specific effects while assigning study participants to
one intervention out of a set of available interventions [41, 42, 43].

##  2 Notation and terminology

We will use the term “N-of-1 trial” to refer to a single N-of-1 trial [44, 45]
and “series of N-of-1 trials” to refer to a situation where data from multiple
N-of-1 trials is available to the investigator [45, 46]. In this work we focus
on inference from data of a single individual (i.e., an N-of-1 trial).
Broadly, we consider individuals as i.i.d. draws from the same near-infinite
superpopulation. Therefore we will describe the data generating process
considering a sample of $i=1,...,n$ individuals with data collected at
$k=1,...,t$ time points, with $n\geq 1,t\geq 2$. We will use capital letters
to indicate random variables (e.g, $X$) and calligraphic letters to indicate
their domain ($\mathcal{X}$). Lowercase letters will indicate random variable
instantiations or constants. Subscripts will be used to indicate measurements
for an individual $i$ at time $k$ ($X_{i,k}$), but, to avoid clutter we will
omit the individual subscript from the random variables when it is
unambiguous. Superscripts will indicate counterfactuals (see Section 3.4). We
will use overlines to indicate the history of all measurements for the same
variable until time $k$ (i.e., $\bar{X}_{k}$), and use $\bar{X}$ to indicate
the full history $\bar{X}_{t}$. Notation $\bar{x}_{b}$ will indicate either a
vector of size $b$ with all elements equal to $x$, or, when specified, a
generic constant vector of size $b$.

In this article, we primarily consider a specific N-of-1 trial design where
the participant receives treatment according to a treatment schedule that is
assigned at the beginning of the study and repeats itself cyclically over
time. We use the term “treatment schedule” to indicate the treatment sequence
that repeats itself over time, and the term “cycle” to indicate the span of
time covered by one treatment schedule. The usage of these terms may differ in
other works on N-of-1 trials and guidelines [47].

##  3 Basic scenario

###  3.1 Treatment assignment mechanism

Let $q\geq 2$ represent the length of a cycle defined by the investigator and
$t\geq q$ be the length of the study. Let Z be a random vector indicating the
treatment schedule for an individual, containing $q$ binary elements
$Z_{1},...Z_{q}$ such that $\mathcal{Z}\subseteq\\{0,1\\}^{q}$. Let $A_{k}$ be
a binary variable that indicates whether the individual receives treatment
($A_{k}=1$) or control ($A_{k}=0$) at time $k$. We will assume that the
treatment status is determined by the state of Z according to the
deterministic function

$\begin{split}A_{k}=f^{A}(\textbf{Z},k)\hskip 20.0pt\text{ with}\hskip
10.0ptf^{A}(\textbf{Z},k)=Z_{((k-1)\text{ mod }q)+1}.\end{split}$ (1)

That is, $A_{k}$ is assigned to be the element of Z in position $((k-1)\text{
mod }q)+1$, with mod indicating the modulo operation. We consider Z to be an
exogenous random variable. We are, however, agnostic about the number of
possible treatment schedules, the sequence of the treatments, and the
probability distribution of Z. We assume that participants fully adhere to the
assigned treatment schedule until the end of the study and only consider
possible treatment schedules where both treatment and non-treatment are
assigned at least once

$\mathcal{Z}\subseteq\left\\{\textbf{z}={z_{1},...,z_{q}}\bigg{\rvert}0<\sum^{q}_{k=1}z_{k}<q\right\\}.$
(2)

To fix ideas, consider an investigator who designs a study with $t=6$ time
points, which could be a six day long trial with measurements once daily. They
choose to have $q=3$ time points in a cycle and to randomize the participant
to one of two possible treatment schedules from
$\mathcal{Z}=\\{\\{1,0,1\\},\\{0,1,0\\}\\}$. Suppose that a study participant
was randomized to the treatment schedule $\textbf{z}=\\{1,0,1\\}$, then their
treatment status during the study, determined by Equation (1), is
$\bar{a}=\\{1,0,1,1,0,1\\}$. Thus, the sequence of assigned treatments is
defined by iteratively repeating the elements of z until $t$ values are
produced. According to condition (2), schedules $\\{1,1,1\\}$ and
$\\{0,0,0\\}$ cannot be considered by the investigator. Equations (1) and (2)
might appear unnecessarily complex, but they describe a treatment assignment
strategy that is flexible enough to accommodate a wide range of designs for
randomized N-of-1 trials in finite time. In particular, this treatment
assignment strategy can represent, in finite time, any N-of-1 trial design in
which the treatment sequence is exogenous. Indeed, if $t$ is finite, setting
$q=t$ allows us to represent any treatment sequence of size $t$, except
sequences that assign an individual to be always treated or always non-
treated. In Table 1, we give examples of how commonly used N-of-1 designs can
be represented using our notation. The same design can be represented in
different ways depending on the chosen value for $q$, and we only report
configurations for the smallest possible value of $q$.

Table 1: Representation of examples of commonly employed N-of-1 designs. Description |  Design name in the N-of-1 trials literature |  Cycle length ($q$) |  Treatment schedule (Z) |  Study length ($t$)
---|---|---|---|---
7 days of no-treatment followed by 7 days of treatment |  AB |  14 |  $\\{\bar{0}_{7},\bar{1}_{7}\\}$ |  14
Alternate 7 days of no-treatment to 7 days of treatment for 4 weeks |  ABAB |  14 |  $\\{\bar{0}_{7},\bar{1}_{7}\\}$ |  28
10 days of no-treatment, 10 days of treatment, 10 days of no-treatment |  ABA |  20 |  $\\{\bar{0}_{10},\bar{1}_{10}\\}$ |  30
7 days of no-treatment, 14 days of treatment, 7 days of no-treatment |  ABBA |  21 |  $\\{\bar{0}_{7},\bar{1}_{14}\\}$ |  28
Randomize treatment every day for 2 weeks |  - |  14 |  uniformly drawn from $\\{0,1\\}^{14}$ |  14

###  3.2 Data generating mechanism for the outcome

We assume that the outcome $Y_{k}$ is measured at each $k$, and that $Y_{k}$
is generated according to the following structural equation

$\begin{split}Y_{k}=f^{Y}(A_{k},U,\varepsilon_{k}),\end{split}$ (3)

with $f^{Y}$ being a function that does not change across time. Further, $U$
represents an unmeasured exogenous random variable with distribution $F_{U}$,
and $\bar{\varepsilon}$ is a set of unmeasured i.i.d. variables drawn from a
distribution $F_{\varepsilon}$ that does not vary over time and has finite
variance $\sigma^{2}_{\varepsilon}$. Thus, we are assuming that the outcome
variable measured at time $k$ is fully determined by three quantities: 1) the
treatment received by the individual at time $k$, 2) the state of the variable
$U$ for the individual, and 3) the instance of the noise variable
$\varepsilon_{k}$ for the individual. In particular, we are excluding that
$\mathbf{Z}$ has a direct effect on $Y_{k}$ and that the states of $A_{k}$,
$Y_{k}$ and $\varepsilon_{k}$ have an effect on the outcome at a later point
in time. We will elaborate more on the interpretation and assumptions of this
causal model in the next section.

###  3.3 Interpretation of the causal model in equations (1)-(3)

In Sections 3.1 and 3.2, we relied on structural causal models to represent
our data generating process. The structural causal model framework was
inspired by Laplace’s quasi-deterministic conception of causality [1]. Laplace
considered the world to be deterministic, attributing observed “chance” to the
investigator’s ignorance [48]. In this work, we commit to this interpretation
and consider randomness as induced by the fact that certain variables are
unobserved [1]. This means that the outcome value at any time $Y_{k}$ can be
exactly derived if $f^{Y}$, $f^{A}$, and the determination of the exogenous
variables Z, $U$, and $\bar{\varepsilon}$ are known. While the meaning of the
treatment schedule Z is clear, interpreting the other exogenous variables
requires some care.

Consider the outcome variable $Y_{k}$ to be a health-related characteristic of
an individual (e.g., systolic blood pressure). The structural equation in (3)
implies that there are only three possible sources determining the outcome
state at time $k$: the treatment $A_{k}$ assigned at time $k$, an exogenous
variable $\varepsilon_{k}$ that affects only the outcome at time $k$, and an
exogenous variable $U$ that affects every measurement of the outcome during
the study. It may be convenient to think of $U$ as the set of characteristics
of the individual at the beginning of the trial that affect the outcome at all
time points. While some variables affecting the outcome at all time points are
usually measured at baseline (e.g., sex), the full set of variables comprising
$U$ is typically unknown or cannot be measured. Indeed, depending on what the
outcome of interest is, $U$ may acquire only few values (e.g., the
presence/absence of a genetic mutation), or have infinite support and
summarize every aspect of the individual’s existence (e.g., the state of every
single cell in the body). In this sense, $U$ can be informally interpreted as
an individual-specific variable, and it represents the source of effect
heterogeneity of the treatment. The variable $U$ is analogous to the $\sigma$
variable introduced by Robins et al. [27] to define the conditioning set of
their individual-specific causal effects. Indeed, when we conduct an N-of-1
trial, we consider only one individual and therefore we are implicitly
conditioning on a specific value of $U=u_{i}$. The variable $U$ will be
different depending on the specific study setting, and its composition will
have consequences on the plausibility of statistical assumptions and on the
transportability of the N-of-1 trial results, as we further consider in
Sections 5 and 11.

According to Equation (3), $U$ and $A_{k}$ are not necessarily sufficient to
perfectly predict the outcome. We are, indeed, allowing for the existence of
exogenous variables $\bar{\varepsilon}$ such that every $\varepsilon_{k}$ only
affects the outcome at time $k$. Suppose we let each $\varepsilon_{k}$ denote
the external factors at time $k$ that affect the outcome measurement at that
time. Consider an N-of-1 trial that includes an individual with hypertension,
where the outcome of interest is the effect of two different types of anti-
hypertensive treatments on systolic blood pressure. Because the study only
includes a single individual we can interpret all observations as conditioned
on $U=u_{i}$, that is, conditioned on all common causes of the outcome
measurements during the study. For example, $u_{i}$ may represent information
about demographics, systolic blood pressure before the start of the trial,
detailed information on diet before the trial, all diseases the participant
already had, all medications the participant took, etc. However, despite
knowledge of $U$ and the treatment status at time $k$, the systolic blood
pressure measurement at time $k$ is not fully determined, as other variables
affecting this specific measurement may also exist. For example, at time $k$,
a car accident might happen nearby the individual or a loud thunderstorm may
begin. These are external factors ($\varepsilon_{k}$) that affect the systolic
blood pressure measurement at that time ($Y_{k}$). Here we assume all the
random variables $\varepsilon_{k}$ to be independently drawn from the same
distribution.

Because $f^{Y}$ is defined to be constant in time, we are assuming that the
outcome is generated in the same way over time. This also implies that,
according to (3), there are no unmeasured common causes of a proper subset of
the outcome measurements. That is, either an unmeasured cause of $Y_{k}$
affects only the measurement at time $k$ or it affects all $\bar{Y}$
measurements. However, we are agnostic about the specific functional
relationship $f^{Y}$. It is therefore possible to imagine a function $f^{Y}$
such that the outcome is generated in completely different ways depending on
the value of $\varepsilon_{k}$. For example, $U$ may alter the value of the
outcome measurement $Y_{k}$ only if $\varepsilon_{k}$ has a specific value, or
$Y_{k}$ could be a linear function of $A_{k}$ and $U$ when $\varepsilon_{k}=1$
and a non-linear function when $\varepsilon_{k}=0$.

The assumed causal model described in the previous sections is illustrated by
a DAG [2, 1] in Figure 1. However, the assumption of a fixed $f^{Y}$ and
$F_{\varepsilon}$ over time, as well as the chosen functional relationship for
$f^{A}$, are additional non-graphical assumptions, not represented in the DAG.

Z$U$$A_{k=1}$$Y_{k=1}$$\varepsilon_{k=1}$$A_{k=2}$$Y_{k=2}$$\varepsilon_{k=2}$………$A_{k=t}$$Y_{k=t}$$\varepsilon_{k=t}$

Figure 1: Directed Acyclic Graph representing the causal relationships between
the assigned treatment schedule (Z), the received exposure ($A_{k}$), the
outcome ($Y_{k}$), the individual-specific random variable ($U$) and the time-
varying noise variables ($\varepsilon_{k}$) in the basic scenario for $t>2$.
Nodes represent variables, directed edges represent causal relationships.
Dashed nodes represent unobserved variables and green edges represent
deterministic causal relationships.

###  3.4 Counterfactual outcomes

Define the counterfactual outcome $Y^{\bar{a}_{k}=\bar{x}_{k}}_{k}$, as the
outcome we would have observed at time $k$ if the exposure history until time
$k$, was externally forced to be equal to $\bar{x}_{k}\in\\{0,1\\}^{k}$. We
further invoke a classical causal consistency assumption [2],

$Y_{k}=Y^{\bar{a}_{k}=\bar{x}_{k}}_{k}\text{ when }\bar{A}_{k}=\bar{x}_{k}$
(4)

for all $k$. Assumption (4) requires that the counterfactual outcome for the
intervention forcing the treatment history $\bar{x}_{k}$ is equal to the
observed outcome when $\bar{x}_{k}$ is the observed treatment history. The
structural equation in (3) implies that the counterfactual outcome at time $k$
is affected by treatment interventions only through the intervention at time
$k$. That is, for every $k$ and $\bar{x}_{k}\in\\{0,1\\}^{k}$,

$Y^{\bar{a}_{k}=\bar{x}_{k}}_{k}=Y^{a_{k}=x_{k}}_{k},$ (5)

with $x_{k}$ being the last element of $\bar{x}_{k}$ and $Y^{a_{k}=x}_{k}$
indicating the counterfactual outcome at time $k$ when intervening only at
time $k$. The equality in (5) follows immediately from
$f^{Y}(x_{k},U^{\bar{a}_{k}=\bar{x}_{k}},\varepsilon^{\bar{a}_{k}=\bar{x}_{k}}_{k})=f^{Y}(x_{k},U,\varepsilon_{k})$,
with $U$ and $\varepsilon_{k}$ being the naturally occurring values. Equation
(5) states that there is no carryover effect of the treatment: treatment
status at time $k$ does not have any effect on the outcome at times after $k$.
Moreover, because we are assuming that $f^{Y}$ does not change across time and
the individual-time specific noise variables are i.i.d,

$\mathbb{P}(Y^{a_{1}=x}_{1}=y|U=u)=\mathbb{P}(Y^{a_{k}=x}_{k}=y|U=u)$ (6)

for every $k\in\\{1,...,t\\}$, $x\in\\{0,1\\}$, $y\in\mathcal{Y}$ and
$u\in\mathcal{U}$. Thus, we say that the distribution of the counterfactual
outcome is strongly stationary across time conditionally on $U$. The strong
stationarity assumption in (6) also implies that the expected conditional
counterfactual outcome is constant over time, that is,

$\mathbb{E}(Y^{a_{1}=x}_{1}|U=u)=\mathbb{E}(Y^{a_{k}=x}_{k}|U=u)$ (7)

holds for every $k\in\\{1,...,t\\}$, $x\in\\{0,1\\}$, and $u\in\mathcal{U}$.

Consider any time point $k_{x}$ such that $A_{k_{x}}=x$ under treatment
schedule z. Because

$\begin{split}&\mathbb{P}(Y_{k_{x}}=y|A_{k_{x}}=x,U=u,\textbf{Z}=\textbf{z})\overset{\eqref{eq:consistency}}{=}\mathbb{P}(Y^{a_{k_{x}}=x}_{k_{x}}=y|A_{k_{x}}=x,U=u,\textbf{Z}=\textbf{z})\\\
&\overset{Y^{a_{k}}_{k}\perp\mkern-9.5mu\perp
A_{k},\textbf{Z}|U}{=}\mathbb{P}(Y^{a_{k_{x}}=x}_{k_{x}}=y|U=u),\end{split}$

it follows from Equation (6) that the distribution of the outcome at all times
under a particular value of treatment is constant when conditioning on
$U=u,\textbf{Z}=\textbf{z}$. Therefore the consequence of the strong
stationarity assumption (6) is falsifiable by examining whether the
distribution of the outcome is stable over time for an individual, considering
only times in which the same treatment is received. A similar argument can be
made for condition (7).

The assumptions of constant $f^{Y}$ and $F_{\varepsilon}$ over time and of no
carryover effect are plausible only in very specific circumstances. In work
targeted towards practitioners, N-of-1 trials have been suggested to be ideal
study designs in research on symptom management, palliative care, chronic non-
malignant pain, and sleep disorders [7]. Indeed, N-of-1 trials are considered
to be particularly suitable when the individual is affected by a chronic
disease with “minimal fluctuations over time” of the symptoms, and the
candidate treatment is an intervention that only has a transient effect on the
symptoms (rapid onset of effect, quick reversal when the treatment is stopped,
and no cumulative effect) without altering the underlying pathology [7]. These
are the conditions under which Equation (3) is plausible. We will show that
under Equation (3), estimating meaningful causal estimands in N-of-1 trials is
simple.

##  4 Causal estimands

We focus on effects on the additive scale comparing always treated to never
treated strategies, but our results can be easily adapted to different scales
and contrasts.

We define the individual causal effect for individual $i$ at time $k$ as

$ICE_{i,k}=Y^{\bar{a}_{k}=\bar{1}_{k}}_{i,k}-Y^{\bar{a}_{k}=\bar{0}_{k}}_{i,k}$

with $\bar{1}_{k}$ being a vector of size $k$ with elements equal to $1$, and
$\bar{0}_{k}$ defined similarly. This estimand represents the contrast between
the counterfactual outcome at time $k$ under always treatment strategy and the
counterfactual outcome at the same time under the never treated strategy. We
define this causal estimand as the individual causal effect to be consistent
with the definitions commonly used in epidemiology, where this definition is
often attributed to $ICE_{i,1}$ [2]. It is not possible to observe both
counterfactuals at time $1$ (or any other time) for the same individual,
because an individual either received the treatment at this time or they did
not [2]. Indeed, the $ICE_{i,k}$ is only identifiable under strong
assumptions.

Yet, when we conduct an N-of-1 trial, we are restricting our inference to a
single individual’s characteristics. We can interpret this as conditioning on
the characteristics of the individual $i$ ($U=u_{i}$) at the beginning of the
study. We call $U\text{-}CATE$ the average treatment effect conditional on the
individual-specific variable $U$. More formally, we define the average
treatment effect at time $k$ conditioning on $U=u$ as

$U\text{-}CATE_{k}(u)=\mathbb{E}(Y^{\bar{a}_{k}=\bar{1}_{k}}_{k}|U=u)-\mathbb{E}(Y^{\bar{a}_{k}=\bar{0}_{k}}_{k}|U=u).$
(8)

The definition of this estimand follows the same rationale of the estimand in
Robins et al. 1999 [27]. The $U\text{-}CATE_{k}(u)$ represents the contrast
between the expected counterfactual outcome at time $k$, had an individual
with $U=u$ always received treatment until time $k$, and the expected
counterfactual outcome at time $k$ had an individual with $U=u$ never received
treatment until time $k$. We argue that $U\text{-}CATE_{k}(u)$ is a relevant
estimand to consider in N-of-1 trials, being the conditional version of the
conventionally targeted causal estimand in population-level studies with time-
varying exposure [27, 2].

The $U\text{-}CATE_{k}(u)$ is a conditional average treatment effect [2]. It
is in principle observable in an experiment where many individuals with same
characteristics $U=u$ are randomized to either receive treatment or control at
all time points. In such an experiment, it would also be possible to directly
assess the stationarity conditions in (6) and (7). However, since $U$ is
likely high dimensional and includes continuous components, two individuals
are unlikely to share the same value of $U$, implying that this estimand can
therefore be informally interpreted as a causal effect specific to the
individual. Indeed, consistent with previous work [21, 27], we refer to
$U\text{-}CATE_{k}(u)$ as an “individual-specific causal effect”.

To make explicit the relationship between the estimands of N-of-1 trials and
parallel group RCTs, we also define a “population-level causal effect”, which
is more common in medicine and epidemiology,

$ACE_{k}=\mathbb{E}(Y^{\bar{a}_{k}=\bar{1}_{k}}_{k})-\mathbb{E}(Y^{\bar{a}_{k}=\bar{0}_{k}}_{k}),$
(9)

which is a contrast between the expected value of the counterfactual outcome
at time $k$ under the always treated strategy and under the never treated
strategy in some population of interest (including subjects with different
values of $U$). The $ACE_{k}$, as defined above, is a natural causal estimand
in an RCT that randomizes individuals to either taking the treatment at every
time until $k$ or to not taking the treatment through time $k$.

##  5 Inference from N-of-1 trials under the “basic scenario”

In this section, we discuss identification and estimation, in an N-of-1 trial,
of causal estimands presented in Section 4, assuming the basic data generating
process described in Section 3.

In accordance with the conditionality principle [2, 49], we conduct our
inference conditional on Z. Informally, the conditionality principle asserts
that the inference we make when $\textbf{Z}=\textbf{z}$ is randomly assigned,
should be identical to the inference we make when $\textbf{Z}=\textbf{z}$ is
assigned without randomization. Indeed, in our setting, the treatment schedule
Z is an ancillary statistics [2, 49], analogous to the flip of a coin in the
example from Robins and Wasserman [49].

Under the assumed causal model described in equations (1), (2) and (3), we
have that $U\text{-}CATE_{k}(u)$ is constant over time (see Appendix A).
Moreover, the $U\text{-}CATE_{k}(u)$ is identified by

$\tau(u,\textbf{z})=\mathbb{E}(Y_{k_{1}}|A_{k_{1}}=1,U=u,\textbf{Z}=\textbf{z})-\mathbb{E}(Y_{k_{0}}|A_{k_{0}}=0,U=u,\textbf{Z}=\textbf{z})$
(10)

with $k_{1}$ and $k_{0}$ being two time points chosen such that $A_{k_{1}}=1$
and $A_{k_{0}}=0$ when $\textbf{Z}=\textbf{z}$ (see Appendix A). This quantity
corresponds to the difference between the expected value of the outcome for an
individual with characteristics $U=u$ and treatment schedule
$\textbf{Z}=\textbf{z}$ when the individual is treated and the same expected
value when no treatment is administered.

In describing the data generating process using equation (1), (2), and (3) we
committed to a “non-parametric structural equation model with independent
errors” (NPSEM-IE) [1]. These models implicitly assume several untestable
cross-world independencies between counterfactuals [2]. We emphasize that our
identification result does not depend on such cross-world independencies and
it can be obtained also assuming only consistency (4), no carryover (5), the
causal DAG in Figure 1 under a finest fully randomized causally interpreted
structured tree graph (FFRCISTG) model [50] (which includes the NPSEM-IE as a
strict submodel [51]), and the stationarity of the expected conditional
counterfactual outcome (7), see Appendix A. Since we consider a causal effect
on the additive scale, strong stationarity at the level of the expected value
(7) is sufficient for identification, without requiring the stricter
assumption (6) of strong stationarity of the distribution.

Denote the difference between the mean of the observed outcomes of the
individual $i$ during the time points where treatment is received and the mean
of the observed outcomes during the time points where treatment is not
received by

$\begin{split}&\hat{\tau_{i}}=\\\
&\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(A_{i,k}=1)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(A_{i,k}=1)Y_{i,k}\\}-\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(A_{i,k}=0)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(A_{i,k}=0)Y_{i,k}\\}.\end{split}$
(11)

This quantity is a function of data from a single individual $i$, as would be
available in an N-of-1 trial. We know that $\hat{\tau_{i}}$ is well defined
because condition (2) guarantees that both denominators are non-zero for the
treatment schedule $\textbf{z}_{i}$.

We can show that $\hat{\tau_{i}}$ is an unbiased estimator for
$\tau(u_{i},\textbf{z}_{i})$ conditional on $U=u_{i}$ and
$\textbf{Z}=\textbf{z}_{i}$, see Appendix B. This means that if we were to
repeat the N-of-1 experiment with treatment schedule $\textbf{z}_{i}$ for
infinite individuals with $U=u_{i}$, the average of the estimates obtained
according to (11) across the repetitions would correspond to the individual-
specific causal effect $\tau(u_{i},\textbf{z}_{i})$. We emphasize that, in our
statistical inference framework, we require conceptualization of a
superpopulation of individuals with $U=u_{i}$, though the actual existence of
such a superpopulation may be unlikely depending on $U$.

The estimator $\hat{\tau_{i}}$ converges towards $\tau(u_{i},\textbf{z}_{i})$
as the duration of the experiment increases (as $t$ goes to infinity) for an
individual with characteristics $U=u_{i}$ and for treatment schedule
$\textbf{Z}=\textbf{z}_{i}$. Conditional on the context
$U=u_{i},\textbf{Z}=\textbf{z}_{i}$ and for large $t$, the estimator is
normally distributed with mean $\tau(u_{i},\textbf{z}_{i})$

$\hat{\tau_{i}}\sim\mathbb{N}\left(\tau(u_{i},\textbf{z}_{i}),\frac{\sigma^{2}_{\varepsilon}}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=1)\\}}+\frac{\sigma^{2}_{\varepsilon}}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=0)\\}}\right),$
(12)

see Appendix B for the derivation.

This result enables construction of simple statistical tests for the null
hypothesis of no individual-specific causal effect. Specifically, it justifies
the use of an unpaired t-test of the null hypothesis that
$U\text{-}CATE_{k}(u_{i})=0$. The unpaired t-test has been described as the
simplest way to test for an effect in a N-of-1 trial, and is considered an
appropriate test when carryover or other more complex relationships are absent
[52]. Our results justify this claim when the $U\text{-}CATE_{k}(u)$ is the
causal estimand of interest.

The estimator’s conditional variance can be approximated by

$Var(\hat{\tau_{i}}|U=u_{i},\textbf{Z}=\textbf{z}_{i})\approx\frac{\sigma^{2}_{\varepsilon}}{t\cdot\alpha(1-\alpha)},$
(13)

with $\alpha$ being the proportion of treated time points in the cycle of
length $q$ when $\textbf{Z}=\textbf{z}_{i}$, see Appendix B for the
derivation. The approximation in (13) is consistent with informal claims in
the applied literature on single-case experiments. In particular, it has been
claimed that if the symptoms of the disease under investigation fluctuate
substantially over time, it is still possible to conduct meaningful single-
case studies, but the study will have to last longer [16]. A substantial
fluctuation of the symptoms is represented by a high
$\sigma^{2}_{\varepsilon}$, which leads to an imprecise estimator if it is not
compensated by long follow-up period. Equation (13) also makes explicit that,
under the considered causal model, balanced treatment schedules with the same
number of treated and untreated time points (i.e., $\alpha=0.5$) lead to a
more precise estimation of the individual-specific causal effect. This is a
well-known result in the RCT literature, where randomization probabilities of
0.5 are preferred to maximize power [53].

In Appendix C, we discuss the setting where $\sigma^{2}_{\varepsilon}$ is
equal to zero, and, as a consequence, $\varepsilon_{k}$ is constant in $k$,
i.e., the “error” terms are the same at every point in time. In this extreme
scenario, $ICE_{i,k}$ is constant over time and
$U\text{-}CATE_{k}(u_{i})=ICE_{i,k}$. Then, the estimator $\hat{\tau_{i}}$
would correspond to the individual causal effect $ICE_{i,k}$. However, an
investigator may be reluctant to assume that $\sigma^{2}_{\varepsilon}=0$, as
this implies that the common causes $U$, instantiated at the beginning of the
trial, and the assigned treatment are sufficient for the perfect prediction of
the outcome measurements during the full study period. The assumption of
constant counterfactuals was used by Hernan and Robins 2020 [2] in their
didactic example to demonstrate the identification of the individual causal
effect in a cross-over experiment with one unit and two time points. The
assumption of null $\sigma^{2}_{\varepsilon}$ is falsifiable in an N-of-1
trial with several time points. Indeed, if $\sigma^{2}_{\varepsilon}=0$, the
outcome measurement for an individual should always appear exactly identical
for the same level of the treatment status, that is,
$Y_{i,k_{1}}-Y_{i,k_{2}}=0$ for all $k_{1},k_{2}$ such that
$A_{i,k_{1}}=A_{i,k_{2}}$.

##  6 Complex scenarios

The key feature of the “basic scenario” data generating process that enabled
the simple estimators derived in Section 5 is the strong conditional
stationarity captured by Equation (6). In this section, we will discuss
threats to strong stationarity, propose a relaxed causal model imposing weaker
stationarity restrictions that are partially compatible with those threats,
and describe how to estimate causal effects under the relaxed causal model.

###  6.1 Threats to strong stationarity identified in the N-of-1 trials
literature

Stationarity is a common assumption in the N-of-1 trials literature [28, 19,
20, 29] and in the field of causal analysis of time series more broadly [31,
32]. There are several types of stationarity assumptions, and all require some
form of regularity over time of the time series’ probabilistic behavior [29].
While in parallel-group studies we observe a sample of independent
observations from the same distribution, in an N-of-1 trial we only observe
one instance of the time series [29]. Conceptually, assuming some form of
stationarity allows us to think about this one-instance sequence of data as a
sample of independent observations from a time invariant distribution, even if
the data is about only one individual [29].

In the N-of-1 trial literature, common reasons for the violation of
stationarity assumptions are extensively described, both informally — from a
clinical perspective — and in statistical terms. Specifically, strong
correlation between outcome measurements [3, 4, 11, 5], carryover effects [3,
4, 11, 5], and time trends [11] are considered to be the main challenges when
designing and analyzing N-of-1 trials. As already mentioned in Section 3.4,
“carryover effects” are present when the effect of a treatment administered at
one time period carries over to outcomes in subsequent periods [5]. In other
words, there is a carryover effect when the treatment does not stop exerting
effects on the outcome (directly or indirectly) after the interval of
administration, see Equation (5). Carryover effects are considered a serious
problem in N-of-1 trials, and in some circumstances the design is deemed
unfeasible due to their presence [5]. Consider for example an N-of-1 trial
that aims to compare the effects of two vaccines against an infection. If the
vaccines induce life-long immunity, and the individual is first treated with
the first vaccine, no information can be available about what would have
happened if the individual was treated with the second vaccine instead.

The correlation between outcome measurements, sometimes called
“autocorrelation”, refers to a statistical, and not necessarily a causal,
property. Autocorrelation is sometimes attributed to the existence of a common
cause, other than the treatment and possibly unmeasured, of a proper subset of
outcome measurements [11]. In Section 6.2 we will discuss the scenario in
which such common causes exist and are measured. Autocorrelation is also
sometimes attributed to the presence of a direct causal effect of the outcome
state at one time point on outcome states at later time points [28, 20]. We
will refer to this particular source of outcome correlation as an “outcome-
outcome effect” and formalize it in terms of structural equations (see
Equation (15)) to avoid confusion with the statistical terminology.

The term “time trend” has also been used in an inconsistent way in the N-of-1
trials literature. Informally, this phenomenon has been interpreted as the
existence of a time-varying variable, other than the treatment, that causes
the outcome and whose distribution changes over time (see Section 7.1 for more
details).

The presence of common causes of some outcome measurements and the issue of
outcome-outcome effects may be related to that of carryover. Indeed, if the
treatment has an effect on the outcome, the presence of outcome-outcome
effects ensures that the treatment at time $k$ has an indirect effect through
the outcome $Y_{k}$ on subsequent outcome measurements $Y_{s}$ for $s>k$.
Similarly, if the treatment has an effect on a common cause of two outcome
measurements, carryover will be present. Furthermore, the concept of time
trend is also related to the presence of common causes of some outcome
measurements. Indeed, if the time-varying variable at time $k$ that causes the
outcome at time $k$ affects future realization of itself, it represent a
common cause of outcome measurements.

The terms “autocorrelation”, “time trend”, and “carryover” are often used
informally and their interpretation is ambiguous if the full causal model is
not carefully specified. We use these terms simply to draw connections to the
N-of-1 trials literature, but warn the reader that these terms do not indicate
distinct clearly defined concepts.

The basic causal model described in Section 3 forbids carryover effects,
outcome-outcome effects, and time-varying causes of the outcome whose
distribution changes over time or that affect multiple outcome measurements.
In the next sections, we will discuss identification and estimation of causal
effects when these phenomena may be present. While these phenomena do indeed
lead to violations of strong conditional stationarity (6), as noted above,
they can be compatible with relaxed notions of stationarity under which it is
still possible to estimate causal effects from N-of-1 trials, so long as
certain key variables are observed.

###  6.2 A relaxed causal model

Consider the same treatment assignment as in Equation (1). Suppose that,
additionally, at every time $k$ we have measurements of a variable $L_{k}$,
generated according to the structural equation

$L_{k}=f^{L}(A_{k},Y_{k-1},L_{k-1},U_{L},\gamma_{k})$ (14)

with $\gamma_{k}$ being a noise random variable with distribution $F_{\gamma}$
that does not change over time, and $f^{L}$ being a function that does not
depend on $k$. We assume that $\bar{\gamma}$ is a set of i.i.d random
variables independent of any other measured and unmeasured variable in the
causal model. The variable $U_{L}$ represents the set of common causes of all
covariate measurements during the study period, instantiated at baseline.
Equation (14) introduces in our causal model a covariate $L_{k}$ that is
affected by its previous state $L_{k-1}$, the treatment status $A_{k}$, the
previous state of the outcome $Y_{k-1}$, and $U_{L}$.

The outcome $Y_{k}$ at time $k$ is now generated by a structural equation,

$Y_{k}=f^{Y}(L_{k},A_{k},Y_{k-1},L_{k-1},A_{k-1},U_{Y},\varepsilon_{k}).\\\ $
(15)

As in Section 3, $\bar{\varepsilon}$ is a vector of i.i.d. variables drawn
from a distribution $F_{\varepsilon}$ that does not vary over time and has
finite variance $\sigma^{2}_{\varepsilon}$. The variable $U_{Y}$ represents
the direct common causes of all the outcome measurements, instantiated at
baseline.

We will denote with $U$ the union of $U_{L}$ and $U_{Y}$. As in the basic
scenario (Section 3), the variable $U$ includes the common causes of all the
outcome measurements, either directly, or indirectly (through $\bar{L}$).
Therefore, this variable can still be interpreted as an individual-specific
variable, potentially high-dimensional, summarizing characteristics of the
individual at baseline and representing the source of effect heterogeneity.
However, differently from the interpretation in the basic scenario (Section
3.3), $U$ can now include some components that do not affect all the outcome
measurements $\bar{Y}$ directly, as long as they affect them through
$\bar{L}$.

For simplicity, we will assume that at time 1, both $L_{1}$ and $Y_{1}$ are
generated according to Equations (14) and (15), where the variables at time 0
(which do not exist or are not measured) are fixed to a constant, say, zero.
In practice, a researcher may want to consider the study period as beginning
at time 2, rather than time 1, and consider time point 1 as “fixed”. For
exposition purposes, we describe the setting where $Y_{k}$ and $L_{k}$ are
directly affected by time-varying variables instantiated only at time $k$ and
$k-1$, but we will discuss how our results can be generalized to settings
where variables can have direct effects over longer time horizons.

As before, we will assume causal consistency

$Y_{k}=Y^{\bar{a}_{k}=\bar{x}_{k}}_{k},L_{k}=L^{\bar{a}_{k}=\bar{x}_{k}}_{k}\text{
when }\bar{A}_{k}=\bar{x}_{k}$ (16)

for all $k$ and $\bar{x}_{k}\in\\{0,1\\}^{k}$.

The causal model described by Equations (1), (14), and (15) is represented in
the DAG in Figure 2. As before, the DAG cannot represent the non-graphical
assumptions, such as the requirement that the structural equations or the
random noise distributions do not change across time.

Z$U$$A_{k=1}$$Y_{k=1}$$L_{k=1}$$A_{k=2}$$Y_{k=2}$$L_{k=2}$………$A_{k=3}$$Y_{k=3}$$L_{k=3}$

Figure 2: Directed Acyclic Graph representing the causal relationships between
the assigned treatment schedule (Z), the received exposure ($A_{k}$), the
outcome ($Y_{k}$), the individual-specific random variable ($U$) and the time-
varying covariate ($L_{k}$) in the relaxed causal model for $t>2$. Nodes
represent variables, directed edges represent causal relationships. Dashed
nodes represent unobserved variables and green edges represent deterministic
causal relationships. For graphical reasons we do not depict explicitly the
exogenous noise random variables $\varepsilon_{k}$ and $\gamma_{k}$ that
affect respectively $Y_{k}$ and $L_{k}$.

In this new causal model, the treatment variables $\bar{A}$ are generated
exactly as in the basic scenario in Section 3.1; the outcome variable at time
$k$ is a function of the treatment assigned at time $k$, an individual-
specific variable $U_{Y}$, and an independent noise variable
$\varepsilon_{k}$. However, in this new causal model, $Y_{k}$ is also
determined by its previous state $Y_{k-1}$, therefore allowing for outcome-
outcome effects. More generally, we are allowing for the presence of carryover
effects, both directly and indirectly (through $L_{k}$ and $Y_{k}$). Indeed,
the treatment status at time $k$ ($A_{k}$) has a direct effect on the outcome
at the next time ($Y_{k+1}$), and an indirect effect on all the subsequent
outcome measurements through its effect on $L_{k}$ and $Y_{k}$. Furthermore,
the time-varying covariate $L_{k}$ represents a common cause of a proper
subset of outcome measurements when $k>1$, and could even induce a time trend
in the outcome, since its distribution changes over time (see Section 7.1 for
more details). Indeed, every informal threat to strong stationarity discussed
in Section 6.1 is present, and the assumption of strong stationarity in
Equation (6) does not generally hold under this causal model. As a
consequence, the individual-specific causal effect $U\text{-}CATE_{k}(u)$ may
not be constant over time, but rather changes based on the value of $k$.

The causal model nevertheless imposes regularity constraints over time: the
function generating the variable $L_{k}$ ($f^{L}$) does not change over time;
the noise variable distributions $F_{\gamma}$ remain the same over time; and
time-varying variables can only have a direct effect on variables measured in
the same time point or the next time point. These assumptions derived from
(14) imply that

$\begin{split}&\mathbb{P}(L_{2}^{a_{2}=x}=l_{2}|\,Y_{1}=y_{1},L_{1}=l_{1},U=u)=\\\
&\mathbb{P}(L_{k}^{a_{k}=x}=l_{2}|\,Y_{k-1}=y_{1},L_{k-1}=l_{1},U=u)\end{split}$
(17)

for every $k\in\\{1,...,t\\}$, for every $l_{2},l_{1}\in\mathcal{L}$, for
every $y_{1}\in\mathcal{Y}$, for every $u\in\mathcal{U}$, and $x\in\\{0,1\\}$.

Similarly, our non-graphical assumptions about the stability over time of
$f^{Y}$ and $F_{\varepsilon}$ induce an extended version of stationarity.
Indeed, we have that

$\begin{split}&\mathbb{P}(Y^{\bar{a}_{2}=\\{x_{1},x_{2}\\}}_{2}=y_{2}|\,L^{\bar{a}_{2}=\\{x_{1},x_{2}\\}}_{2}=l_{2},Y^{a_{1}=x_{1}}_{1}=y_{1},L^{a_{1}=x_{1}}_{1}=l_{1},U=u)=\\\
&\mathbb{P}(Y^{\bar{a}_{k}=\\{\bar{v},x_{1},x_{2}\\}}_{k}=y_{2}|\,L^{\bar{a}_{k}=\\{\bar{v},x_{1},x_{2}\\}}_{k}=l_{2},Y^{\bar{a}_{k-1}=\\{\bar{v},x_{1}\\}}_{k-1}=y_{1},L^{\bar{a}_{k-1}=\\{\bar{v},x_{1}\\}}_{k-1}=l_{1},U=u)\end{split}$
(18)

for every $k\in\\{1,...,t\\}$, for every vector $\bar{v}\in\\{0,1\\}^{k-2}$,
for every $u\in\mathcal{U}$, for every $y_{1},y_{2}\in\mathcal{Y}$, for every
$l_{1},l_{2}\in\mathcal{L}$, and for every $x_{1},x_{2}\in\\{0,1\\}$. The
stationarity assumption in (LABEL:eq:stationarity2) allows us to consider,
once again, the time series of outcome measurements as i.i.d. samples from
fixed conditional distributions, despite now we condition on a larger set of
variables.

##  7 Inference from N-of-1 trials under the “relaxed causal model”

Consider a hypothetical study where treatment is assigned according to (1),
and time-varying covariates and outcomes are generated according to (14) and
(15). We will restrict the possible treatment schedules in such a way that
each individual, at least once during a cycle, receives the comparator and the
treatment twice in a row

$\mathcal{Z}\subseteq\left\\{\textbf{z}={z_{1},...,z_{q}}\bigg{\rvert}\sum^{q-1}_{k=1}\mathbb{I}(z_{k}=a)\mathbb{I}(z_{k+1}=a)>0,\,\forall
a\in\\{0,1\\}\right\\}.$ (19)

Because the conditional distributions are time-invariant let us define

$g^{L}(l_{k},a_{k},y_{k-1},l_{k-1},u)=\mathbb{P}(L_{k}=l_{k}|A_{k}=a_{k},Y_{k-1}=y_{k-1},L_{k-1}=l_{k-1},U=u)$
(20)

and

$\begin{split}&g^{Y}(y_{k},l_{k},a_{k},y_{k-1},l_{k-1},a_{k-1},u)=\\\
&\mathbb{P}(Y_{k}=y_{k}|L_{k}=l_{k},A_{k}=a_{k},Y_{k-1}=y_{k-1},L_{k-1}=l_{k-1},A_{k-1}=a_{k-1},U=u).\end{split}$
(21)

Under the causal model described in Equations (1), (14), (15), and (19) the
expected value of the counterfactual outcome for the intervention
$\bar{x}_{k}$ at time $k$ conditional on $U=u$ can be identified by a
longitudinal g-formula [27, 2]

$\mathbb{E}(Y^{\bar{a}_{k}=\bar{x}_{k}}_{k}|U=u)=\theta_{k}(\bar{x}_{k},u),$

where

$\begin{split}&\theta_{k}(\bar{x}_{k},u)=\sum_{\bar{y}_{k},\bar{l}_{k}}y_{k}\cdot
g^{Y}(y_{k},l_{k},x_{k},y_{k-1},l_{k-1},x_{k-1},u)\,g^{L}(l_{k},x_{k},y_{k-1},l_{k-1},u)\\\
&\prod^{k-1}_{m=1}g^{Y}(y_{m},l_{m},x_{m},y_{m-1},l_{m-1},x_{m-1},u)\,g^{L}(l_{m},x_{m},y_{m-1},l_{m-1},u).\end{split}$
(22)

We have defined $Y_{k}$ and $L_{k}$ to be discrete variables. If the variables
are continuous, rather than discrete, the g-formula can be obtained by
replacing the probabilities in the product with the corresponding density
functions [2]. More details on the identification result can be found in
Appendix D.

The individual-specific causal effect at time $k$ for the characteristics
$U=u_{i}$, can therefore be identified as

$U\text{-}CATE_{k}(u_{i})=\theta_{k}(\bar{1}_{k},u_{i})-\theta_{k}(\bar{0}_{k},u_{i}).$

Since the $U\text{-}CATE_{k}(u_{i})$ is independent of the realization of Z,
it is possible to estimate the individual-specific causal effect conditioning
on both $U=u_{i}$ and $\textbf{Z}=\textbf{z}_{i}$.

The task of estimating the $U\text{-}CATE_{k}(u_{i})$ in an N-of-1 trial
amounts to estimating the conditional probabilities

  1. (a)

$g^{Y}(y_{k},l_{k},1,y_{k-1},l_{k-1},1,u_{i})$

  2. (b)

$g^{Y}(y_{k},l_{k},0,y_{k-1},l_{k-1},0,u_{i})$

  3. (c)

$g^{L}(l_{k},1,y_{k-1},l_{k-1},u_{i})$

  4. (d)

$g^{L}(l_{k},0,y_{k-1},l_{k-1},u_{i})$

for all possible values of $y_{k},y_{k-1}\in\mathcal{Y}$ and
$l_{k},l_{k-1}\in\mathcal{L}$, using only data from the individual $i$. This
is a strong requirement, which is not always possible to do well. While
condition (19) guarantees that the needed treatment sequences are observed at
least once, it is not guaranteed that all the possible combination of values
are observed in a finite realization of the individual $i$. Introduction of
parametric assumptions may facilitate the estimation problem, smoothing over
the unobserved combinations of the conditioning set.

Suppose there exist estimators of (a), (b), (c), and (d) that converge in
probability towards the true parameters, for fixed $U=u_{i}$ and
$\textbf{Z}=\textbf{z}_{i}$, as $t$ goes to infinity. Define
$\hat{\theta}_{k}(\bar{x}_{k},u_{i})$ as the plug-in estimator obtained by
replacing all terms in Equation (22) with estimates obtained by these
estimators using data from the individual $i$ [2, 27]. Then, the plug-in
estimator
$\hat{\theta}_{k}(\bar{1}_{k},u_{i})-\hat{\theta}_{k}(\bar{0}_{k},u_{i})$
converges towards $U\text{-}CATE_{k}(u_{i})$, for fixed $U=u_{i}$ and
$\textbf{Z}=\textbf{z}_{i}$, when $t$ goes to infinity [2, 27]. It is
therefore possible to accurately estimate the individual-specific causal
effect in an N-of-1 trial even in the relaxed causal model, provided that a
sufficiently large number of time points are available and suitable estimators
are used.

We emphasize that, while we assumed that treatment at a given time does not
have a direct effect on the outcome beyond 1 time point in the future, we are
allowing indirect carryover effects on all future outcome measurements. This
means that, under the specific restrictions implied by the causal model in in
Equations (1), (14), (15), and (19), it is possible to estimate individual-
specific causal effects of treatments with long-lasting effects in a single
N-of-1 trial.

In this section we considered for simplicity the setting where $Y_{k}$ and
$L_{k}$ are directly influenced by time-varying variables instantiated at time
$k$ and $k-1$. By increasing this time window, we could represent more complex
causal models, e.g., allowing for longer direct carryover effects. For
example, $Y_{k}$ could also be affected directly by $A_{k-2}$ and $A_{k-3}$.
The formula in Equation (22) can be modified to accommodate these scenarios by
including measurements from previous times in the conditioning set (see
Appendix D). Importantly, this also restricts the possible values of Z that
allow identification of the individual-specific causal effect, similarly to
(19), by requiring that treatment sequences $\\{0,0,0,0\\}$ and
$\\{1,1,1,1\\}$ are assigned at least once.

We emphasize that our identification result in (22) is a special case of the
one derived by Robins et al. 1999 [27]. To simplify the exposition, we
motivated the result by assuming a NPSEM-IE model, but the identification
result in (22) can be obtained assuming only consistency (16), the causal DAG
in Figure 2 under a FFRCISTG model [50, 51], and the stationarity assumptions
(17) and (LABEL:eq:stationarity2), see Appendix D.

###  7.1 The meaning of the term “time trend”

Consider another causal model. Suppose that the treatment is assigned
according to (1) and the treatment schedule satisfies (2). The time-varying
covariate $L_{k}$, instead, is generated according to

$L_{k}=f^{L}(L_{k-1},U_{L},\gamma_{k})$ (23)

while the outcome is generated according to

$Y_{k}=f^{Y}(L_{k},A_{k},L_{k-1},U_{Y},\varepsilon_{k}),\\\ $ (24)

where all symbols have same meaning and interpretation as in Section 6.2, and
$U$ is again the union of $U_{L}$ and $U_{Y}$. The causal model described by
(1), (2), (23), and (24) is depicted in the DAG in Figure 3. It is immediately
clear that this causal model is a special case of the one discussed in Section
6.2. Indeed, the only differences between the two data generating processes is
that $A_{k}$ and $Y_{k-1}$ are omitted from the structural equation (14), and
$Y_{k-1}$ and $A_{k-1}$ are omitted from the structural equation (15).

The variable $L_{k}$ represents now a cause of the outcome, which is not
affected by the treatment (either directly or indirectly), and whose
distribution changes over time. Moreover, as before, $L_{k}$ is a common cause
of a proper subset of outcome measurements. As a result, strong stationarity
(6) is not guaranteed to hold. However, there are no direct or indirect
carryover effects of the treatment, therefore condition (5) holds. While this
causal structure is a special case of the scenario described in Section 6.2,
it can also be interpreted as an instance of what is commonly referred to as a
“time trend”. The usage of this term is ambiguous in the literature. In the
elaboration of the SPENT 2019 checklist for N-of-1 trials, a time trend is
defined as “the change that would have occurred over time regardless of
intervention” [47]. A more nuanced definition is the one from Schmid and Yang
2022 [11], who use the term time trend to indicate that “underlying forces may
lead to changes in the outcome independent of treatment effects”. A similar
idea is described in the user guide for design and implementation of N-of-1
trials for the Agency for Healthcare Research and Quality of the U.S.
Department of Health and Human Services, prepared by the Brigham and Women’s
Hospital DEcIDE Methods Center [52]. In this guide a (linear) secular trend is
considered present if there is a “confounder whose effect on the outcome is
linear with time” [52]. While these definitions are not formal about the
causal process they envision, they seem to point in the direction of a
violation of a form of stationarity due to something other than a carryover
effect. Namely, a violation due to the fact that the outcome measurements are
affected by a covariate, which is not influenced by the treatment, and whose
distribution changes over time. The causal model described by (1), (2), (23),
(24) and depicted in Figure 3, represents a scenario in which a time trend is
present. Being a special case of the causal model in Section 6.2,
identification and estimation results shown in this section are still valid.
It is possible to identify and estimate the $U\text{-}CATE_{k}(u_{i})$ using
data from the individual $i$, under the same conditions. It is, however,
sufficient to consider fewer variables when modelling $g^{L}$ and $g^{Y}$,
because in this special case some of the variables in the conditioning sets
are known to be conditionally independent.

Z$U$$A_{k=1}$$Y_{k=1}$$L_{k=1}$$A_{k=2}$$Y_{k=2}$$L_{k=2}$………$A_{k=3}$$Y_{k=3}$$L_{k=3}$

Figure 3: Directed Acyclic Graph representing the causal relationships between
the assigned treatment schedule (Z), the received exposure ($A_{k}$), the
outcome ($Y_{k}$), the individual-specific random variable ($U$) and the time-
varying covariate ($L_{k}$) in a scenario where the time-varying covariate
induces a time trend and no carryover exists, for $t>2$. Nodes represent
variables, directed edges represent causal relationships. Dashed nodes
represent unobserved variables and green edges represent deterministic causal
relationships. For graphical reasons we do not depict explicitly the exogenous
noise random variables $\varepsilon_{k}$ and $\gamma_{k}$ that affect
respectively $Y_{k}$ and $L_{k}$.

##  8 Other relevant scenarios

###  8.1 Hypothesis testing under long-lasting direct carryover

As shown in Section 7, estimation of $U\text{-}CATE_{k}(u_{i})$ is a more
difficult task that requires more data compared to the estimation of the same
quantity in the basic scenario. In the basic scenario, as described in Section
5, the simple mean difference of the outcome between treated and untreated
time points $\hat{\tau}_{i}$ is a valid estimator of the
$U\text{-}CATE_{k}(u_{i})$ conditional on $U=u_{i},\textbf{Z}=\textbf{z}_{i}$.
In more complex scenarios, $\hat{\tau}_{i}$ is not a valid estimator of the
individual-specific causal effect. However, $\hat{\tau}_{i}$ can still be used
in certain settings to test for the presence of specific causal effects. A
similar result is known in two-period cross-over clinical trials [54].

Suppose we are in a scenario where the treatment is assigned according to (1)
and treatment schedule follows (2). The outcome at time $k$ is generated by

$Y_{k}=f^{Y}(\bar{A}_{k},U,\varepsilon_{k}).$ (25)

In words, there is no outcome-outcome effect and no time-varying covariate
causing the outcome, but there might be long-term (direct) carryover effects.
According to equation (25), the outcome at time $k$ is influenced by the
treatment status at all times between $1$ and $k$. In this setting, estimating
the $U\text{-}CATE_{k}(u_{i})$ is not straight-forward. However, it is
possible to build a valid simple statistical test for the null hypothesis of
equality of the conditional counterfactual distribution at all times and under
any treatment strategy:

$H_{0}:\mathbb{P}(Y^{\bar{a}_{k}=\bar{x}_{k}}_{k}|U=u_{i})=\mathbb{P}(Y^{\bar{a}_{k}=\bar{x}^{\prime}_{k}}_{k}|U=u_{i})\hskip
28.45274pt\forall k,\bar{x}_{k},\bar{x}^{\prime}_{k}$ (26)

where, informally, the null hypothesis $H_{0}$ is that no treatment sequence
changes the distribution of the outcome at any time for individuals with
$U=u_{i}$.

Under $H_{0}$,

$\hat{\tau_{i}}\sim\mathbb{N}\left(0,\frac{\sigma^{2}_{\varepsilon}}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=1)\\}}+\frac{\sigma^{2}_{\varepsilon}}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=0)\\}}\right),$
(27)

for fixed $U=u_{i},\textbf{Z}=\textbf{z}_{i}$ and for large $t$, see Appendix
E for more details. Therefore, $\hat{\tau}_{i}$ can be used to assess the null
hypothesis of no causal effect at any time for any treatment strategy, even in
scenarios where carryover effect is deemed plausible. We emphasize that this
is a valid statistical test, in the sense that repeating a sufficiently long
experiment infinite times for the same context
$U=u_{i},\textbf{Z}_{i}=\textbf{z}_{i}$, under the null hypothesis, would lead
to a rejection rate of 5%. However, this does not represent a consistent
statistical test, in the sense that the power does not necessarily approach 1
when $t$ grows towards infinity.

###  8.2 Time trend due to repetitive $L_{k}$

We will also consider another subclass of data generating processes and argue
when this class is plausible. Suppose that treatment is assigned according to
(1), and that the outcome $Y_{k}$ at time $k$ is generated as

$Y_{k}=f^{Y}(A_{k},L_{k},U,\varepsilon_{k}).$ (28)

Suppose that the covariate affecting the outcome is deterministically
generated and the covariate values repeat themselves over time. We
specifically know that the covariate values repeat themselves every $s$ time
points with $s>1$, so that

$L_{k}=L_{k-s}\ \text{with probability }1$ (29)

holds for every $k>s$.

This causal model is a special case of the one discussed in Section 7.1.
Condition (5) holds true since there is no direct or indirect carryover
effect, while the presence of a trend violates the assumption of strong
stationarity in equation (6). This data generating process is also similar to
the one presented in Section 3, except that the outcome at each time point is
not only influenced by the treatment received at that time, but also by a
covariate ($L_{k}$) whose distribution changes over time.

Suppose that the investigator chooses a value of $q$ such that $t/q$ is an
integer, and that the cycle can be subdivided into an even number of
intervals, each of length $s$. We have therefore $q/s$ intervals for each
cycle, with $q/2s$ positive integer. Furthermore, suppose that we only
consider treatment schedules satisfying

$\mathcal{Z}\subseteq\left\\{\textbf{z}=z_{1},...z_{q}\middle|\sum^{q}_{k=1}z_{k}\cdot\mathbb{I}(((k-1)\text{
mod }s)+1=w)=\frac{q}{2s},\forall w=\\{1,...,s\\}\right\\}.$ (30)

In other words, we are only considering treatment schedules where the
participant, in every cycle, will be treated exactly half of the times that a
particular value of the covariate is observed. By construction, the
participant spends $t/2$ time points with each treatment.

While this setup might appear to be overly complicated, this data generating
process captures a range of N-of-1 trials. Consider, for example, an N-of-1
trial where we are interested in investigating the effect of two treatments
($A_{k}=1$ and $A_{k}=0$) on back pain level ($Y_{k}$). The treatments have no
carryover effect and they only affect the back pain level on the same day they
are administered. Moreover, the only known factor that modifies the level of
pain is the daily activities. Indeed, the study participant does different
activities during each day of the week. For example, on Monday the participant
works from home ($L_{k}=1$), on Tuesday commutes to the office ($L_{k}=2$), on
Wednesday goes to the gym ($L_{k}=3$), etc. The participant follows a quite
rigid routine, so that their activities are always the same each weekday.
Therefore, the sequence of $L_{k}$ values repeats itself over time every week
($s=7$). Thus, the researcher considers a cycle of two weeks ($q=14$). The
participant, for each cycle, will take a treatment for one week and the other
treatment in the following week ($\textbf{z}=\\{\bar{1}_{7},\bar{0}_{7}\\}$).
The study starts on a Monday and lasts overall for four weeks ($t=28$). This
example is compatible with the causal model described in Equations (1), (28),
(29), and (30). The less intuitive condition (30) ensures that within each
cycle of two weeks, the participant is observed with treatment on a Monday and
without treatment on the Monday of the other week; and analogously for the
other days of the week.

Under the causal model expressed in in Equations (1), (28), (29), and (30),
$U\text{-}CATE_{k}(u)$ does not have to be constant over time. However,
stationarity holds in subsets of the time points; conceptually, we subdivided
the study period of length $t$, into $t/s$ intervals of length $s$. In each
interval $p$, we have $w=\\{1,...,s\\}$ time points. According to Equation
(29), across all intervals of this type, the covariate for the time point $w$
has the same value. This means that considering only time points in position
$w$, the data generating process is identical to the one described in Section
3. We, indeed, have that

$\mathbb{P}(Y^{a_{k}=x}_{k}=y|U=u)=\mathbb{P}(Y^{a_{w}=x}_{w}=y|U=u)$ (31)

with $w=((k-1)\text{ mod }s)+1$, for every $k=\\{1,...,t\\}$, $x\in\\{0,1\\}$,
$y\in\mathcal{Y}$ and $u\in\mathcal{U}$. Then, $\hat{\tau}_{i}$ is an unbiased
estimator for the causal contrast
$\frac{1}{s}\sum^{s}_{w=1}U\text{-}CATE_{w}(u_{i})$ and converges towards it
when $t$ grows to infinity, for fixed context
$\textbf{Z}=\textbf{z}_{i},U=u_{i}$ (see Appendix F). Additionally, for large
$t$, we have

$\hat{\tau}_{i}\,|\,U=u_{i},\textbf{Z}=\textbf{z}_{i}\sim\mathbb{N}\left(\frac{1}{s}\sum^{s}_{w=1}U\text{-}CATE_{w}(u_{i}),\frac{4\sigma^{2}_{\varepsilon}}{t}\right).$
(32)

In other words, the mean difference between outcome measurements in treatment
times and outcome measurements in non-treatment times across the full study
can be used to estimate and test hypothesis about
$\frac{1}{s}\sum^{s}_{w=1}U\text{-}CATE_{w}(u_{i})$. This causal contrast is
the average of the individual-specific causal effects across the
$w=\\{1,...,s\\}$ time points. In our example, the
$\frac{1}{s}\sum^{s}_{w=1}U\text{-}CATE_{w}(u_{i})$ would represent the
average over a week of the individual-specific causal effects of the treatment
on back pain level. Since the effect of the treatment during different days is
not necessarily the same, this new causal contrast summarizes the average
effect over time and is more meaningful.

###  8.3 Washout periods

So far, we have considered only two states for the treatment variable $A_{k}$.
In this section, we will describe a scenario involving three different states:
treatment ($A_{k}=1$), comparator ($A_{k}=0$), and no treatment ($A_{k}=-1$).
This distinction is necessary to explain the role of so-called “washout
periods”.

Suppose we conduct an N-of-1 trial to study the effect on pain ($Y_{k}$) of a
new drug ($A_{k}=1$) against the drug currently in use ($A_{k}=0$, old drug)
for a participant with chronic back pain. Both drugs have carryover effects,
meaning that the drugs will still have an effect on pain for a few days after
the participant stops taking them. Suppose that the participant, as part of
the study, takes the new drug for 5 days and then takes the old drug for the
next 5 days. The pain levels in the first days of treatment with the old drug
will be the result of both the effect of the old drug and the residual effect
of the new drug. To mitigate these carryover effects, N-of-1 trials often
include a period without any treatment, called a washout period, in between
the two treatments [23, 47]. The aim of these periods is to ensure that no
“residual treatment effect” from the first treatment carries over into the
period of time in which the second treatment is administered [5]. We will now
introduce a causal model to formalize this notion.

Consider a treatment generated according to equation (1). Suppose that $q$ is
a multiple of four, such that $q/4$ is a positive integer, and $q\geq 8$, and
$t$ is a multiple of $q$ ($t/q$ integer higher than $1$). Define $s=q/4$ (note
that $s$ is defined differently in Section 8.2, despite representing always
the length of a interval of the study period). We consider only treatment
schedules of the form

$\mathcal{Z}\subseteq\left\\{\textbf{z}|\textbf{z}=\\{\bar{x}_{s},\overline{-1}_{s},\overline{1-x}_{s},\overline{-1}_{s}\\}\right\\}$
(33)

with $\bar{x}_{s}$ being either a null vector or a unit vector of dimension
$s$. In other words, in each treatment cycle, a participant receives treatment
$s$ times, then they receive no treatment (washout) $s$ times, followed by
receiving the other treatment $s$ times, and then a washout period of $s$
times without any treatment. Thus, every participant spends one fourth of the
total time points with the treatment and one fourth with the comparator.

Suppose that the outcome $Y_{k}$ at time $k$ is generated by a structural
equation,

$Y_{k}=f^{Y}(\bar{A}_{(k-s):k},U,\varepsilon_{k})$ (34)

where $U,\varepsilon_{k}$ are defined as in Section 3 and $\bar{A}_{a:b}$
indicates the set of treatment statuses from time $a$ to time $b$. The only
difference between the outcome generation process in (34) and the outcome
generation process in (3) is that the outcome at time $k$ is determined not
only by the treatment at time $k$, but also by the treatment administered at
previous times until time $k-s$ in the past. We are indeed allowing for the
presence of direct carryover effects up to $s$ time points. For the data
generating process to be plausible, it is important that the investigator
chooses a length of the cycle $q$ such that it is reasonable that both
treatments do not have effects beyond $s=q/4$ time points from their
administration. We will also assume that participants did not take any
treatment for at least $s$ times before the start of the trial.

Under the causal model described by (1), (33), and (34), the individual-
specific causal effect for an individual with $U=u_{i}$ — the
$U\text{-}CATE_{k}(u_{i})$ — is not necessarily constant over time, and
stationarity (6) may not hold. Therefore, similarly to Section 8.2, we
consider the causal contrast
$\frac{1}{s}\sum^{s}_{w=1}U\text{-}CATE_{w}(u_{i})$, which, informally, is the
contrast between taking one treatment for the first $s$ time points compared
to taking the comparator treatment for the first $s$ time points.

It can be shown that $\hat{\tau}_{i}$ is an unbiased estimator of
$\frac{1}{s}\sum^{s}_{w=1}U\text{-}CATE_{w}(u_{i})$ and converges towards it
for $t$ that grows to infinity, for any fixed context
$\textbf{Z}=\textbf{z}_{i},U=u_{i}$ (see Appendix G). This estimator does not
use information about time points in the washout periods (when $A_{k}=-1$).
For large $t$, we have

$\hat{\tau_{i}}\,|\,U=u_{i},\textbf{Z}=\textbf{z}_{i}\sim\mathbb{N}\left(\frac{1}{s}\sum^{s}_{w=1}U\text{-}CATE_{w}(u_{i}),\frac{8\sigma^{2}_{\varepsilon}}{t}\right)$

Therefore, under the considered causal model, the introduction of washout
periods in an N-of-1 trial allows estimation and testing of meaningful causal
contrasts without requiring complex statistical modelling, even when longer
direct carryover is present.

##  9 Randomization

We emphasize that randomization of the treatment is not necessary for the
identification and estimation results that we presented in Sections 5, 7, and
8, provided all the other assumptions are met. Indeed, the fact that our
inference is conditioned on Z illustrates that our results also hold in
settings where Z is a constant z, that is the treatment schedule is
arbitrarily predetermined and imposed to the participant without being
randomized. Our results also hold if $U$ determines the assigned treatment,
since our inference is by design conditioned on $U=u_{i}$. This argument
agrees with the intuition that an N-of-1 trial is a self-controlled design
[10, 55], and, as such, confounding due to characteristics that do not change
over time is not a threat for valid estimation of the individual-specific
causal effect. Furthermore, consider the causal model described in Section
6.2, if for example the treatment is assigned at every time point based on the
value of $U$ and other known variables e.g., $A_{k-1}$,$L_{k-1}$ and
$Y_{k-1}$, the counterfactual quantity
$\mathbb{E}(Y^{\bar{a}_{k}=\bar{x}_{k}}_{k}|U=u)$ would still be identified by
the same g-formula in (22) [27]. This scenario would be consistent with an
observational study where the time-varying confounders are known [27], or with
an adaptive N-of-1 trial [23]. Informally, since we are interested in
inference conditional on the context $U=u_{i},\textbf{Z}=\textbf{z}_{i}$, and
in our causal models we always assumed some form of stationarity conditions,
randomization is not necessary.

Randomization has been described as a way to eliminate confounding due to
autocorrelation and carryover effects [19, 20], as a way to balance time-
varying confounding factors [22, 23], or as a way to minimize confounding and
selection bias [22] in N-of-1 trials. We believe that confusion often arises
about the role of randomization in N-of-1 trials, due to different choices and
beliefs with respect of the estimand of interest, the units of inference, and
the definition of confounding. In Section 12 we will briefly discuss how
randomization plays a key role when the interest is in estimands that are not
conditioned on $U$ and Z. With respect to the units of inference, some authors
seem to consider time units as the units of interest in N-of-1 trials, rather
than individuals. For example, Daza considers as the target population of
their N-of-1 trial inference the superset of periods experienced by one person
[20]. This conceptualization justifies the use of the term confounding to
indicate a lack of exchangeability (as defined in [2]) between the time points
(e.g., due to a time trend) [52]. This concept of “exchangeability” between
the time points is reminiscent of the idea of stationarity, rather than an
absence of confounding in its traditional meaning in the epidemiologic
literature. Somewhat analogously, the issue of carryover in N-of-1 trials can
be related to the traditional concept of “interference” [2] in epidemiological
studies. Informally, time points can be thought as different individuals, and
effects between time points can be thought as ties between individuals who
affect each other. For example Liang and Recht explicitly consider carryover
effects as the presence of interference [35], while, in order to estimate
causal effects from a single realization of social network data, Ogburn et al.
[56] developed an estimation strategy similar to the one we propose for N-of-1
trials.

##  10 Data application

###  10.1 Data description

In this section, we rely on the results illustrated in the previous sections
to analyze data from two N-of-1 trials. Specifically, we used data from N-of-1
trials on acne severity described in Fu et al. 2023 [57], which are publicly
available [58]. In the original study, these data have been used, together
with pictures taken during the experiment, to train convolutional neural
networks for automated analysis of multimodal N-of-1 trials [57]. Here, we
only use the available tabular data and re-analyze two of the N-of-1 trials
using the methods described in the previous sections.

In the series of experiments described by Fu et al. [57], two participants
tested one acne product and three other participants tested another acne
product. Here we deliberately use data from two participants (participants 1
and 2 from the original study), who tested the same product, a salicylic acid
based acne control gel [57]. Both participants participated in the study for
16 days, and collected data 3 times per day: after waking up, after the second
meal of the day, and before bedtime [57]. Therefore, each participant
contributed $t=48$ time points. These time points were subdivided in 4-days
treatment cycles ($q=12$). Both participants were assigned a fixed treatment
schedule $\textbf{z}=\\{0,0,0,0,0,0,1,1,1,1,1,1\\}$ which repeated itself over
time. That is, for every cycle, the participant spent two days (6 time points)
without treatment ($A_{k}=0$), and two days (6 time points) with treatment
($A_{k}=1$). Treatment consisted in applying the salicylic acid based acne
control gel according to a specified schedule on spots of facial or body acne
[57]. At every time point, following a strict protocol, a picture of the spot
of facial or body acne was taken by the participants [57]. The pictures were
then all randomly shuffled and rated independently by five raters on a scale
from 0 (no visible acne) to 1 (skin fully covered in acne) [57]. Our outcome
was the average of the ratings from the five raters ($Y_{k}$), as a measure of
acne severity. We further used two additional variables ($L_{k}$), among the
ones recorded in the original study, which might be associated with the
outcome: the moment of the day (waking up, second meal, bedtime) and the
recorded temperature of the environment during the day (in Fahrenheit, same
value for measurements from the same study day) [57]. Data about the two
participants included in this analysis are visualized in Figure 4.

Figure 4: Data from two participants (1 and 2) in the series of N-of-1 trials
from Fu et al. 2023. The two participants tested a salicylic acid based acne
control gel according to an assigned fixed treatment schedule. Acne severity
is the outcome (ranging from 0, no visible acne, to 1, skin covered in acne).
Moment of the day and daily environmental temperature are also reported.

###  10.2 Analysis

In this section, we will analyze the N-of-1 trial data described in Section
10.1 to assess the effect of the acne gel. For didactic purposes we will
analyze the data in different ways, imagining that in each investigation we
are willing to make different assumptions about the data generating process.
Some approaches may be more justified than others, considering the number of
time points and the specific use case.

In an initial analysis, we assumed the data to be generated from a simple data
generating process. Specifically, we assumed the “basic scenario” causal model
as described in Section 3, with no carryover, no time-varying common causes of
the outcome, no outcome-outcome effects, and no time trends. Under this causal
model, the outcome distribution does not change across time when considering
time points with the same treatment. To test if this data generating process
is plausible, we fit a beta regression model [59, 60] with acne severity as
the dependent variable and time point number as the independent variable,
separately among treated and non-treated time points. We did not reject the
null hypothesis of null coefficients for the time variable in either of the
two regression models, both for participant 1 (p=0.734 and p=0.399) and
participant 2 (p=0.159 and p=0.405). Therefore, we could not reject the
hypothesis that the data were generated from the basic causal model.

Under the basic causal model, we know that $\hat{\tau}_{1}$ and
$\hat{\tau}_{2}$, as defined in (11), are valid estimators of
$U\text{-}CATE_{k}(u_{1})$ and $U\text{-}CATE_{k}(u_{2})$, which are both
constant over time. Using the result in (12), we estimated the effect of
treatment for participant 1 to be $\hat{\tau}_{1}$=0.081 (95%CI: -0.013 –
0.175). In contrast, the estimated effect of treatment for the second
participant had the opposite sign, $\hat{\tau}_{2}$= -0.094 (95%CI: -0.148 –
-0.040), favoring the treatment. In this first investigation, assuming the
basic causal model, we would therefore reject the null hypothesis of no
individual-specific effect for participant 2, while we would not reject the
null hypothesis for participant 1.

In a second analysis, we did not invoke the assumption of no carryover
effects. Specifically, we imagine that acne gel can have long-lasting direct
effects on the outcome measurements. In this investigation, we abandon the
idea of estimating $U\text{-}CATE_{k}(u_{1})$ and $U\text{-}CATE_{k}(u_{2})$,
and opt to perform a statistical test for the presence of treatment effects at
any time. Following Section 8.1, we can still use $\hat{\tau}_{i}$ to test the
null hypothesis of no effect of the treatment sequence at any time (26).
Specifically, according to (27), we can use the confidence intervals built
from the first investigation as a valid statistical test for this null
hypothesis. Therefore, in this investigation, we rejected the null hypothesis
for participant 2, and did not reject it for participant 1. Unlike the first
investigation, however, we could not estimate the individual-specific effects
of the two participants.

In a third analysis, we adopted the assumptions of no carryover effects and no
outcome-outcome effects, but we were skeptical of the no trend assumption. For
example, the time of day might affect acne severity (e.g. acne is worse in the
morning), introducing a trend as defined in Section 7.1. We can consider time
of day as a time-varying covariate ($L_{k}$) that repeats itself sequentially
(wake up - second meal - bedtime - wake up etc.) every $s=3$ time points. Each
treatment cycle of length $q$ contains an even number of intervals of length
$s$ ($q/s=4$), and the length of the study period $t$ is a multiple of $q$.
Moreover, the treatment schedule $\textbf{z}=\\{0,0,0,0,0,0,1,1,1,1,1,1\\}$
ensures that in each cycle every moment of the day is observed $4$ times, half
of which with treatment and half of which without. Therefore condition (30) is
satisfied and we are under the data generating process described in Section
8.2. In this setting, $\hat{\tau}_{1}$ and $\hat{\tau}_{2}$ are valid
estimators of $\frac{1}{s}\sum^{s}_{w=1}U\text{-}CATE_{w}(u_{1})$ and
$\frac{1}{s}\sum^{s}_{w=1}U\text{-}CATE_{w}(u_{2})$, respectively. In our
dataset, the number of treated time points and untreated time points is equal,
therefore, the variances in (12) and (32) coincide. The point estimates and
confidence intervals obtained in this third analysis are, therefore, identical
to the point estimates and confidence intervals obtained in the first
analysis. For participant 2, we would reject the null hypothesis that the
individual-specific causal effect averaged across a day is equal to zero.
While we would not reject the null hypothesis for participant 1.

These analyses illustrate that the same statistical test about the mean
difference can be interpreted in three different ways, depending on the
assumed causal model.

Finally, in a fourth investigation, we further relaxed the causal assumptions.
We assumed that it is possible that not only the time of day but also the
temperature is associated with acne severity. We can, however, rule out that
the treatment status or the outcome affect these two time-varying covariates.
Moreover, current acne status might affect acne manifestation in the future,
and the treatment effect might carry over to future times, but we assumed that
the carryover and outcome-outcome effects do not last longer than a few hours.
This motivates a special case of the causal model from Section 6.2. In this
setting, we have direct carryover of the treatment, outcome-outcome effect,
and the presence of covariates (temperature and time of day) that influence
themselves and the outcome. All these relationships can span up to one time
point in the future. To estimate the individual-specific causal effects for
both participants in this complex scenario, it is necessary to rely on a
special case of the g-formula presented in Equation (22). To estimate
$\hat{\theta}_{k}(\bar{x}_{k},u_{i})$, we fit two regression models, a beta
regression for the conditional distribution of the outcome and a linear
regression for the conditional distribution of the temperature. In the beta
regression, the outcome at time $k$ was the dependent variable while treatment
at time $k$, treatment at time $k-1$, temperature at time $k$, moment of the
day at $k$, and outcome at time $k-1$ were the independent variables. Since
temperature was a daily measurement, the linear regression was only fit for
the first measurement of the day. In the regression, temperature at time $k$
was the dependent variable, while temperature at time $k-1$ (temperature in
the previous day) was the independent variable. Temperature in the other
moments of the day was fixed to be identical to the first measurement. In
order to always have a well-defined instantiation of all variables at time
$k-1$, we took the values of the variables in the first time point to be fixed
(see comments in Section 6.2). Therefore, we implicitly conditioned on the
information obtained in the first time point, and focused on estimating the
individual-specific effect from time 2 to the end of the experiment. No
regression model was required for the other covariate, moment of the day, as
this variable can be deterministically predicted based on its previous value.
Instead of analytically solving the g-formula in Equation (22) for each
participant and then estimating the individual-specific causal effects, we
relied on a g-computation Monte Carlo simulation algorithm. For each
participant, we generated a dataset under the “always treated” strategy and a
dataset under the “never treated” strategy using the beta and linear
regression models to generate the data at every time sequentially. We then
calculated the differences between the outcome in both scenarios for each time
point. This procedure was repeated 500 times, and the average of the
differences across the 500 repetitions for the same time $k$ was considered an
approximation of
$\hat{\theta}_{k}(\bar{1}_{k},u_{i})-\hat{\theta}_{k}(\bar{0}_{k},u_{i})$ and,
therefore, a point estimate of $U\text{-}CATE_{k}(u_{i})$. The 95 % confidence
intervals were obtained by parametric bootstrap. 500 samples were generated
using the beta and linear regression models fitted in the original sample.
These bootstrapped samples were obtained fixing the treatment schedule to be
the one of the observed study participants. In each bootstrapped sample, the
procedure to obtain the individual-specific causal effect point estimate was
repeated. The standard deviation of the estimates for each time point across
the repetitions was considered to be an approximation of the standard error of
the estimator and used to obtain confidence intervals with normal
approximation. In Figure 5 we reported the estimated individual-specific
causal effects for both participants at all times. Point estimates of the
individual-specific causal effect ranged over time between 0.073 and 0.120 for
participant 1, and between -0.105 and -0.072 for participant 2. In this
investigation, we found a favorable effect of the “always treat” strategy
compared to the “never treat” strategy for participant 2 for all time points,
while no favorable effect was observed for participant 1.

The R code for all analyses can be found at https://github.com/MarcoPic-
dot/Causal_Inference_Nof1_trial_acne. Interestingly, all four investigations
concluded that salicylic acid based acne control gel seems to have a favorable
effect on acne severity for participant 2, while no evidence of a favorable
effect for the same treatment was found for participant 1. This simple example
shows the importance of N-of-1 trials when effect heterogeneity exists.

(a)

(b)

Figure 5: Estimates of the individual-specific causal effects for the first
participant (a) and for the second participant (b) for all time points as
obtained from the g-computation algorithm.

##  11 Relevance of N-of-1 trial results

We have considered inference from an N-of-1 trial as conditional on $U$. Since
$U$ is likely a high dimensional variable that represents the characteristics
of the individual under study, it is plausible that causal effects estimated
in an N-of-1 trial are only relevant for the individual under study, and have
limited generalizability to other individuals. This is a recognized
characteristic of N-of-1 trials [6, 8, 4], and the personalized nature of this
study design is considered its strength [3, 4, 6, 5, 11]. In a clinical
setting, an N-of-1 trial is often expected to result in a decision: should the
patient, from the end of the trial onwards, take the treatment or the control?

Consider, for example, the case study reported by Guyatt et al. [6] in the
article that popularized the use of N-of-1 trials. They reported an N-of-1
trial carried out in a clinical setting with the aim of determining if a
patient should in the future use certain drugs or not to treat his asthma [6].
The interest of the clinician and the patient in this trial was in determining
if always taking the treatment or the control from a moment onwards results in
better outcomes. This type of implicit causal contrast also motivates our
choice of a causal estimand, the $U\text{-}CATE_{k}(u)$, that compares an
“always treatment” strategy against an “always control” strategy. Estimating
the $U\text{-}CATE_{k}(u_{i})$ at all time points, or an average of them over
time (e.g., $\sum^{t}_{k=1}U\text{-}CATE_{k}(u_{i})$), clarifies whether the
patient $i$ would have benefited from taking treatment for the whole duration
of the study. However, this is not necessarily the answer to the clinical
question of interest, which concerns effects after the trial is conducted.
Indeed, the validity of the $U\text{-}CATE_{k}(u_{i})$ estimate for guiding
treatment decisions after the study ends relies on additional assumptions.

Imagine that the true data generating process is the one described in Section
3, and we conduct an N-of-1 trial that provides us with a precise estimate of
the $U\text{-}CATE_{k}(u_{i})$. This estimate is not guaranteed to represent
the causal contrast between the always-treat and the never-treat strategies
for times $k>t$. Under the strong assumption that condition (7) continues to
hold beyond time $t$, the estimated individual-specific causal effect would be
a valid estimate also for e.g., $U\text{-}CATE_{t+1}(u_{i})$. The plausibility
of this stationarity assumption, however, depends on the time span.

In more complex data generating processes, such as the ones described in
Sections 6.2 and 7.1, transportability of the individual-specific causal
effect to the future is more challenging. In particular, the
$U\text{-}CATE_{k}(u_{i})$ is not constant over time in this setting.
Different initial conditions in the time-varying variables may lead to a
different value of the individual-specific causal effects over time for a
period of length $t$ even assuming that stationarity conditions (17) and
(LABEL:eq:stationarity2) hold. If these stationarity assumptions continue to
hold, however, it is possible to use the g-formula in (22) to predict what
would happen after the trial.

We emphasize that assessing the relevance (generalizability) of experiment
results in the future is also a challenge in traditional RCTs, and is not
unique to N-of-1 trials. Learning from the past to act in the future requires
implicitly some notion of stationarity. The N-of-1 trial design, however, has
some specific attributes that may be exploited to test some assumptions. If,
after the trial phase, the patient receives only one version of the treatment,
the data collected in this post-trial phase may be used to test the
stationarity conditions (under one version of the treatment) and whether the
counterfactual predictions were valid.

##  12 Aggregating results from series of N-of-1 trials

N-of-1 trials can also be used to estimate population-level causal effects,
such as the $ACE_{k}$ [15, 7].

To illustrate a point, suppose that there is no effect modification by $U$ on
the chosen effect measurement scale, and therefore we have that

$\mathbb{E}(Y^{\bar{a}_{k}=\bar{1}_{k}}_{k}|U=u)-\mathbb{E}(Y^{\bar{a}_{k}=\bar{0}_{k}}_{k}|U=u)=\mathbb{E}(Y^{\bar{a}_{k}=\bar{1}_{k}}_{k})-\mathbb{E}(Y^{\bar{a}_{k}=\bar{0}_{k}}_{k})$
(35)

for every $k$ and every $u\in\mathcal{U}$. Under (35), $U\text{-}CATE_{k}(u)$
and $ACE_{k}$ coincide, and the estimate of $U\text{-}CATE_{k}(u_{i})$
obtained from a single N-of-1 trial of an individual $i$ can be used to
estimate the average causal effect in the population. Indeed, if we know that
the effect of the treatment is the same for all individuals, regardless of
their baseline characteristics $U$, identifying an effect for a specific set
of initial characteristics, is sufficient to identify the causal effect at the
population level. Of course, assumption (35) is not realistic, and effect
heterogeneity is exactly what historically motivated the existence of N-of-1
trials [14, 10, 11, 7, 5, 9]. Instead, when Equation (35) does not hold,
several N-of-1 trials can be aggregated to provide an estimate of $ACE_{k}$.

Consider the basic causal model described Section 3. Under equations (1),(2)
and (3) we have that $ACE_{k}$ is constant over time. We show in Appendix H
that the average of $\hat{\tau_{i}}$ across a sample of $n$ individuals from
the population of interest, $\frac{1}{n}\sum^{n}_{i=1}\\{\hat{\tau_{i}}\\}$,
represents an unbiased and consistent estimator (as $n$ goes to infinity) for
$ACE_{k}$. Similarly, under the relaxed causal model described in Section 6.2,
we have that the average of the individual-specific effect estimates across
$n$ individuals,

$\frac{1}{n}\sum^{n}_{i=1}\hat{\theta}_{k}(\bar{1}_{k},u_{i})-\hat{\theta}_{k}(\bar{0}_{k},u_{i}),$

converges towards the average causal effect $ACE_{k}$ when both $n$ and $t$ go
to infinity (see Appendix I). These results imply that, under the assumed
causal models, it is possible to estimate population-level effects that would
have been estimated in an RCT in a population, by aggregating large series of
N-of-1 trials of individuals from the same population.

We emphasize, however, that when interest lies in population-level effects,
such as the $ACE_{k}$, stationarity assumptions are not necessary for valid
inference when the treatment is randomized. Consider a data generating process
compatible with a parallel-group RCT where we randomize individuals to two
possible treatment schedules, $\textbf{z}=\bar{1}_{q}$ and
$\textbf{z}=\bar{0}_{q}$. For example, assuming a causal model like the one
depicted in Figure 2 under a FFRCISTG interpretation and treatment assignment
as in Equation (1). We will not require any additional assumption at this
stage. Randomization of the treatment schedule across individuals ensures
exchangeability between individuals who are assigned to a treatment schedule
and individuals who are assigned to the other treatment schedule [2]. Due to
randomization, in such an RCT, the mean outcome of a group of individuals who
happened, by randomization, to receive treatment at all times until $k$ is a
valid estimator of the average counterfactual outcome at $k$ under the always
treatment strategy, for every $k$ (and same for comparator). Exchangeability,
therefore, allows for estimation of the $ACE_{k}$ at any time point [2].

Consider, instead, a data generating process compatible with a series of
N-of-1 trials or equivalently with a crossover randomized trial. Specifically,
we randomize individuals to different Z such that $\mathbb{P}(A_{k}=1)=0.5$
for every $k$, but we do not randomize individuals to $\bar{1}_{q}$ or
$\bar{0}_{q}$. Additionally, we impose that no carryover of the treatment
exists (i.e, condition (5) holds). The DAG in Figure 3 is an example of a
causal model satisfying this description. Note that we are not requiring any
stationarity assumption to hold. Since we have exchangeability at every time
point, we can consider this design as a series of $t$ RCTs that last only one
time point. The mean difference between the outcomes of the treated and the
non-treated individuals at a given time $k$ is an unbiased and consistent
estimator of $ACE_{k}$. We do not need to measure the time-varying covariate
$L_{k}$ in this setting. It can also be shown that
$\frac{1}{n}\sum^{n}_{i=1}\hat{\tau}_{i}$ is an unbiased and consistent (for
$n$ that goes to infinity) estimator for the causal quantity
$\frac{1}{t}\sum^{t}_{k=1}ACE_{k}$ [2]. This simple example illustrates that
it is possible, when carryover is not present, to use data from a series of
N-of-1 trials in which the treatment was randomized to estimate relevant
population-level effects, without assuming any form of stationarity.

##  13 Conclusion

In this work we grounded N-of-1 trials in a formal causal inference framework.
Building on previous work by Robins et al. [27], we committed to an explicit
statistical and causal framework to motivate the analysis of N-of-1 trials. We
defined the $U\text{-}CATE_{k}(u)$, a conditional causal effect that
represents a causal estimand for N-of-1 trials. We discussed identifiability
and estimation of this individual-specific causal effect in a basic scenario
characterized by a strong stationarity assumption, and complex scenarios where
carryover effects, time trends, time-varying common causes of the outcome, and
outcome-outcome effects are allowed. We also briefly discussed the role of
randomization, the clinical relevance of N-of-1 trial results, and the
aggregation of series of N-of-1 trials for inference about population-level
effects typically targeted in RCTs.

N-of-1 trials are often motivated by settings where there is therapeutic
uncertainty, the treatment has highly heterogeneous effects, the condition is
chronic and stable, the treatment has short term consequences with rapid onset
of effects, the treatment does not have carryover effects (no long term
consequences), and the relevant outcome can be easily measured [11, 13, 7, 23,
8]. We have shown that when no carryover effects, no trends, no outcome-
outcome effects, and no time-varying common causes of the outcome are present,
simple analyses of N-of-1 trials might be justified. G-methods [27] may
suffice under more complex scenarios. It is, therefore, important when
analyzing N-of-1 trials to explicitly represent the assumptions behind the
data generating process.

We have committed to a frequentist statistical framework based on
superpopulation inference, like most statistical inference conducted in
epidemiology and medical research. Our choice is mathematically consistent,
but requires commitment to certain subtle ideas. We make inference about a
hypothetical superpopulation of individuals with the same individual-specific
variable $U=u_{i}$ as the trial participant, which in reality typically does
not exist. Randomization-based inference frameworks [33, 34, 35] might also be
used to formalize and analyze N-of-1 trials, without the need of envisioning a
superpopulation. However, unlike the randomization-based frameworks, the
superpopulation framework allows to explicitly evaluate transportability to
different time periods and to make precise connections between effects at the
individual, subpopulation and the population level. Moreover, we have shown
how, in our framework, inference is also possible when the treatment schedule
is fixed to a specific value. In these situations, the interpretation of
randomization-based inferences is ambiguous [61].

###  13.1 Future work

In this work, we only considered certain specific data generating processes.
Several other causal models are possible. For example, we considered a
specific treatment assignment function where treatment status is assigned
repeatedly over time, according to a fixed treatment schedule. Our treatment
assignment mechanism covers all possible treatment sequences for a finite time
interval, and therefore is compatible with other designs of randomized N-of-1
trials in finite time. However, it does not cover all possible treatment
sequences for time that grows to infinity, such as when treatment is
randomized at any time point [33] or the paired cycle design is used [46].
Furthermore, we only briefly considered designs compatible with adaptive
N-of-1 trials where treatments are assigned over time as a function of
previous treatments, covariates and outcomes. Moreover, we have assumed full
compliance and ignored issues related to loss to follow-up or missing data.
These complications can be integrated into our framework, if additional
information about key variables is available.

The use of formal causal arguments in the analysis of N-of-1 trials is scarce
[19, 20]. Most N-of-1 trials are analyzed using traditional statistical models
such as regressions and mixed linear models [44]. These models are used to
model time directly and the heterogeneity between individuals, making strong
parametric assumptions. However, the estimands, and sufficient identifiability
conditions, are often implicit and vague. Future work could examine the
plausibility and consequences of such parametric assumptions (i.e., modelling
time) in a causal framework.

## Funding

Mats J. Stensrud was funded by a Starting Grant from the Swiss National
Science Foundation, TMSGI3_211550.

## References

  * [1] Judea Pearl.  Causality: Models, Reasoning and Inference.  Cambridge University Press, 2 edition, September 2009.
  * [2] Miguel A. Hernan and James M. Robins.  Causal Inference: What If.  Taylor & Francis, 2020.
  * [3] Nicholas J. Schork.  Randomized clinical trials and personalized medicine: A commentary on Deaton and Cartwright.  Soc. Sci. Med., 210:71–73, August 2018.
  * [4] Elizabeth O Lillie, Bradley Patay, Joel Diamant, Brian Issell, Eric J Topol, and Nicholas J Schork.  The n-of-1 clinical trial: the ultimate strategy for individualizing medicine?  Per. Med., 8(2):161–173, March 2011.
  * [5] Keumhee C. Carriere, Yin Li, Geoffrey Mitchell, and Hugh Senior.  Methodological considerations for N-of-1 trials.  In The Essential Guide to N-of-1 Trials in Health, pages 67–80. Springer Netherlands, 2015.
  * [6] Gordon Guyatt, David Sackett, Wayne D. Taylor, John Chong, Robin Roberts, and Stewart Pugsley.  Determining optimal therapy–randomized trials in individual patients.  N. Engl. J. Med., 314(14):889–892, April 1986.
  * [7] Geoffrey Mitchell.  N-of-1 trials in medical contexts.  In The Essential Guide to N-of-1 Trials in Health, pages 43–55. Springer Netherlands, 2015.
  * [8] Reza D. Mirza, Salima Punja, Sunita Vohra, and Gordon Guyatt.  The history and development of N-of-1 trials.  J. R. Soc. Med., 110(8):330–340, August 2017.
  * [9] Andrew Crowden, Gordon Guyatt, Nikola Stepanov, and Sunita Vohra.  Research ethics and N-of-1 trials.  In The Essential Guide to N-of-1 Trials in Health, pages 125–133. Springer Netherlands, 2015.
  * [10] Lancelot Hogben and M. Sim.  The self-controlled and self-recorded clinical trial for low-grade morbidity.  Br. J. Prev. Soc. Med., 7(4):163–179, October 1953.
  * [11] Christopher Schmid and Jiabei Yang.  Bayesian models for N-of-1 trials.  Harvard Data Science Review, September 2022.
  * [12] Rumen Manolov and Mariola Moeyaert.  How can single-case data be analyzed? software resources, tutorial, and reflections on analysis.  Behav. Modif., 41(2):179–228, March 2017.
  * [13] Jane Nikles.  What are N-of-1 trials?  In The Essential Guide to N-of-1 Trials in Health, pages 9–17. Springer Netherlands, 2015.
  * [14] James Tabery.  Commentary: Hogben vs the tyranny of averages.  International Journal of Epidemiology, 40(6):1454–1458, October 2011.
  * [15] Deborah R. Zucker, Christopher H. Schmid, Martin W. McIntosh, Ralph B. D’Agostino, Harry P. Selker, and Joseph Lau.  Combining single patient (N-of-1) trials to estimate population treatment effects and to evaluate individual patient responses to treatment.  Journal of Clinical Epidemiology, 50(4):401–410, April 1997.
  * [16] Jane Smith, Michael Yelland, and Christopher Del Mar.  Single patient open trials (SPOTs).  In The Essential Guide to N-of-1 Trials in Health, pages 195–209. Springer Netherlands, 2015.
  * [17] Robyn L. Tate and Michael Perdices.  N-of-1 trials in the behavioral sciences.  In The Essential Guide to N-of-1 Trials in Health, pages 19–41. Springer Netherlands, 2015.
  * [18] Harry P. Selker, Theodora Cohen, Ralph B. D’Agostino, Willard H. Dere, S. Nassir Ghaemi, Peter K. Honig, Kenneth I. Kaitin, Heather C. Kaplan, Richard L. Kravitz, Kay Larholt, Newell E. McElwee, Kenneth A. Oye, Marisha E. Palm, Eleanor Perfetto, Chandra Ramanathan, Christopher H. Schmid, Vicki Seyfert-Margolis, Mark Trusheim, and Hans-Georg Eichler.  A useful and sustainable role for N-of-1 trials in the healthcare ecosystem.  Clinical Pharmacology & Therapeutics, 112(2):224–232, October 2021.
  * [19] Eric Jay Daza.  Person as population: A longitudinal view of single-subject causal inference for analyzing self-tracked health data, 2019.  arXiv:1901.03423.
  * [20] Eric J. Daza and Logan Schneider.  Model-twin randomization (motr): A monte carlo method for estimating the within-individual average treatment effect using wearable sensors, 2022.  arXiv:2208.00739.
  * [21] Eric Jay Daza, Katarzyna Wac, and Marily Oppezzo.  Effects of sleep deprivation on blood glucose, food cravings, and affect in a non-diabetic: An N-of-1 randomized pilot study.  Healthcare, 8(1):6, December 2019.
  * [22] Hugh Senior.  Randomization, allocation concealment, and blinding.  In The Essential Guide to N-of-1 Trials in Health, pages 81–91. Springer Netherlands, 2015.
  * [23] Kerrie Mengersen, James M. McGree, and Christopher H. Schmid.  Systematic review and meta-analysis using N-of-1 trials.  In The Essential Guide to N-of-1 Trials in Health, pages 211–231. Springer Netherlands, 2015.
  * [24] Annelieke R. Müller, Marion M.M.G. Brands, Peter M. van de Ven, Kit C.B. Roes, Martina C. Cornel, Clara D.M. van Karnebeek, Frits A. Wijburg, Joost G. Daams, Erik Boot, and Agnies M. van Eeghen.  Systematic review of N-of-1 studies in rare genetic neurodevelopmental disorders: The power of 1.  Neurology, 96(11):529–540, March 2021.
  * [25] Prathiba N. Batley, Erica B. McClure, Brandy Brewer, Ateka A. Contractor, Nicholas John Batley, Larry Vernon Hedges, and Stephanie Chin.  Evidence and reporting standards in N-of-1 medical studies: a systematic review.  Translational Psychiatry, 13(1), July 2023.
  * [26] Jane Nikles and Geoffrey Mitchell, editors.  The Essential Guide to N-of-1 Trials in Health.  Springer Netherlands, 2015.
  * [27] James M. Robins, Sander Greenland, and Fu-Chang Hu.  Estimation of the causal effect of a time-varying exposure on the marginal mean of a repeated binary outcome.  Journal of the American Statistical Association, 94(447):687–700, September 1999.
  * [28] Eric J. Daza.  Causal analysis of self-tracked time series data using a counterfactual framework for N-of-1 trials.  Methods Inf. Med., 57(1):e10–e21, February 2018.
  * [29] Elias Chaibub Neto, Ross L. Prentice, Brian M. Bot, Mike Kellen, Stephen H. Friend, Andrew D. Trister, Larsson Omberg, and Lara Mangravite.  Towards personalized causal inference of medication response in mobile health: an instrumental variable approach for randomized trials with imperfect compliance, 2016.  arXiv:1604.01055.
  * [30] Kexin Qu, Christopher H. Schmid, and Tao Liu.  Instrumental variable approach to estimating individual causal effects in N-of-1 trials: Application to ISTOP study, 2023.  arXiv:2306.14019.
  * [31] Jakob Runge, Andreas Gerhardus, Gherardo Varando, Veronika Eyring, and Gustau Camps-Valls.  Causal inference for time series.  Nature Reviews Earth & Environment, June 2023.
  * [32] Michael Eichler and Vanessa Didelez.  On Granger causality and the effect of interventions in time series.  Lifetime Data Analysis, 16(1):3–32, November 2009.
  * [33] Iavor Bojinov and Neil Shephard.  Time series experiments and causal estimands: Exact randomization tests and trading.  Journal of the American Statistical Association, 114(528):1665–1682, March 2019.
  * [34] Ivana Malenica, Yongyi Guo, Kyra Gan, and Stefan Konigorski.  Anytime-valid inference in N-of-1 trials.  In Stefan Hegselmann, Antonio Parziale, Divya Shanmugam, Shengpu Tang, Mercy Nyamewaa Asiedu, Serina Chang, Tom Hartvigsen, and Harvineet Singh, editors, Proceedings of the 3rd Machine Learning for Health Symposium, volume 225 of Proceedings of Machine Learning Research, pages 307–322. PMLR, 10 Dec 2023.
  * [35] Tengyuan Liang and Benjamin Recht.  Randomization inference when N equals one, 2023.  arXiv:2310.16989.
  * [36] Peng Liao, Kristjan Greenewald, Predrag Klasnja, and Susan Murphy.  Personalized Heartsteps: A reinforcement learning algorithm for optimizing physical activity.  Proceedings of the ACM on Interactive, Mobile, Wearable and Ubiquitous Technologies, 4(1):1–22, March 2020.
  * [37] Anna L. Trella, Kelly W. Zhang, Inbal Nahum-Shani, Vivek Shetty, Finale Doshi-Velez, and Susan A. Murphy.  Reward design for an online reinforcement learning algorithm supporting oral self-care, 2022.
  * [38] Susobhan Ghosh, Raphael Kim, Prasidh Chhabria, Raaz Dwivedi, Predrag Klasnja, Peng Liao, Kelly Zhang, and Susan Murphy.  Did we personalize? assessing personalization by an online reinforcement learning algorithm using resampling.  Machine Learning, 113(7):3961–3997, April 2024.
  * [39] Finnian Lattimore, Tor Lattimore, and Mark D. Reid.  Causal bandits: Learning good interventions via causal inference, 2016.  arXiv:1606.03203.
  * [40] Zirui Yan, Dennis Wei, Dmitriy Katz-Rogozhnikov, Prasanna Sattigeri, and Ali Tajer.  Causal bandits with general causal models and interventions, 2024.  arXiv:2403.00233.
  * [41] Dominik Meier, Ipek Ensari, and Stefan Konigorski.  Designing and evaluating an online reinforcement learning agent for physical exercise recommendations in N-of-1 trials.  In Stefan Hegselmann, Antonio Parziale, Divya Shanmugam, Shengpu Tang, Mercy Nyamewaa Asiedu, Serina Chang, Tom Hartvigsen, and Harvineet Singh, editors, Proceedings of the 3rd Machine Learning for Health Symposium, volume 225 of Proceedings of Machine Learning Research, pages 340–352. PMLR, 10 Dec 2023.
  * [42] Siththara Gedara J. Senarathne, Antony M. Overstall, and James M. McGree.  Bayesian adaptive N‐of‐1 trials for estimating population and individual treatment effects.  Statistics in Medicine, 39(29):4499–4518, September 2020.
  * [43] Sama Shrestha and Sonia Jain.  A Bayesian‐bandit adaptive design for N‐of‐1 clinical trials.  Statistics in Medicine, 40(7):1825–1844, January 2021.
  * [44] Kerrie Mengersen, James M. McGree, and Christopher H. Schmid.  Statistical analysis of N-of-1 trials.  In The Essential Guide to N-of-1 Trials in Health, page 135–153. Springer Netherlands, 2015.
  * [45] Jiabei Yang, Jon A. Steingrimsson, and Christopher H. Schmid.  Sample size calculations for n-of-1 trials, 2021.  arXiv:2110.08970.
  * [46] Stephen Senn.  The analysis of continuous data from n-of-1 trials using paired cycles: a simple tutorial.  Trials, 25(1), February 2024.
  * [47] Antony J. Porcino, Larissa Shamseer, An-Wen Chan, Richard L. Kravitz, Aaron Orkin, Salima Punja, Philippe Ravaud, Christopher H. Schmid, and Sunita Vohra.  SPIRIT extension and elaboration for n-of-1 trials: SPENT 2019 checklist.  BMJ, page m122, February 2020.
  * [48] Pierre-Simon Laplace.  Philosophical Essay on Probabilities.  Springer-Verlag, New York, 1814/1995.
  * [49] James Robins and Larry Wasserman.  Conditioning, likelihood, and coherence: A review of some foundational concepts.  Journal of the American Statistical Association, 95(452):1340–1346, 2000.
  * [50] James Robins.  A new approach to causal inference in mortality studies with a sustained exposure period—application to control of the healthy worker survivor effect.  Mathematical Modelling, 7(9–12):1393–1512, 1986.
  * [51] Thomas S. Richardson and James M. Robins.  Single world intervention graphs (SWIGs): A unification of the counterfactual and graphical approaches to causality, 2013.  Center for Statistics and the Social Sciences, University of Washington.
  * [52] Agency for Healthcare Research and Quality.  Design and implementation of N-of-1 trials: A user’s guide, 2019.  https://effectivehealthcare.ahrq.gov/products/n-1-trials/research-2014-5.
  * [53] Spencer Phillips Hey and Jonathan Kimmelman.  The questionable use of unequal allocation in confirmatory trials.  Neurology, 82(1):77–79, January 2014.
  * [54] Danni Shi and Ting Ye.  Behavioral carry-over effect and power consideration in crossover trials, 2023.  arXiv:2302.01246.
  * [55] Sunita Vohra, Larissa Shamseer, Margaret Sampson, Cecilia Bukutu, Christopher H. Schmid, Robyn Tate, Jane Nikles, Deborah R. Zucker, Richard Kravitz, Gordon Guyatt, Douglas G. Altman, and David Moher.  CONSORT extension for reporting N-of-1 trials (CENT) 2015 Statement.  BMJ, 350(may14 17):h1738–h1738, May 2015.
  * [56] Elizabeth L. Ogburn, Oleg Sofrygin, Iván Díaz, and Mark J. van der Laan.  Causal inference for social network data.  Journal of the American Statistical Association, 119(545):597–611, December 2022.
  * [57] Jingjing Fu, Shuheng Liu, Siqi Du, Siqiao Ruan, Xuliang Guo, Weiwei Pan, Abhishek Sharma, and Stefan Konigorski.  Multimodal N-of-1 trials: A novel personalized healthcare design, 2023.  arXiv:2302.07547.
  * [58] Acne n-of-1 trial data.  https://github.com/HIAlab/Acne_Multimodal_Nof1/tree/main/Data, 2022.  Accessed: 2024-02-28.
  * [59] Silvia Ferrari and Francisco Cribari-Neto.  Beta regression for modelling rates and proportions.  Journal of Applied Statistics, 31(7):799–815, August 2004.
  * [60] Francisco Cribari-Neto and Achim Zeileis.  Beta regression in R.  Journal of Statistical Software, 34(2), 2010.
  * [61] Yao Zhang and Qingyuan Zhao.  What is a randomization test?  Journal of the American Statistical Association, 118(544):2928–2942, May 2023.

## Appendix A

Consider two generic time points $k_{*}$ and $k$, and a value
$u\in\mathcal{U}$. We have that

$\begin{split}U\text{-}CATE_{k*}(u)&\overset{\eqref{eq:ucate1}}{=}\mathbb{E}(Y^{\bar{a}_{k*}=\bar{1}_{k*}}_{{k*}}|U=u)-\mathbb{E}(Y^{\bar{a}_{k*}=\bar{0}_{k*}}_{{k*}}|U=u)\\\
&\overset{\eqref{eq:carryov1}}{=}\mathbb{E}(Y^{a_{k*}=1}_{{k*}}|U=u)-\mathbb{E}(Y^{a_{k*}=0}_{{k*}}|U=u)\\\
&\overset{\eqref{eq:stationarity1_expectation}}{=}\mathbb{E}(Y^{a_{k}=1}_{{k}}|U=u)-\mathbb{E}(Y^{a_{k}=0}_{{k}}|U=u)\\\
&\overset{\eqref{eq:carryov1}}{=}\mathbb{E}(Y^{\bar{a}_{k}=\bar{1}_{k}}_{k}|U=u)-\mathbb{E}(Y^{\bar{a}_{k}=\bar{0}_{k}}_{k}|U=u)\overset{\eqref{eq:ucate1}}{=}U\text{-}CATE_{k}(u).\end{split}$

Therefore the $U\text{-}CATE_{k}(u)$ is constant over time under the basic
causal model.

Consider $k_{1}$ and $k_{0}$ two time points such that $A_{k_{1}}=1$ and
$A_{k_{0}}=0$ when $\textbf{Z}=\textbf{z}$. Then,

$\begin{split}&\tau(u,\textbf{z})\overset{\eqref{eq:tau1}}{=}\mathbb{E}(Y_{k_{1}}|A_{k_{1}}=1,U=u,\textbf{Z}=\textbf{z})-\mathbb{E}(Y_{k_{0}}|A_{k_{0}}=0,U=u,\textbf{Z}=\textbf{z})\\\
&\overset{\eqref{eq:consistency}}{=}\mathbb{E}(Y^{a_{k_{1}}=1}_{k_{1}}|A_{k_{1}}=1,U=u,\textbf{Z}=\textbf{z})-\mathbb{E}(Y^{a_{k_{0}}=0}_{k_{0}}|A_{k_{0}}=0,U=u,\textbf{Z}=\textbf{z})\\\
&\overset{(Y^{a_{k}}_{k}\perp\mkern-9.5mu\perp
A_{k},\textbf{Z}|U)}{=}\mathbb{E}(Y^{a_{k_{1}}=1}_{k_{1}}|U=u)-\mathbb{E}(Y^{a_{k_{0}}=0}_{k_{0}}|U=u)\\\
&\overset{\eqref{eq:stationarity1_expectation}}{=}\mathbb{E}(Y^{a_{k}=1}_{k}|U=u)-\mathbb{E}(Y^{a_{k}=0}_{k}|U=u)\\\
&\overset{\eqref{eq:carryov1}}{=}\mathbb{E}(Y^{\bar{a}_{k}=\bar{1}_{k}}_{k}|U=u)-\mathbb{E}(Y^{\bar{a}_{k}=\bar{0}_{k}}_{k}|U=u)\overset{\eqref{eq:ucate1}}{=}U\text{-}CATE_{k}(u)\end{split}$

Note that all quantities are well defined since condition (2) ensures that
$k_{1}$ and $k_{0}$ exist regardless of the value of z.

## Appendix B

We will use that

$\begin{split}&\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(A_{i,k}=a)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(A_{i,k}=a)Y_{i,k}\\}\\\
&\overset{\eqref{eq:A1}}{=}\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{Z}_{i},k)=a)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{Z}_{i},k)=a)Y_{i,k}\\}\\\
&\overset{\eqref{eq:Y1}}{=}\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{Z}_{i},k)=a)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{Z}_{i},k)=a)f^{Y}(A_{i,k},U_{i},\varepsilon_{i,k})\\}\\\
&=\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{Z}_{i},k)=a)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{Z}_{i},k)=a)f^{Y}(a,U_{i},\varepsilon_{i,k})\\}.\end{split}$

### Unbiasedness

Consider the expected value conditioned on $U=u_{i}$ and
$\textbf{Z}=\textbf{z}_{i}$,

$\begin{split}&\mathbb{E}\left(\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{Z},k)=a)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{Z},k)=a)f^{Y}(a,U,\varepsilon_{k})\\}\middle|U=u_{i},\textbf{Z}=\textbf{z}_{i}\right)\\\
&=\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\mathbb{E}\left(f^{Y}(a,U,\varepsilon_{k})\middle|U=u_{i},\textbf{Z}=\textbf{z}_{i}\right)\\}\\\
&=\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\mathbb{E}\left(Y^{a_{k}=a}_{k}\middle|U=u_{i},\textbf{Z}=\textbf{z}_{i}\right)\\}\\\
&\overset{(Y^{a_{k}}_{k}\perp\mkern-9.5mu\perp\textbf{Z}|U)}{=}\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\mathbb{E}\left(Y^{a_{k}=a}_{k}\middle|U=u_{i}\right)\\}\\\
&\overset{\eqref{eq:stationarity1_expectation}}{=}\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}}\mathbb{E}\left(Y^{a_{k*}=a}_{k_{*}}\middle|U=u_{i}\right)\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}\\\
&=\mathbb{E}\left(Y^{a_{k_{*}}=a}_{k_{*}}\middle|U=u_{i}\right)\end{split}$

with $k_{*}$ being a generic time point.

Therefore,

$\mathbb{E}(\hat{\tau_{i}}|U=u_{i},\textbf{Z}=\textbf{z}_{i})=\mathbb{E}(Y^{a_{k_{*}}=1}_{k_{*}}|U=u_{i})-\mathbb{E}(Y^{a_{k_{*}}=0}_{k_{*}}|U=u_{i})\overset{(A)}{=}\tau(u_{i},\textbf{z}_{i}).$

### Convergence for increasing number of time points

Given the outcome generation process (3), we have that

$\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)f^{Y}(a,u_{i},\varepsilon_{k})\\}$

is an average of $\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}$
i.i.d. random variables with the same mean
$\mathbb{E}(Y^{a_{k*}=a}_{k_{*}}|U=u_{i})$.

According to condition (2), for any $a$,
$\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}$ monotonically
increases as $t$ increases. Therefore, the Weak Law of Large Numbers ensures
that

$\frac{1}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}}\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)f^{Y}(a,u_{i},\varepsilon_{k})\\}\xrightarrow{P}\mathbb{E}(Y^{a_{k*}=a}_{k_{*}}|U=u_{i})$

when $t\to\infty$, with $k_{*}$ being a generic time point. This means that

$\begin{split}\hat{\tau_{i}}&\xrightarrow{P}\mathbb{E}(Y^{a_{k*}=1}_{k_{*}}|U=u_{i})-\mathbb{E}(Y^{a_{k*}=0}_{k_{*}}|U=u_{i})\overset{(A)}{=}\tau(u_{i},\textbf{z}_{i})\end{split}$

when $t\to\infty$, for a fixed context $U=u_{i},\textbf{Z}=\textbf{z}_{i}$.

Moreover, because all error terms have the same variance
$\sigma^{2}_{\varepsilon}$, the Central Limit Theorem ensures that

$\begin{split}\sqrt{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}}\left(\frac{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)f^{Y}(a,u_{i},\varepsilon_{k})\\}}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=a)\\}}-\mathbb{E}(Y^{a_{k*}=a}_{k_{*}}|U=u_{i})\right)\\\
\xrightarrow{d}\mathbb{N}(0,\sigma^{2}_{\varepsilon})\end{split}$

as $t$ goes to infinity. This result ensures the convergence in distribution
of the estimator $\hat{\tau_{i}}$ for fixed
$\textbf{Z}=\textbf{z}_{i},U=u_{i}$ when $t\to\infty$, since $\hat{\tau_{i}}$
is the sum of two independent quantities that converge towards normal
distributions. More specifically, we have that

$\hat{\tau_{i}}\,|\,U=u_{i},\textbf{Z}=\textbf{z}_{i}\sim\mathbb{N}\left(\tau(u_{i},\textbf{z}_{i}),\frac{\sigma^{2}_{\varepsilon}}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=1)\\}}+\frac{\sigma^{2}_{\varepsilon}}{\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=0)\\}}\right).$

To provide an approximation of the above conditional variance, define

$\alpha=\frac{\sum^{q}_{k=1}z_{i,k}}{q}=\frac{\sum^{q}_{k=1}\\{f^{A}(\textbf{z}_{i},k)\\}}{q}.$

Consider the quantity

$\begin{split}&\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=1)\\}=\sum^{t}_{k=1}\\{f^{A}(\textbf{z}_{i},k)\\}\\\
&=\begin{cases}\alpha\cdot t&\text{if $(t\text{ mod }q)=0$}\\\
\alpha\cdot(t-(t\text{ mod }q))+\sum^{t}_{k=t-(t\text{ mod
}q)+1}\\{f^{A}(\textbf{z}_{i},k)\\}&\text{if $(t\text{ mod }q)\neq 0$}\\\
\end{cases}\\\ &=\begin{cases}\alpha\cdot t&\text{if $(t\text{ mod }q)=0$}\\\
\alpha\cdot t-\alpha\cdot(t\text{ mod }q)+\sum^{t}_{k=t-(t\text{ mod
}q)+1}\\{f^{A}(\textbf{z}_{i},k)\\}&\text{if $(t\text{ mod }q)\neq 0$}\\\
\end{cases},\end{split}$

representing the number of time points with administered treatment.

We have that $\sum^{t}_{k=t-(t\text{ mod }q)+1}\\{f^{A}(\textbf{z}_{i},k)\\}$
is bounded between $0$ and $(t\text{ mod }q)$, while $(t\text{ mod }q)$ is
bounded between $0$ and $q-1$. Therefore, for sufficiently large $t$ such that
$\alpha\cdot t>>q$, we can approximate

$\sum^{t}_{k=1}\\{\mathbb{I}(f^{A}(\textbf{z}_{i},k)=1)\\}\approx\alpha\cdot
t.$

In this case, we can approximate the conditional variance of $\hat{\tau_{i}}$
as

$Var(\hat{\tau_{i}}\,|\,U=u_{i},\textbf{Z}=\textbf{z}_{i})\approx\frac{\sigma^{2}_{\varepsilon}}{\alpha\cdot
t}+\frac{\sigma^{2}_{\varepsilon}}{t-\alpha\cdot
t}=\frac{\sigma^{2}_{\varepsilon}}{t\cdot\alpha(1-\alpha)}.$

## Appendix C

Consider the basic causal model with $\sigma^{2}_{\varepsilon}=0$. In this