## 1 Introduction

Many studies aim to learn about the causal effects of longitudinal exposures or interventions using data in which these exposures are not randomly assigned. Specifically, consider a study in which baseline covariates, time-varying exposures or treatments, time-varying covariates, and an outcome of interest, such as death, are observed on a sample of subjects followed over time. The exposures of interest can both depend on past covariates and affect future covariates, as well as the outcome. Censoring may also occur, possibly in response to past treatment and covariates. Such data structures are ubiquitous in observational cohort studies. For example, a sample of HIV-infected patients might be followed longitudinally in clinic and data collected on antiretroviral prescriptions, determinants of prescription decisions including CD4+ T cell counts and plasma HIV RNA levels (viral loads), and vital status. Such data structures also occur in randomized trials when the exposure of interest is (non-random) compliance with a randomized exposure or includes non-randomized mediators of an exposure’s effect.

The causal effects of longitudinal exposures (as well as the effects of single time point exposures when the outcome is subject to censoring) can be formally defined by contrasting the distribution of a counterfactual outcome under different “interventions” to set the values of the exposure and censoring variables. For example, the counterfactual survival curve of HIV-infected subjects following immunological failure of antiretroviral therapy might be contrasted under a hypothetical intervention in which all subjects were switched immediately to a new antiretroviral regimen versus an intervention in which all subjects remained on their failing therapy [1]. In the presence of censoring due to losses to follow up, these counterfactuals of interest might be defined under a further intervention to prevent censoring. Interventions such as these, under which all subjects in a population are deterministically assigned the same vector of exposure and censoring decisions (for example, do not switch and remain under follow up) are referred to as “static regimes.”

More generally, counterfactuals can be defined under interventions that assign a treatment or exposure level to each subject at each time point based on that subject’s observed past. For example, counterfactual survival might be compared under interventions to switch all patients to second line antiretroviral therapy the first time their CD4+T cell count crosses a certain threshold, for some specified set of thresholds [2]. Such subject-responsive treatment strategies have been referred to as individualized treatment rules, adaptive treatment strategies, or “dynamic regimes” (see, for example, Robins [3]; Murphy et al. [4]; Hernan et al. [5]). Additional examples include strategies for deciding when to start antiretroviral therapy [6, 7] and strategies for modifying dose or drug choice based on prior response and adverse effects. Investigation of the effects of such dynamic regimes makes it possible to learn effective strategies for assigning an intervention based on a subject’s past and is thus relevant to any discipline that seeks to learn how best to use past information to make decisions that will optimize future outcomes.

The static and dynamic regimes described above are longitudinal – they involve interventions to set the value of multiple treatment and censoring variables over time. For example, counterfactual survival under no switch to second line therapy corresponds to a subject’s survival under an intervention to prevent a patient from switching at each time point from immunologic failure until death or the end of the study. A time-dependent causal dose–response curve, which plots the mean of the intervention-specific counterfactual outcome at time *t* as a function of the interventions through time *t*, can be used to summarize the effects of these longitudinal interventions. For example, a plot of the counterfactual survival probability as a function of time since immunologic failure, for a range of alternative CD4+ T cell count thresholds used to initiate a switch captures the effect of alternative switching strategies on survival.

Formal causal frameworks provide a tool to establish the conditions under which such causal dose–response curves can be identified from the observed data. Longitudinal static and dynamic regimes are often subject to time-dependent confounding – time-varying variables may confound the effect of future treatments while being affected by past treatment [8]. Traditional approaches to the identification of point treatment effects, which are based on selection of a single set of covariates for regression or stratification-based adjustment, break down when such time-dependent confounding is present. However, the mean counterfactual outcome under a longitudinal static or dynamic regime may still be identified under the appropriate sequential randomization and positivity assumptions (reviewed in Robins and Hernan [9]).

Under these assumptions, causal dose–response curves can be estimated by generating separate estimates of the mean counterfactual outcome for each time point and intervention (or regime) of interest. For example, one could generate separate estimates of the counterfactual survival curve for each CD4-based threshold for switching to second line therapy. In this manner, one obtains fits of the time-dependent causal dose–response curve for each of a range of possible thresholds, which together summarize how the mean counterfactual outcome at time *t* depends on the choice of threshold.

A number of estimators can be used to estimate intervention-specific mean counterfactual outcomes. These include inverse probability weighted (IPW) estimators (for example, [3, 5, 10]), “G-computation” estimators (typically based on parametric maximum likelihood estimation of the non-intervention components of the data generating process) (for example, [7, 11, 12]), augmented-IPW estimators (for example, [13–16, 31]), and targeted maximum likelihood (or minimum loss) estimators (TMLEs) (for example, [17, 18]). In particular, van der Laan and Gruber [19] combine the targeted maximum likelihood framework [20, 21] with important insights and the iterated conditional expectation estimators established in Robins [3, 29] and Bang and Robins [22].

Both the theoretical validity and the practical utility of these estimators rely, however, on reasonable support for each of the interventions of interest, both in the true data generating distribution and in the sample available for analysis. For example, in order to estimate how survival is affected by the threshold CD4 count used to initiate an antiretroviral treatment switch, a reasonable number of subjects must in fact switch at the time indicated by each threshold of interest. Without such support, estimators of the intervention-specific outcome will be ill-defined or extremely variable. Although one might respond to this challenge by creating coarsened versions of the desired regimes, so that sufficient subjects follow each coarsened version, such a method introduces bias and leaves open the question of how to choose an optimal degree of coarsening.

Since adequate support for every intervention of interest is often not available, Robins [23] introduced marginal structural models (MSMs) that pose parametric or small semiparametric models for the counterfactual conditional mean outcome as a function of the choice of intervention and time. For example, static MSMs have been used to summarize how the counterfactual hazard of death varies as a function of when antiretroviral therapy is initiated [24] and when an antiretroviral regimen is switched [25]. The extrapolation assumptions implicitly defined by non-saturated MSMs make it possible to estimate the coefficients of the model, and thereby the causal dose–response curve, even when few or no subjects follow some interventions of interest.

While MSMs were originally developed for static interventions [8, 10, 23, 24] they naturally generalize to classes of dynamic (or even more generally, stochastic) interventions as shown in van der Laan and Petersen [2] and Robins et al. [26]. Dynamic MSMs have been used, for example, to investigate how counterfactual hazard of death varies as a function of CD4+ T cell count threshold used to initiate antiretroviral therapy [6] or to switch antiretroviral therapy regimens [2]. Because the true shape of the causal dose–response curve is typically unknown, we have suggested that MSMs be used as working models. The target causal coefficients can then be defined by projecting the true causal dose–response curve onto this working model [20, 27].

The coefficients of both static and dynamic MSMs are frequently estimated using IPW estimators [2, 8, 10, 26]. These estimators have a number of attractive qualities: they can be intuitively understood, they are easy to implement, and they provide an influence curve-based approach to standard error estimation. However, IPW estimators also have substantial shortcomings. In particular, they are biased if the treatment mechanism used to construct the weights is estimated poorly (for example, using a misspecified parametric model). Further, IPW estimators are unstable in settings of strong confounding (near or partial positivity violations) and the resulting bias in both point and standard error estimates can result in poor inference (for a review of this issue see Petersen et al. [28]). Dynamic MSMs can exacerbate this problem, as the options for effective weight stabilization are limited [6, 26].

Asymptotically efficient and double robust augmented-IPW estimators of the estimand corresponding to longitudinal static MSM parameters were developed by Robins and Rotnitzky [14], Robins [13], Robins et al. [16]. These estimators are defined as a solution of an estimating equation, and as a result may be unstable due to failure to respect the global constraints implied by the model and the parameter. Robins [13, 29] and Bang and Robins [22] introduced an alternative double robust estimating equation-based estimator of longitudinal MSM parameters based on the key insight that both the statistical target parameter and the corresponding augmented-IPW estimating function (efficient influence curve) for MSMs on the intervention-specific mean can be represented as a series of iterated conditional expectations. In addition, they proposed a targeted sequential regression method to estimate the nuisance parameters of the augmented-IPW estimating equation. This innovative idea allowed construction of a double robust estimator that relies only on estimation of minimal nuisance parameters beyond the treatment mechanism.

In this paper, we describe a double robust substitution estimator of the parameters of a longitudinal marginal structural working model. The estimator presented incorporates the key insights and prior estimator of Robins [13, 29] and Bang and Robins [22] into the TMLE framework. Specifically, we expand on this prior work in several ways. We propose a TMLE for marginal structural working models for longitudinal dynamic regimes, possibly conditional on pre-treatment covariates. The TMLE described is defined as a substitution estimator rather than as solution to an estimating equation and incorporates data-adaptive/machine learning methods in generating initial fits of the sequential regressions. Finally, we further generalize the TMLE to apply to a larger class of parameters defined as arbitrary functions of intervention-specific means across a user-supplied class of interventions.

TMLE for the parameters of a MSM for “point treatment” problems, in which adjustment for a single set of covariates known not to be affected by the intervention of interest is sufficient to control for confounding, including history-adjusted MSMs, have been previously described [30, 31]. However, the parameter of a longitudinal MSM on the intervention-specific mean under sequential interventions subject to time-dependent confounding is identified as a distinct, and substantially more complex, estimand than the estimand corresponding to a point treatment MSM, and thus requires distinct estimators. An alternative TMLE for longitudinal static MSMs, which we refer to as a stratified TMLE, was described by Schnitzer et al. [32]. The stratified TMLE uses the longitudinal TMLE of van der Laan and Gruber [19] for the intervention-specific mean to estimate each of a set of static treatments and combines these estimates into a fit of the coefficients of a static longitudinal MSM on both survival and hazard functions. The stratified TMLE [32] resulted in substantially lower standard error estimates than an IPW estimator in an applied data analysis and naturally generalizes to dynamic MSMs. However, it remains vulnerable when there is insufficient support for some interventions of interest. In contrast, the TMLE we describe here pools over the set of dynamic or static interventions of interest as well as optionally over time when updating initial fits of the likelihood. It thus substantially relaxes the degree of data support required to remain an efficient double robust substitution estimator.

In summary, a large class of causal questions can be formally defined using static and dynamic longitudinal MSMs, and the parameters of these models can be identified from non-randomized data under well-studied assumptions. This article describes a TMLE that builds on the work of Robins [13, 29] and Bang and Robins [22] in order to directly target the coefficients of a marginal structural (working) model for a user-supplied class of longitudinal static or dynamic interventions. The theoretical properties of the pooled TMLE are presented, its implementation is reviewed, and its practical performance is compared to alternatives using both simulated and real data. R code [33] implementing the estimator and evaluating it in simulations is provided in online supplementary materials and as an open source R library ltmle [34].

### 1.1 Organization of paper

In Section 2, we define the observed data and a statistical model for its distribution. We then specify a non-parametric structural equation model for the process assumed to generate the observed data. We define counterfactual outcomes over time based on static or dynamic interventions on multiple treatment and censoring nodes in this system of structural equations. Our target causal quantity is defined using a marginal structural working model on the mean of these intervention-specific counterfactual outcomes at time *t*. The general case we present includes marginal structural working models on both the counterfactual survival and the hazard. We briefly review the assumptions under which this causal quantity is identified as a parameter of the observed data distribution. The statistical estimation problem is thus defined in terms of the statistical model and statistical target parameter.

Section 3 presents the TMLE defined by (a) representation of the statistical target parameter in terms of an iteratively defined set of conditional mean outcomes, (b) an initial estimator for the intervention mechanism and for these conditional means, (c) a submodel through this initial estimator and a loss function chosen so that the generalized score of the submodel with respect to this loss spans the efficient influence curve, (d) a corresponding updating algorithm that updates the initial estimator and iterates the updating till convergence, and (e) final evaluation of the TMLE as a plug-in estimator. We also present corresponding influence curve-based confidence intervals for our target parameter.

Section 4 illustrates the results presented in Section 3 using a simple three time point example and focusing on a marginal structural working model for counterfactual survival probability over time. This example is used to clarify understanding of notation and to provide a step-by-step overview of implementation of the pooled TMLE.

Section 5 compares the pooled TMLE described in this paper with alternative estimators for the parameters of longitudinal dynamic MSMs for survival. We provide a brief overview of the stratified TMLE [32], discuss scenarios in which each estimator may be expected to offer superior performance, and illustrate the breakdown of the stratified TMLE in a finite sample setting in which some interventions of interest have no support. As IPW estimators are currently the most common approach used to fit longitudinal dynamic MSMs, we also discuss two IPW estimators for these parameters.

Section 6 presents a simulation study in which the pooled TMLE is implemented for a marginal structural working model for survival at time *t*. Its performance is compared to IPW estimators and to the stratified TMLE for a simple data generating process and in a simulation designed to be similar to the data analysis presented in the following section, which includes time-dependent confounding and right censoring.

Section 7 presents the results of a data analysis investigating the effect of switching to second line therapy following immunologic failure of first line therapy using data from HIV-infected patients in the International Epidemiological Databases to Evaluate AIDS (IeDEA), Southern Africa. Throughout the paper, we illustrate notation and concepts using a simplified data structure based on this example.

Appendices contain a derivation of the efficient influence curve, further simulation details, an alternative TMLE, and reference table for notation. In online supplementary files, we present R code that implements the pooled TMLE, the stratified TMLE, and two IPW estimators for a marginal structural working model of survival. A corresponding publicly available R-package, ltmle, was released in May 2013 (http://cran.r-project.org/web/packages/ltmle/).

## 2 Definition of statistical estimation problem

Consider a longitudinal study in which the observed data structure *O* on a randomly sampled subject is coded as

*t*, and

*t*. We observe

*n*independent and identically distributed (i.i.d.) copies

*O*, and we will denote the probability distribution of

*O*with

**Running example**. Here and in subsequent sections, we illustrate notation using an example in which *n* i.i.d. HIV-infected subjects with immunological failure on first line therapy are sampled from some target population. Here *t* and *t*. In addition to baseline values of these time-varying covariates, *t*; in our simplified example, we assume no right censoring. For notational convenience, after a subject dies all variables for that subject are defined as equal to their last observed value.

### 2.1 Statistical model

We use the notation *L* from

We use *k*, given the observed past (including past CD4 count and switching history), and *k* given the observed past (deterministically equal to one for those time points at which a subject has already switched).

The probability distribution *O* can be factorized according to the time-ordering as

### 2.2 Causal model and counterfactuals of interest

By specifying a structural causal model [35, 36] or equivalently, a system of non-parametric structural equations, it is assumed that each component of the observed longitudinal data structure (e.g.

To continue our HIV example, we might specify a causal model in which both time-varying CD4 count, death, and the decision to switch potentially depended on a subject’s entire observed past, as well as unmeasured factors. Alternatively, if we knew that switching decisions were made only in response to a subject’s most recent CD4 count and baseline covariates, the parent set of

This causal model represents a model *O* in terms of the distribution of the random variables *O* would have had under a specified intervention to set the value of the intervention nodes

The intervention of interest might be static, with

Given a rule *d*, the counterfactual random variable *L* and is denoted with

### 2.3 Marginal structural working model

Our causal quantity of interest is defined using a marginal structural working model to summarize how the mean counterfactual outcome at time *t* varies as a function of the intervention rule *d*, time point *t*, and possibly some baseline covariate *V* that is a function of the collection of all baseline covariates *V* (as well as choice of *V* will be defined as the empty set. In other cases, it may be of interest to estimate how the causal dose–response curve varies depending on the value of some subset of baseline variables.

We specify a working model

Such a

To be completely general, we will define our causal quantity of interest as a function *f* of

### 2.3.1 Choice of a weight function $h\left(d\mathrm{,}t\mathrm{,}V\right)$

Unless one is willing to assume that the MSM *d* through time *t* within strata of *V* gives greater weight to those rule, time, and baseline strata combinations with more support in the data, and zero weight to values

### 2.3.2 Running example

Continuing our HIV example, recall that static regimes are a special case of dynamic regimes and define the set of treatment rules of interest *V* defined as the empty set). Alternatively, we might investigate how survival under a specific switch time differs among subjects that have a CD4+ T cell count

The true time-dependent causal dose–response curve *d* implies a single vector *d* and *d*. One might then specify the following marginal structural working model to summarize how the counterfactual probability of death by time *t* varies as a function of *t* and assigned switch time:

### 2.4 Identifiability and definition of statistical target parameter

We assume the sequential randomization assumption [11]

We further assume positivity, informally an assumption of support for each rule of interest across covariate histories compatible with that rule of interest. Specifically, for each

*G*-computation formula

*G*-computation formula

*G*-computation formulas

Let

*O*into a vector of parameter values

The statistical estimation problem is now defined: We observe *n* i.i.d. copies *measured* confounders.

## 3 Pooled TMLE of working MSM for dynamic treatments and time-dependent outcome process

The TMLE algorithm starts out with defining the target parameter as a *Q*. It requires the derivation of the efficient influence curve *g*, chosen so that

An estimator of

Robins [13, 29] and Bang and Robins [22] reformulate the statistical target parameter and corresponding efficient influence curve for longitudinal MSMs on the intervention-specific mean as a series of iterated conditional expectations. For completeness, and to generalize to dynamic marginal structural working models possibly conditional on baseline covariates, as well as to general functions of the intervention-specific mean across a user-supplied class of interventions, we present this reformulation of the statistical target parameter below. The corresponding efficient influence curve is given in Appendix B. We will use the common notation *P*.

### 3.1 Reformulation of the statistical target parameter in terms of iteratively defined conditional means

For the case

*P*through

*t*, we can use the following recursive definition of

To obtain

In general, the above shows that we can represent *f*.

### 3.2 Estimation of intervention mechanism ${g}_{0}$

The log-likelihood loss function for

If there are certain variables in the *Y* nodes only via their effects on

### 3.3 Loss functions and initial estimator of ${Q}_{0}$

We will alternate notation *Q* through

*d*. For example, fitting a parametric logistic regression model of

In this loss function, the outcome

By summing over *t*, and

We will use the log-likelihood loss

### 3.4 Non-targeted substitution estimator

These loss functions imply a sequential regression methodology for fitting each of the required components of *d*, and recall that

Given the regression fit

The pooled TMLE presented below utilizes this same sequential regression algorithm and makes use of these initial fits of

### 3.5 Loss function and least favorable submodel that span the efficient influence curve

Recall that we use the notation

Consider also a submodel

### 3.6 Pooled TMLE

We now describe the TMLE algorithm based on the above choices of (1) the representation of

Recall that we define *d* and that

The updating steps are implemented as follows: for each

This defines the TMLE

The TMLE of

An alternative pooled TMLE that only fits a single

### 3.7 Statistical inference for pooled TMLE

By construction, the TMLE solves the efficient influence curve equation

Specifically, if

*h*as known. If

*h*is estimated, then this variance estimator still provides valid statistical inference for the statistical target parameter defined by the estimated

*h*.

In the case that

## 4 Implementation of the pooled TMLE

The previous section reformulated the statistical parameter in terms of iteratively defined conditional means and described a pooled TMLE for this representation. In this section, we illustrate notation and implementation of this TMLE to estimate the parameters of a marginal structural working model on counterfactual survival over time.

### 4.1 The statistical estimation problem

We continue our motivating example, in which the goal is to learn the effect of switch time on survival. For illustration, focus on the two time point case where *n* i.i.d. copies *t*, and *t*. Assume all subjects are alive at baseline (*t*. We assume no right censoring so that all subjects are followed until death or the end of the study (for convenience define variable values after death as equal to their last observed value). We specify a NPSEM such that each variable may be a function of all variables that precede it and an independent error, and assume the corresponding non-parametric statistical model for

Define the set of treatment rules of interest *d* implies a single vector *d*, and *d*. We specify the following marginal structural working model for counterfactual probability of death by time *t* under rule *d*:

Under the sequential randomization (2) and positivity (3) assumptions,

### 4.1.1 Reformulation of the statistical target parameter

Note that *d* (denoted

### 4.2 Estimator implementation

We begin by describing implementation of a simple plug-in estimator of

### 4.2.1 Non-targeted substitution estimator

- 1.For each rule of interest
, corresponding to each possible switch time, generate a vector$d\in D$ of length${\stackrel{\u02c9}{Q}}_{1,n}^{d,2}$ *n*for :$t=2$ - (a)Fit a logistic regression of
on$Y\left(2\right)$ and generate a predicted value for each subject by evaluating this regression fit at$L\left(1\right),L\left(0\right),A\left(1\right),A\left(0\right)$ . Note$A\left(1\right)=d\left(1\right),A\left(0\right)=d\left(0\right)$ , so the regression need only be fit and evaluated among subjects who remain alive at time 1. This gives a vector${E}_{0}\left(Y\right(2\left)|Y\right(1)=1)=1$ of length${\stackrel{\u02c9}{Q}}_{2,n}^{d,2}$ *n*. - (b)Fit a logistic regression of the predicted values generated in the previous step on
. Generate a new predicted value for each subject by evaluating this regression fit at$L\left(0\right),A\left(0\right)$ . This gives a vector$A\left(0\right)=d\left(0\right)$ of length${\stackrel{\u02c9}{Q}}_{1,n}^{d,2}$ *n*.

- (a)Fit a logistic regression of
- 2.For each rule of interest
generate a vector$d\in D$ of length${\stackrel{\u02c9}{Q}}_{1,n}^{d,1}$ *n*for : Fit a logistic regression of$t=1$ on$Y\left(1\right)$ and generate a predicted value for each subject by evaluating this regression fit at$L\left(0\right),A\left(0\right)$ .$A\left(0\right)=d\left(0\right)$ - 3.The previous steps generated
. Stack these vectors to give a single vector with length equal to the number of subjects${\stackrel{\u02c9}{Q}}_{1,n}=({\stackrel{\u02c9}{Q}}_{1,n}^{d,t},:d\in D,t\in \{1,2\left\}\right)$ *n*times the number of rules times the number of time points$\left(D\right)$ . Fit a pooled logistic regression of$(n\times 3\times 2)$ on${\stackrel{\u02c9}{Q}}_{1,n}$ according to model$(d,t)$ (eq. 7), with weights given by${m}_{\beta}$ (here equal to 1). This gives an estimator of the target parameter$h(d,t)$ .$\Psi \left(Q\right)$

We now describe how the pooled TMLE modifies this algorithm to update the initial estimator

### 4.2.2 Pooled TMLE

- 1.Estimate
and${P}_{0}\left(A\right(1\left)|A\right(0),L(1),L(0\left)\right)$ . Denote these estimators${P}_{0}\left(A\right(0\left)|L\right(0\left)\right)$ and${g}_{1,n}$ , respectively, and let${g}_{0,n}$ denote their product. In our example, this step involves estimating the conditional probability of switching at time 0 given baseline CD4 count, and estimating the conditional probability of switching at time 1, given a subject did not switch at time 1, did not die at time 1, and CD4 count at times 0 and 1.${g}_{0:1,n}={g}_{0,n}{g}_{1,n}$ - 2.Generate a vector
of length${\stackrel{\u02c9}{Q}}_{2,n}^{d,2,\ast}$ for$n\times \left(D\right)$ ,$t=2$ :$k=2$ - (a)Fit a logistic regression of
on$Y\left(2\right)$ . Generate a predicted value for each subject and each$L\left(1\right),L\left(0\right),A\left(1\right),A\left(0\right)$ by evaluating this regression fit at$d\in D$ . Note that$A\left(1\right)=d\left(1\right),A\left(0\right)=d\left(0\right)$ , so the regression need only be fit and evaluated among subjects who remain alive at time 1. This gives a vector of initial values${E}_{0}\left(Y\right(2\left)|Y\right(1)=1)=1$ of length${\stackrel{\u02c9}{Q}}_{2,n}^{d,2}$ .$n\times \left(D\right)$ - (b)For each subject,
, create a vector consisting of one copy of$i=1,\dots ,n$ for each${Y}_{i}\left(2\right)$ . Stack these copies to create a single vector of length$d\in D$ , denoted$n\times \left(D\right)$ .${\stackrel{\u02c9}{Q}}_{3,n}^{d,2,\ast}$ - (c)For each subject
and each$i=1,\dots ,n$ , create a new multidimensional weighted covariate:$d\in D$ In our example,$h(d,t=2)\frac{\frac{d}{d\beta}{m}_{\beta}(d,t=2)}{{m}_{\beta}(1-{m}_{\beta})}\frac{I({\stackrel{\u02c9}{A}}_{i}=d)}{{g}_{0:1,n}\left({O}_{i}\right)}.$ , and$h(d,t)=1$ equals 1,$\frac{\frac{d}{d\beta}{m}_{\beta}(d,t)}{{m}_{\beta}(1-{m}_{\beta})}$ *t*, and for the derivative taken with respect to$d(t-1)(t-{s}_{d})$ and${\beta}_{0},{\beta}_{1},$ , respectively. The following${\beta}_{2}$ matrix would thus be generated for each subject$3\times 3$ *i*, with rows corresponding to switch at time 0, time 1, or do not switch:Stack these matrices to create a matrix with$\left(\begin{array}{ccc}\frac{1\times I\left({A}_{i}\right(0)=1,{A}_{i}(1)=1)}{{g}_{0:1,n}\left({O}_{i}\right)}& \frac{2\times I\left({A}_{i}\right(0)=1,{A}_{i}(1)=1)}{{g}_{0:1,n}\left({O}_{i}\right)}& \frac{2\times I\left({A}_{i}\right(0)=1,{A}_{i}(1)=1)}{{g}_{0:1,n}\left({O}_{i}\right)}\\ \frac{1\times I\left({A}_{i}\right(0)=0,{A}_{i}(1)=1)}{{g}_{0:1,n}\left({O}_{i}\right)}& \frac{2\times I\left({A}_{i}\right(0)=0,{A}_{i}(1)=1)}{{g}_{0:1,n}\left({O}_{i}\right)}& \frac{1\times I\left({A}_{i}\right(0)=0,{A}_{i}(1)=1)}{{g}_{0:1,n}({O}_{i})}\\ \frac{1\times I\left({A}_{i}\right(0)=0,{A}_{i}(1)=0)}{{g}_{0:1,n}\left({O}_{i}\right)}& \frac{2\times I\left({A}_{i}\right(0)=0,{A}_{i}(1)=0)}{{g}_{0:1,n}\left({O}_{i}\right)}& \frac{0\times I\left({A}_{i}\right(0)=0,{A}_{i}(1)=0)}{{g}_{0:1,n}\left({O}_{i}\right)}\\ & & \end{array}\right)$ rows and one column for each component of$n\times \left(D\right)$ (here,$\beta $ ).$3n\times 3$ - (d)Among those subjects still alive at the previous time point (
), fit a pooled logistic regression of$Y\left(1\right)=0$ (the${\stackrel{\u02c9}{Q}}_{3,n}^{d,2,\ast}$ vector) on the weighted covariates created in the previous step, suppressing the intercept and using as offset$Y\left(2\right)$ , the logit of the initial predicted values for$\phantom{\rule{0ex}{0ex}}Logit\phantom{\rule{0ex}{0ex}}{\stackrel{\u02c9}{Q}}_{2,n}^{d,2,}$ and$t=2$ . This gives a fit for multivariate$k=2$ . Denote this fit${\in}_{2}$ .${\in}_{2,n}=({\in}_{2,n}^{{\beta}_{0}},{\in}_{2,n}^{{\beta}_{1}},{\in}_{2,n}^{{\beta}_{2}})$ - (e)Generate
by evaluating the logistic regression fit in the previous step at each${\stackrel{\u02c9}{Q}}_{2,n}^{d,2,\ast}$ among those subjects for whom$d\in D$ . For subject$Y\left(1\right)=0$ *i*and rule*d*, evaluate$\text{Expit}\text{\hspace{0.05em}}\left(\text{\hspace{0.05em}}\text{Logit}\text{\hspace{0.05em}}\right({\overline{Q}}_{\mathrm{2,}n}^{d\mathrm{,2}}\left({\overline{L}}_{i}\mathrm{,}d\right))+\frac{{\epsilon}_{\mathrm{2,}n}^{{\beta}_{0}}}{{g}_{\mathrm{0,}n}\left(d\right(0\left)\right|{L}_{i}\left(0\right)\left){g}_{\mathrm{1,}n}\right(d\left(1\right)\left|{L}_{i}\right(0\left),d\right(0\left),{L}_{i}\right(1\left)\right)}+$ $+\frac{{\in}_{2,n}^{{\beta}_{1}}\times 2}{{g}_{0,n}\left(d\right(0\left)|{L}_{i}\right(0\left)\right){g}_{1,n}\left(d\right(1\left)|{L}_{i}\right(0),d(0),{L}_{i}(1\left)\right)}$ For subjects with$+\frac{{\in}_{2,n}^{{\beta}_{2}}\times d\left(1\right)(2-{s}_{d})}{{g}_{0,n}\left(d\right(0\left)|{L}_{i}\right(0\left)\right){g}_{1,n}\left(d\right(1\left)|{L}_{i}\right(0),d(0),{L}_{i}(1\left)\right)}).$ ,$Y\left(1\right)=1$ . This gives an updated vector${\stackrel{\u02c9}{Q}}_{2,n}^{d,2,\ast}={\stackrel{\u02c9}{Q}}_{2,n}^{d,2}=1$ of length${\stackrel{\u02c9}{Q}}_{2,n}^{d,2,\ast}$ .$n\times \left(D\right)$

- (a)Fit a logistic regression of
- 3.Generate a vector
of length${\stackrel{\u02c9}{Q}}_{1,n}^{d,2,\ast}$ for$n\times \left(D\right)$ ,$t=2$ :$k=1$ - (a)Fit a logistic regression of
(generated in the previous step) on${\stackrel{\u02c9}{Q}}_{2,n}^{d,2,\ast}$ . Generate a predicted value for each subject and each$L\left(0\right),A\left(0\right)$ by evaluating this regression fit at$d\in D$ . This gives a vector of initial values$A\left(0\right)=d\left(0\right)$ of length${\stackrel{\u02c9}{Q}}_{1,n}^{d,2}$ .$n\times \left(D\right)$ - (b)For each subject
and each$i=1,\dots ,n$ , create the multidimensional weighted covariate as above, now for$d\in D$ :$k=1$ The following$h(d,t=2)\frac{\frac{d}{d\beta}{m}_{\beta}(d,t=2)}{{m}_{\beta}(1-{m}_{\beta})}\frac{I\left({A}_{i}\right(0)=d(0\left)\right)}{{g}_{0,n}\left({O}_{i}\right)}.$ matrix would thus be generated for each subject$3\times 3$ *i*, with rows corresponding to switch at time 0, time 1, or don’t switch:Stack these matrices to create a matrix with$\left(\begin{array}{ccc}\frac{1\times I\left({A}_{i}\right(0)=1)}{{g}_{0,n}\left({O}_{i}\right)}& \frac{2\times I\left({A}_{i}\right(0)=1)}{{g}_{0,n}(,{O}_{i})}& \frac{2\times I\left({A}_{i}\right(0)=1)}{{g}_{0,n}\left({O}_{i}\right)}\\ \frac{1\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}& \frac{2\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}& \frac{1\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}\\ \frac{1\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}& \frac{2\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}& \frac{0\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)},\end{array}\right)$ rows and one column for each dimension of$n\times \left(D\right)$ .$\beta $ - (c)Fit a pooled logistic regression of
(the updated fit generated in step 2) on these weighted covariates, suppressing the intercept and using as offset${\stackrel{\u02c9}{Q}}_{2,n}^{d,2,\ast}$ , the logit of the initial predicted values for$\phantom{\rule{0ex}{0ex}}Logit\phantom{\rule{0ex}{0ex}}{\stackrel{\u02c9}{Q}}_{1,n}^{d,2,}$ and$t=2$ . This gives a fit for multivariate$k=1$ . Denote this fit${\in}_{1}$ .${\in}_{1,n}=({\in}_{1,n}^{{\beta}_{0}},{\in}_{1,n}^{{\beta}_{1}},{\in}_{1,n}^{{\beta}_{2}})$ - (d)Generate
by evaluating the logistic regression fit in the previous step at each${\stackrel{\u02c9}{Q}}_{1,n}^{d,2,\ast}$ . For subject$d\in D$ *i*and rule*d*, evaluateThis gives an updated vector$\text{Expit}\left(\text{Logit}\left({\overline{Q}}_{1,n}^{d,2}\left({L}_{i}\left(0\right),d\left(0\right)\right)\right)+\frac{{\u03f5}_{1,n}^{{\beta}_{0}}}{{g}_{0,n}\left(d\right(0\left)\right|{L}_{i}\left(0\right))}+\frac{{\u03f5}_{1,n}^{{\beta}_{1}}\times 2}{{g}_{0,n}\left(d\right(0\left)\right|{L}_{i}\left(0\right))}+\frac{{\u03f5}_{1,n}^{{\beta}_{2}}\times d\left(1\right)(2-{s}_{d})}{{g}_{0,n}\left(d\right(0\left)\right|{L}_{i}\left(0\right))}\right).$ of length${\stackrel{\u02c9}{Q}}_{1,n}^{d,2,\ast}$ .$n\times \left(D\right)$

- (a)Fit a logistic regression of
- 4.Generate a vector
of length${\stackrel{\u02c9}{Q}}_{1,n}^{d,1,\ast}$ for$n\times \left(D\right)$ ,$t=1$ :$k=1$ - (a)Fit a logistic regression of
on$Y\left(1\right)$ . Generate a predicted value for each subject and each$L\left(0\right),A\left(0\right)$ by evaluating this regression fit at$d\in D$ . This gives a vector of initial values$A\left(0\right)=d\left(0\right)$ of length${\stackrel{\u02c9}{Q}}_{1,n}^{d,1}$ .$n\times \left(D\right)$ - (b)For each subject,
, create a vector consisting of one copy of$i=1,\dots ,n$ for each${Y}_{i}\left(1\right)$ . Stack these copies to create a single vector of length$d\in D$ , denoted$n\times \left(D\right)$ .${\stackrel{\u02c9}{Q}}_{2,n}^{d,1,\ast}$ - (c)For each subject
and each$i=1,\dots ,n$ , create a new multidimensional weighted covariate, for$d\in D$ :$t=1,k=1$ The following$h(d,t=1)\frac{\frac{d}{d\beta}{m}_{\beta}(d,t=1)}{{m}_{\beta}(1-{m}_{\beta})}\frac{I\left({A}_{i}\right(0)=d(0\left)\right)}{{g}_{0,n}\left({O}_{i}\right)}.$ matrix would thus be generated for each subject$3\times 3$ *i*, with rows corresponding to switch at time 0, time 1, or don’t switch:Stack these matrices to create a matrix with$\left(\begin{array}{ccc}\frac{1\times I\left({A}_{i}\right(0)=1)}{{g}_{0,n}\left({O}_{i}\right)}& \frac{1\times I\left({A}_{i}\right(0)=1)}{{g}_{0,n}(,{O}_{i})}& \frac{1\times I\left({A}_{i}\right(0)=1)}{{g}_{0,n}\left({O}_{i}\right)}\\ \frac{1\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}& \frac{1\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}& \frac{0\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}\\ \frac{1\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}& \frac{1\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}& \frac{0\times I\left({A}_{i}\right(0)=0)}{{g}_{0,n}\left({O}_{i}\right)}\end{array}\right)$ rows and one column for each component of$n\times \left(D\right)$ .$\beta $ - (d)Fit a pooled logistic regression of
(the${\stackrel{\u02c9}{Q}}_{2,n}^{d,1,\ast}$ vector) on these weighted covariates, suppressing the intercept and using as offset$Y\left(1\right)$ , the logit of the initial predicted values for$\phantom{\rule{0ex}{0ex}}Logit\phantom{\rule{0ex}{0ex}}{\stackrel{\u02c9}{Q}}_{1,n}^{d,1,}$ and$t=1$ . This gives a fit for multivariate$k=1$ . Denote this fit${\in}_{1}$ .${\in}_{1,n}=({\in}_{1,n}^{{\beta}_{0}},{\in}_{1,n}^{{\beta}_{1}},{\in}_{1,n}^{{\beta}_{2}})$ - (e)Generate
by evaluating the logistic regression fit in the previous step at each${\stackrel{\u02c9}{Q}}_{1,n}^{d,1,\ast}$ . For subject$d\in D$ *i*and rule*d*, evaluateThis gives an updated vector$\text{Expit}\left(\text{Logit}\left({\overline{Q}}_{1,n}^{d,1}\left({L}_{i}\right(0),d(0\left)\right)\right)+\frac{{\u03f5}_{1,n}^{{\beta}_{0}}}{{g}_{0,n}\left(d\right(0\left)\right|{L}_{i}\left(0\right))}+\frac{{\u03f5}_{1,n}^{{\beta}_{1}}}{{g}_{0,n}\left(d\right(0\left)\right|{L}_{i}\left(0\right))}+\frac{{\u03f5}_{1,n}^{{\beta}_{2}}\times d\left(0\right)(1-{s}_{d})}{{g}_{0,n}\left(d\right(0\left)\right|{L}_{i}\left(0\right))}\right).$ of length${\stackrel{\u02c9}{Q}}_{1,n}^{d,1,\ast}$ .$n\times \left(D\right)$

- (a)Fit a logistic regression of
- 5.The previous steps generated
. Stack these vectors to give a single vector with length equal to the number of subjects${\stackrel{\u02c9}{Q}}_{1,n}^{\ast}=({\stackrel{\u02c9}{Q}}_{1,n}^{d,t,\ast}:d\in D,t=1,2)$ *n*times the number of rules times the number of time points$\left(D\right)$ . Fit a pooled logistic regression of$(n\times 3\times 2)$ on${\stackrel{\u02c9}{Q}}_{1,n}^{\ast}$ according model$(d,t)$ (eq. 7), with weights given by${m}_{\beta}$ (here equal to 1). This gives the pooled TMLE of the target parameter$h(d,t)$ .$\Psi \left(Q\right)$

## 5 Comparison with alternative estimators

In this section we compare the TMLE described with several alternative estimators available for dynamic MSMs for survival: non-targeted substitution estimators, IPW estimators, and the stratified TMLE of Schnitzer et al. [32].

### 5.1 Non-targeted substitution estimator

The consistency of non-targeted substitution estimators of *Q* portions of the observed data likelihood. For estimators based on the parametric G-formula this requires correctly specifying parametric estimators for the conditional distributions of all non-intervention nodes given their parents [7, 11, 12, 41]. For the non-targeted estimator described in Section (3.4), this requires consistently estimating the literately defined conditional means

Correct *a priori* specification of parametric models for *Q* non-parametrically, the resulting plug-in estimator has no theory supporting its asymptotic linearity, and will generally be overly biased for the target parameter

### 5.2 Inverse probability weighted estimators

The IPW estimator described in van der Laan and Petersen [2], Robins et al. [26] is commonly used to estimate the parameters of a dynamic MSM. In brief, this estimator is implemented by creating one data line for each subject *i*, for each *t*, and for each *d* for which *d*.

The parameter mapping presented here for the TMLE suggests an alternative IPW estimator for dynamic MSM – namely, implement an IPW estimator for *V* if *V* is discrete) for

The consistency of both IPW estimators relies on having a consistent estimator

### 5.3 Stratified targeted maximum likelihood estimator

Similar to the pooled TMLE, the stratified TMLE [32] also relies on reformulating the statistical target parameter in terms of iteratively defined conditional means and updating initial fits of these conditional means using covariates that are functions of an estimator *t* and non-intervention node *k*, pooling across all rules of interest *t*, non-intervention node *k*, and rule of interest *t* and each rule of interest

Let

The pooled and stratified estimators may nonetheless differ in both their asymptotic and finite sample performance. The stratified TMLE uses a more saturated model when updating

On the other hand, in some cases, it is no longer clear how to implement the stratified TMLE. For example, the target parameter may be defined using a MSM *V*. If *V* is discrete with adequate finite sample support at each value, the stratified TMLE can be applied by estimating *v*. When *V* is continuous, however, or has levels which are not represented in a given finite sample, such an approach will break down for many choices of weight function

In cases where *V* is discrete and there is support for some but not all rules *V*, one option is to define a stratified quasi-TMLE using the initial fit *V* where no data are available to fit *V* in a given sample. However, in such cases, the initial estimator *d*. In other words, both estimators rely on the theoretical positivity assumption on

### 5.3.1 Numerical illustration

We use a simple simulation to illustrate a setting in which the positivity assumption holds, but many rules of interest have no support in a given finite sample. In this setting, the stratified estimator will be biased if the initial estimator

We implemented a simulation with observed data consisting of *n* i.i.d. copies of *Y* is a binary outcome. The data for a given individual *i* were generated by drawing sequentially from the following distributions:

*A*, and

*d*at time

*t*.

Stratified and pooled TMLEs for *d* without support in the data, the stratified estimator uses an intercept only model to estimate

Breakdown of stratified TMLE when some rules

Pooled TMLE | Stratified TMLE | |

Bias | ||

0.1674 | −0.9346 | |

−0.0563 | 0.2039 | |

Bias/SE | ||

0.1821 | −2.3037 | |

−0.2326 | 2.0955 | |

Variance | ||

0.8451 | 0.1646 | |

0.0586 | 0.0095 | |

MSE | ||

0.8714 | 1.0377 | |

0.0616 | 0.0510 | |

95% confidence interval coverage | ||

88% | 88% | |

22% | 33% |

Note: True parameter values:

This breakdown of the stratified TMLE in settings with no support for some rules of interest will not occur if the function *h* is chosen to give a weight of 0 to any rule (or more generally, any *h* changes the target parameter being estimated [27]. Further, even with this choice of weight function, the estimators may still exhibit different finite sample performance in setting with marginal data support. We investigate this possibility further in the following section.

## 6 Simulation study

### 6.1 Overview

In this section, we investigate the relative performance of the pooled TMLE, stratified TMLE, and IPW estimators for the parameters of a marginal structural working model. For each candidate estimator, we report bias, variance, MSE, and 95% confidence interval coverage estimates based on influence curve variance estimators. We note that our influence curve-based estimators assume the weight function

### 6.2 Simulation 1: baseline confounding only

### 6.2.1 Data generating process

We implemented a simulation with observed data consisting of *n* i.i.d. copies of *Y* is a binary outcome. The data for a given individual were generated by drawing sequentially from the following distributions:

### 6.2.2 Target parameter

The target parameter was defined as the projection of *A*, *d* at time, *t* and weight function *d*) ensured that the IPW estimator remained defined and that the updated fit

### 6.2.4 Estimators

This is a static point treatment problem, and thus a number of additional estimators are available. However, we use this as a special case of longitudinal dynamic MSMs and investigate the relative performance of three estimators described in Section 5: the pooled TMLE, the stratified TMLE, and the standard IPW estimator. All estimators were implemented using two estimators of *A* given

### 6.2.5 Results

Results for Simulation 1a are shown in Table 2. When both

Results for Simulation 1b, with both

Simulation 1a

g and Q correct | g correct and Q incorrect | g incorrect and Q correct | |||||||

Pl TMLE | Str TMLE | IPW | Pl TMLE | Str TMLE | IPW | Pl TMLE | Str TMLE | IPW | |

Bias | |||||||||

−0.0047 | − | −0.0260 | − | −0.0083 | − | −0.4578 | |||

−0.0038 | −0.0038 | ||||||||

Bias/SE | |||||||||

−0.0258 | − | −0.1450 | − | −0.0485 | − | −2.4870 | |||

−0.0336 | −0.0336 | ||||||||

Variance | |||||||||

MSE | |||||||||

95% Cl Coverage | |||||||||

Notes:

Simulation 1b

Pooled TMLE | Stratified TMLE | IPW | |

Bias | |||

−0.0025 | − | −0.0486 | |

−0.0007 | |||

Bias/SE | |||

−0.0092 | − | −0.1618 | |

−0.0103 | |||

Variance | |||

MSE | |||

95% Cl coverage | |||

Notes: *g* and *Q* are correct; True parameter values:

### 6.3 Simulation 2: resembling data analysis

In this simulation, we used a data generating process designed to resemble the data analysis presented in the following section, in which the goal was to investigate the effect of delayed switch to a new antiretroviral regimen on mortality among HIV-infected patients who have failed first line therapy. The data generating process thus contains both baseline and time-dependent confounders of a longitudinal binary treatment (time to switch), a repeated measures binary outcome (survival over time), and informative right censoring due to two causes (database closure and loss to follow up).

### 6.3.1 Data generating process

We implemented a simulation with observed data consisting of *n* i.i.d. copies of

*W*was a non-time-varying baseline covariate (

*t*(square root transformed), and

*t*. The intervention nodes for a given time point

*t*were

*t*,

*t*, and

*t*. In brief, the data for a given individual were generated by first drawing baseline characteristics

*W*, then for each time point

*t*, for as long as the subject remained alive and uncensored,

- 1.Drawing a time updated CD4 count
given$CD4\left(t\right)$ *W*, prior CD4 counts, and regimen status at the prior time point ( )${A}_{1}(t-1)$ - 2.Determining censoring due to database closure
using a Bernoulli trial with probability dependent on${C}_{1}\left(t\right)$ *W*. - 3.If still uncensored, determining censoring due to loss to follow up
using a Bernoulli trial with probability dependent on${C}_{2}\left(t\right)$ *W*, prior CD4 count and regimen status at the prior time point ( ).${A}_{1}(t-1)$ - 4.If still uncensored and not yet switched, determining switching using a Bernoulli trial with probability dependent on
*W*and prior CD4 count. - 5.Determining death using a Bernoulli trial with probability dependent on
*W*, prior CD4 counts and regimen status$A\left(t\right)$

### 6.3.2 Target parameter

The target parameter was defined as the projection of the counterfactual survival curve for each switch time, *d*, *d*, and with

### 6.3.3 Estimators

We implemented the pooled TMLE, the stratified TMLE, the IPW estimator based on estimating

The intervention rules *t*. As noted by Picciotto et al. [42], one option, adopted by us here, is to instead define the interventions of interest as dynamic (switch at time

All estimators were implemented using an estimator

### 6.3.4 Results

Results for Simulation 2 are shown in Table 4. In this simulation, both the pooled and the stratified TMLEs were essentially unbiased for all coefficients, and the two TMLEs had comparable MSEs. Both TMLEs exhibited less than nominal 95% confidence interval coverage when using influence curve-based variance estimators. The anti-conservative performance of the influence curve-based variance estimator is likely due to the presence of practical positivity violations and relatively rare outcomes; the fact that the weight function was treated as known may also make a small contribution. Further work is needed to develop improved diagnostics and variance estimators in these settings.

Simulation 2: resembling data analysis

Pl TMLE | Str TMLE | Stan IPW | Str IPW | |

Bias | ||||

−0.0239 | − | |||

−0.0041 | − | |||

−0.0006 | ||||

Bias/SE | ||||

−0.0867 | − | |||

−0.0849 | − | |||

−0.0096 | ||||

Variance | ||||

MSE | ||||

95% CI coverage | ||||

Notes: True parameter values:

In contrast, both IPW estimators were substantially biased for

## 7 Data analysis

We analyzed data from the International Epidemiological Databases – Southern Africa in order to investigate the effect of switching to second line therapy on mortality among HIV-infected patients with immunological failure on first line antiretroviral therapy. The data set and clinical question are described in detail in Gsponer et al. [1]. In brief, data were drawn from clinical care facilities in Zambia and Malawi, in which HIV-infected patients were followed longitudinally in clinic and data were collected on baseline demographic and clinical variables (sex, age, and baseline disease stage), time-varying CD4 count, and time-varying treatment, summarized here as switch to second line therapy. Death was independently reported. The 2,627 subjects meeting WHO immunological failure criteria were included in the current analysis beginning at time of immunologic failure. Following common practice and prior analysis, time was discretized into 3-month intervals; time updated CD4 count was coded such that CD4 count for an interval preceded switching decisions in that interval. Data on a subject were censored at time of database closure or after four consecutive intervals without clinical contact.

The data structure and target parameter were identical to those described in Simulation 2, with

Results are given in Table 5. The IPW estimates for the effect of switching on mortality (

The poor coverage observed in Simulation 2, despite absence of bias for the TMLEs, suggests that the influence curve-based variance estimators may be systematically underestimating the true variance in this analysis. While the non-parametric bootstrap offers an alternative approach, it is not expected to resolve the challenge of anti-conservative variance estimation in the setting of practical positivity violations. Intuitively, rare treatment/covariate combinations, despite being theoretically possible, may simply not occur in a given finite sample and as a result, the corresponding extreme weights implied by these combinations will not occur. Because the non-parametric bootstrap resamples from the same finite sample, it fails to address the underlying problem. Indeed, the bootstrap-based confidence intervals in the data analysis were slightly smaller than confidence intervals based on the influence curve. Thus in this realistic setting of rare outcomes and moderately strong confounding, our results caution against reliance on either approach to variance estimation, for either IPW or TML estimators, and suggest that additional work developing robust variance estimators in this setting is urgently needed.

Data analysis

Estimate | ^{1} | ^{2} | ^{3} | ^{4} | |

Pooled TMLE | |||||

–4.8291 | – | –4.4348 | – | –4.5436 | |

–0.1246 | – | –0.0217 | – | –0.0496 | |

Stratified TMLE | |||||

–4.8382 | – | –4.4407 | – | –4.5790 | |

–0.1262 | – | –0.0221 | – | ||

Standard IPTW | |||||

–4.9166 | – | –4.5196 | – | –4.6413 | |

–0.0696 | –0.0575 | ||||

Stratified IPTW | |||||

–5.0811 | – | –4.6601 | – | –4.8252 | |

–0.0539 | –0.0374 |

Notes:

In addition to the issues raised above, limitations of the analysis include the potential for unmeasured confounding by factors such as unmeasured health status and adherence, as well as bias due to incomplete health reporting, resulting in censoring due to loss to follow up that directly depends on death [43, 44]. These results also do not contradict the previous published results of Gsponer et al. [1], which found a protective effect of switching using a static IPW estimator for a hazard MSM; such an IPW estimator might perform substantially better than the dynamic IPW estimator for a survival MSM implemented here.

## 8 Discussion

In summary, we have presented a pooled TMLE for the parameters of static and dynamic longitudinal MSMs that builds on prior work by Robins [13, 29] and Bang and Robins [22]. We evaluated the performance of this estimator using simulated data and applied it, together with alternatives, in a data analysis. Both theory and simulations suggest settings in which the pooled TMLE offers advantages over alternative estimators. Software implementing this estimator, together with competitors, is included in supplementary files and is publicly available as part of R library ltmle (http://cran.r-project.org/web/packages/ltmle/).

The pooled TMLE presented in this paper, together with corresponding open source software, provides a new tool for estimation of the parameters of static or dynamic MSMs. It has clear theoretical advantages over available alternatives. Unlike IPW and augmented-IPW estimators, it is a substitution estimator. Unlike IPW estimators, it is double robust and asymptotically efficient depending on the initial estimators of *g* and *Q*. Unlike the previously proposed stratified TMLE, it does not require support in the data for every rule of interest and remains defined in the case that the target parameter is defined using a marginal structural working model conditional on a continuous baseline covariate.

In settings where some subset of discrete intervention rules has adequate support in a given sample, an alternative approach is to compare only this subset of rules [2]. However, in many settings smoothing over a large number of poorly supported rules is appropriate. For example, for a set of rules indexed by a continuous or multiple level ordered variable, smoothing over this variable provides a way to define a causal effect of interest despite inadequate support to estimate the counterfactual outcome under any of these rules individually.

The TMLE presented in this paper was developed for a causal model in which the non-intervention variables may be a function of the entire observed past (

Our simulations suggest that both stratified and pooled TMLEs may outperform both the IPW estimator typically used for dynamic MSMs, as well as an alternative “stratified” IPW estimator, in some settings with sparse data/near positivity violations. However, further work is needed to confirm this preliminary observation. Although the theory in this paper was developed for the general case of dynamic MSMs, including models of the time-specific hazard or survival functions, we focused our software implementation, examples, and simulations on MSMs for survival. The practical performance of the pooled TMLE relative to alternative estimators also remains to be investigated for the case of static and dynamic MSMs on the hazard. It also remains to implement and evaluate the relative performance of the alternative pooled TMLE described in Appendix C, in which the updating step pools not only over all rules of interest but also over all time points. Finally, the relative performance of the TMLE compared to double robust efficient estimating equation-based estimators for longitudinal MSM parameters, including those of Robins [13, 29] and Bang and Robins [22], remains to be evaluated.

Importantly, our simulations and data analysis illustrate the need for improved variance estimators for both TMLE and IPW in settings with moderately strong confounding, multiple time points, and relatively rare outcomes. Improved approaches to variance estimation and valid inference, as well as appropriate diagnostics to warn applied practitioners of settings in which coverage is likely to be poor, are crucial research priorities.

This work was supported by NIH Grant #U01AI069924 (NIAID, NICHD, and NCI) (PIs: Egger and Davies), the Doris Duke Charitable Foundation Grant #2011042 (PI: Petersen), and NIH Grant #R01AI074345-06 (NIAID) (PI: van der Laan).

## Notation

Partial list of notation

Variable | Description |

Observed data | |

covariates at time t | |

outcome at time t | |

intervention at time t | |

treatment at time t | |

right censoring at time t | |

history of intervention nodes | |

history of non-intervention nodes | |

observed data structure | |

parents of non-intervention nodes | |

parents of intervention nodes | |

Counterfactuals | |

set of dynamic intervention rules | |

intervention rule | |

counterfactual L under rule d | |

counterfactual Y under rule d | |

Statistical counterparts | |

random variable with distribution | |

equal to | |

outcome-component of | |

Marginal structural working model | |

working model for | |

index set of time points (often | |

V | “effect modifier” of interest, a function of |

Distributions | |

distribution of | |

distribution of O | |

distribution of counterfactual | |

G-computation formula for post-intervention distribution of L under rule d equal to | |

distribution of | |

non-intervention factor of | |

distribution of | |

intervention mechanism factor of | |

empirical distribution of | |

Models | |

SCM for | |

statistical model for | |

Functions and parameters | |

causal target parameter mapping | |

causal target parameter value (causal quantity) | |

statistical target parameter mapping | |

target parameter value equals | |

structural equation | |

structural equation | |

dynamic intervention | |

h | weight function |

Efficient influence curve | |

efficient influence curve of P equals influence curve of TMLE | |

Least favorable submodels | |

submodel through | |

Loss functions | |

loss function for | |

Others | |

Q | redefined as |

Estimators | |

estimator of | |

initial estimator of | |

initial estimator of | |

updated estimator of | |

TMLE of |

## The efficient influence curve of the statistical target parameter

We have the following theorem for a general parameter

**Theorem 1***Consider a parameter**that can be represented as**, where**. Let**. Assume that**is such that**is pathwise differentiable. Let**be the partial derivative of f with respect to**at Q. Let**be the influence curve of**as an estimator of**, where**is the empirical distribution of*

*Then, the efficient influence curve of**at P can be represented as follows*:

**Proof**: The efficient influence curve of the parameter

In order to determine the partial derivative of the function *f* and *M*, and suppose that

**Corollary 1***Consider the target parameter**defined by eq. (5). This target parameter is pathwise differentiable at P with efficient influence curve given by*

## An alternative pooled TMLE that only fits a single $\in $ to compute the update

The TMLE described in the main text relies on a separate

*m*th step, given the estimator

*t*and

*k*when computing the update, while the closed form TMLE presented above only smoothes over the rules

## Supplementary material, Simulation 2

### Overview

Below we describe the true data generating process used in Simulation 2 in greater detail. We also provide a summary table comparing the support and number of events over time in the simulated data and in the real data set it was designed to resemble.

In our presentation of the simulation below we have altered our notation slightly from that presented in the paper to match notation in the accompanying R code. Specifically,

*t*.

### Data generating process

Data were generated for a given individual according to the following process, where

Tables 9 and 10 compare the number of patients in the simulated data and actual data who are uncensored and following a given regime. In the data analysis, for example, in the first 3-month interval following immunologic failure (time = 1) there were no patient deaths among the 137 uncensored patients who switched immediately (switch time = 0) and 13 deaths among the 2,285 uncensored patients who did not switch immediately (switch time = 1). In the second 3-month interval following immunologic failure (time = 2), there was one patient death among the 120 uncensored patients who switched immediately (switch time = 0), no patient deaths among the 88 uncensored patients who switched during the first 3-month interval (switch time = 1) and 8 deaths among the 1,962 uncensored patients who did not switch immediately or during the first 3-month interval (switch time = 2).

Events in data analysis

Time | Switch time | ||||||||||

0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | |

1 | 0 | 13 | |||||||||

2 | 1 | 0 | 8 | ||||||||

3 | 0 | 1 | 0 | 11 | |||||||

4 | 0 | 0 | 0 | 0 | 5 | ||||||

5 | 1 | 0 | 0 | 0 | 0 | 3 | |||||

6 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | ||||

7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | |||

8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | ||

9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | |

10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |

Events in simulated data

Time | Switch time | ||||||||||

0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | |

1 | 0 | 9 | |||||||||

2 | 0 | 1 | 10 | ||||||||

3 | 0 | 0 | 1 | 9 | |||||||

4 | 0 | 0 | 0 | 1 | 7 | ||||||

5 | 0 | 0 | 0 | 0 | 1 | 5 | |||||

6 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | ||||

7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | |||

8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | ||

9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | |

10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |

Support (# uncensored and following rule) in data analysis

Time | Switch time | ||||||||||

0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | |

1 | 137 | 2,285 | |||||||||

2 | 120 | 88 | 1,962 | ||||||||

3 | 104 | 80 | 71 | 1,703 | |||||||

4 | 88 | 68 | 67 | 54 | 1,453 | ||||||

5 | 77 | 59 | 57 | 51 | 61 | 1,184 | |||||

6 | 54 | 44 | 50 | 48 | 57 | 57 | 951 | ||||

7 | 40 | 37 | 43 | 48 | 54 | 55 | 51 | 760 | |||

8 | 29 | 33 | 40 | 46 | 50 | 51 | 51 | 49 | 602 | ||

9 | 17 | 29 | 34 | 41 | 44 | 48 | 51 | 49 | 50 | 508 | |

10 | 10 | 28 | 34 | 39 | 44 | 46 | 51 | 48 | 49 | 53 | 432 |

Support (# uncensored and following rule) in simulated data

Time | Switch time | ||||||||||

0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | |

1 | 121 | 2,229 | |||||||||

2 | 107 | 118 | 1,890 | ||||||||

3 | 95 | 107 | 131 | 1,582 | |||||||

4 | 82 | 94 | 120 | 127 | 1,237 | ||||||

5 | 70 | 83 | 110 | 117 | 112 | 992 | |||||

6 | 61 | 74 | 97 | 108 | 102 | 101 | 798 | ||||

7 | 53 | 65 | 88 | 98 | 96 | 95 | 89 | 645 | |||

8 | 47 | 58 | 80 | 91 | 90 | 90 | 85 | 82 | 527 | ||

9 | 40 | 51 | 72 | 83 | 83 | 84 | 82 | 79 | 76 | 433 | |

10 | 35 | 47 | 65 | 77 | 77 | 79 | 76 | 75 | 74 | 72 | 358 |

## References

- 1.↑
Gsponer T, Petersen M, Egger M, Phirid S, Maathuise M, Boulle A, et al., and O. Keiser for IeDEA Southern Africa. The causal effect of switching to second line ART in programmes without access to routine viral load monitoring.

*AIDS*2012;26:57–65. - 2.↑
van der Laan MJ, Petersen ML. Causal effect models for realistic individualized treatment and intention to treat rules.

*Int J Biostat*2007;3(1):Article 3. - 3.↑
Robins JM. Analytic methods for estimating HIV treatment and cofactor effects. In: Ostrow DG, Kessler R, editors.

*Methodological issues of AIDS Mental Health Research*. New York: Plenum Publishing, 1993;213–90. - 4.↑
Murphy SA, van der Laan MJ, Robins JM. Marginal mean models for dynamic regimes.

*J Am Stat Assoc*2001;960:1410–23. - 5.↑
Hernan MA, Lanoy E, Costagliola D, Robins JM. Comparison of dynamic treatment regimes via inverse probability weighting.

*Basic Clin Pharmacol*2006;98:237–42. - 6.↑
Cain LE, Robins JM, Lanoy E, Logan R, Costagliola D, Hernn MA. When to start treatment? A systematic approach to the comparison of dynamic regimes using observational data.

*Int J Biostat*2010;6(2):Article 18. - 7.↑
Schomaker M, Egger M, Ndirangu J, Phiri S, Moultrie H, Technau K, et al.. When to start antiretroviral therapy in children aged 2–5 years: A collaborative causal modelling analysis of cohort studies from Southern Africa.

*PLoS Med*2013;100:e1001555. - 8.↑
Robins JM, Hernan MA, Brumback B. Marginal structural models and causal inference in epidemiology.

*Epidemiology*2000;110:550–60. - 9.↑
Robins JM, Hernan MA. Estimation of the causal effects of time-varying exposures. In: Fitzmaurice G, Davidian M Verbeke MG, Molenberghs G, editors.

*Advances in longitudinal data analysis*. New York: Chapman and Hall/CRC Press, 2009:553–599. - 10.↑
Robins JM. Marginal structural models versus structural nested models as tools for causal inference. In: Halloran ME, Berry D, editors.

*Statistical models in epidemiology, the environment, and clinical trials*. New York: Springer, 2000:95–133. - 11.↑
Robins JM. A new approach to causal inference in mortality studies with sustained exposure periods – application to control of the healthy worker survivor effect.

*Math Model*1986;7:1393–512. - 12.↑
Taubman SL, Robins JM, Mittleman MA, Hernan MA. Intervening on risk factors for coronary heart disease: an application of the parametric g-formula.

*Int J Epidemiol*2009;380:1599–611. - 13.↑
Robins JM. Robust estimation in sequentially ignorable missing data and causal inference models. In: Proceedings of the American Statistical Association on Bayesian Statistical Science, 1999, 2000:6–10.

- 14.↑
Robins JM, Rotnitzky A. Recovery of information and adjustment for dependent censoring using surrogate markers. In: Nicholas P. Jewell, Klaus Dietz, Vernon T. Farewell, editors,

*AIDS epidemiology*. Boston: Birkhäuser, 1992:297–331. - 15.
Robins JM, Rotnitzky A. Comment on the Bickel and Kwon article, “Inference for semiparametric models: some questions and an answer”.

*Stat Sin*2001;110:920–36. - 16.↑
Robins JM, Rotnitzky A, van der Laan MJ. Comment on “On profile likelihood”.

*J Am Stat Assoc*2000;450:431–5. - 17.↑
Rosenblum M, van der Laan MJ. Simple examples of estimating causal effects using targeted maximum likelihood estimation. UC Berkeley Division of Biostatistics Working Paper Series, Working Paper 209. Available at: http://biostats.bepress.com/jhubiostat/paper209, 2011.

- 18.↑
Stitelman OM, De Gruttola V, van der Laan MJ. A general implementation of TMLE for longitudinal data applied to causal inference in survival analysis. UC Berkeley Division of Biostatistics Working Paper Series, Working Paper 281. Available at: http://biostats.bepress.com/ucbbiostat/paper281, 2011.

- 19.↑
van der Laan MJ, Gruber S. Targeted minimum loss based estimation of causal effects of multiple time point interventions.

*Int J Biostat*2012;8(1):Article 8. - 20.↑
van der Laan MJ, Rose S.

*Targeted learning: causal inference for observational and experimental data*. Berlin/Heidelberg/New York: Springer, 2011. - 21.↑
van der Laan MJ, Rubin D. Targeted maximum likelihood learning.

*Int J Biostat*2006;6(2):Article 2. - 22↑
Bang H, Robins JM. Doubly robust estimation in missing data and causal inference models.

*Biometrics*2005;61:962–72. - 23.↑
Robins JM. Marginal structural models. In: 1997 Proceedings of the American Statistical Association, Section on Bayesian Statistical Science, 1998:1–10.

- 24.↑
Hernan MA, Brumback B, Robins JM. Marginal structural models to estimate the causal effect of zidovudine on the survival of HIV-positive men.

*Epidemiology*2000;110:561–70. - 25.↑
Petersen ML, van der Laan MJ, Napravnik S, Eron J, Moore R, Deeks S. Long term consequences of the delay between virologic failure of highly active antiretroviral therapy and regimen modification: a prospective cohort study.

*AIDS*2008;22:2097–106. - 26.↑
Robins JM, Orellana L, Rotnitzky A. Estimation and extrapolation of optimal treatment and testing strategies.

*Stat Med*2008;27:4678–721. - 27.↑
Neugebauer R, van der Laan M. Nonparametric causal effects based on marginal structural models.

*J Stat Plann Inference*2007;137:419–34. - 28.↑
Petersen ML, Porter KE, Gruber S, Wang Y, van der Laan MJ. Diagnosing and responding to violations in the positivity assumption.

*Stat Methods Med Res*2012;21:31–54. - 29.↑
Robins JM. Commentary on “using inverse weighting and predictive inference to estimate the effects of time-varying treatments on the discrete-time hazard.

*Stat Med*2002;210:1663–80. - 30.↑
Rosenblum M, van der Laan MJ. Targeted maximum likelihood estimation of the parameter of a marginal structural model.

*Int J Biostat*2010;6(2):Article 19. - 31.↑
Scharfstein DO, Rotnitzky A, Robins JM. Adjusting for nonignorable drop-out using semiparametric nonresponse models (with discussion and rejoinder).

*J Am Stat Assoc*1999;940:1096–1120 (1121–1146). - 32.↑
Schnitzer ME, Moodie EM, van der Laan MJ, Platt RW, Klein MB. Modeling the impact of hepatitis C viral clearance on end-stage liver disease in an HIV co-infected cohort with targeted maximum likelihood estimation.

*Biometrics*2014;70(1):144–52. - 33.↑
R Core Team. R: a language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria, 2013. Available at: http://www.R-project.org/. ISBN 3-900051-07-0.

- 34.↑
Schwab J, Lendle S, Petersen M, van der Laan M. LTMLE: longitudinal targeted maximum likelihood estimation, 2013. Available at: http://cran.r-project.org/web/packages/ltmle/. R package version 0.9.3.

- 36.↑
Pearl J.

*Causality: models, reasoning, and inference*. Cambridge: Cambridge University Press, 2000. - 37.↑
Bickel PJ, Klaassen CA, Ritov Y, Wellner JA.

*Efficient and adaptive estimation for semiparametric models*. Baltimore, MD: Johns Hopkins University Press, 1993. - 38.↑
van der Laan MJ, Robins JM.

*Unified methods for censored longitudinal data and causality*. Berlin/Heidelberg/New York: Springer, 2003. - 39.↑
van der Laan MJ, Polley E, Hubbard A. Super learner.

*Stat Appl Genet Mol Biol*2007;6:Article 25. - 40.↑
van der Laan MJ. Statistical inference when using data adaptive estimators of nuisance parameters. UC Berkeley Division of Biostatistics Working Paper Series, Working Paper 302, 2012. Available at: http://www.bepress.com/ucbbiostat/paper302.

- 41.↑
Young JG, Cain LE, Robins JM, OÕReilly EJ, Hernan MA. Comparative effectiveness of dynamic treatment regimes: an application of the parametric g-formula.

*Stat Biosci*2011;30:119–43. - 42.↑
Picciotto S, Hernan M, Page J, Young J, Robins J. Structural nested cumulative failure time models to estimate the effects of interventions.

*J Am Stat Assoc*2012;1070:866–900. - 43.↑
Geng EH, Glidden D, Bangsberg DR, Bwana MB, Musinguzi N, Metcalfe J, et al. Causal framework for understanding the effect of losses to follow-up on epidemiologic analyses in clinic based cohorts: the case of HIV-infected patients on antiretroviral therapy in Africa.

*Am J Epidemiol*2012;175:1080–7. - 44.↑
Schomaker M, Gsponer T, Estill J, Fox M, Boulle A. Non-ignorable loss to follow-up: correcting mortality estimates based on additional outcome ascertainment.

*Stat Med*2014;330:129–42.