We restricted our analyses to the 2787 men in the placebo arm. Let *t* be an index for visit, where *t* = 0 is the baseline visit and *t* = 14 is the last visit at year 5, with 4-month intervals between each visit. Let *A*_{
t
} be an indicator for adherence ≥ 80% to the protocol-specified placebo dose between *t* and *t* + 1, *Y*_{
t
} an indicator of death between *t* and *t* + 1, *C*_{t + 1} an indicator for loss to follow-up defined as three consecutive missed study visits at *t* + 1, *V* a set of 39 variables measured at the time of randomization, and *L*_{
t
} a set of post-randomization variables measured at each *t*. The baseline covariates *V* were adherence during the run-in period, demographics (age, race), lifestyle characteristics (cigarette smoking, physical activity), medical history (risk group, weight, New York Heart Association class, comorbidities, blood pressure), use of non-study medications, laboratory findings, and electrocardiogram findings. All of these variables (except age, race, weight, risk group) were also post-randomization variables *L*_{
t
} at each visit *t*. When an individual missed a study visit, the most recent covariate and adherence values were carried over from the most recent available data, up to three consecutive missed visits. Participants were censored at the expected date of their third consecutive missed study visit.

The choice of 80% as a cut-point for adherence was based on standard practice, as reflected by the use of a run-in period requiring 80% adherence to placebo among all trial participants. Note that, since adherence was assessed as a categorical variable, with the highest category ≥ 80% of prescribed pills taken, higher thresholds were not possible for the binary adherence indicator.

In our primary analysis, we artificially censored individuals when they reported an adherence level that differed from their baseline adherence level, that is, when *A*_{
t
}*≠ A*_{0} [8, 9]. We then fit the IP-weighted pooled logistic model for the discrete-time hazards at each time [10]:

$$ \mathrm{logit}\left(\Pr \left[{Y}_{t+1}=1|\ {A}_k={A}_0\ \mathrm{for}\ 0<k\le t,V,{C}_{t+1}=0,{Y}_t=0\ \right]\right)={\uptheta}_{0,\mathrm{t}}+{\uptheta}_1{A}_0+{\uptheta}_2V+{\theta}_3{A}_0t, $$

where θ_{0,t} is a time-varying intercept modeled as a restricted cubic spline of time (knots at 0, 5, 10, 15 visits), and θ_{2} is a vector parameter. The time-varying stabilized weights [11] were defined as:

$$ {SW}_t={\prod}_{k=0}^{t}\frac{f\left({M}_k,\left.{A}_k\right|{A}_0,\bar{A}_{k-1},V,{C}_k=0\right)}{f\left({M}_k,\left.{A}_k\right|{A}_0,\bar{A}_{k-1},V,{\overline{L}}_k,{C}_k=0\right),} $$

where *M*_{
t
} is an indicator for measurement of adherence at visit *t* (1 if measured, 0 otherwise), and overbars indicate history of the variable. The weight models were fit in the full population before artificial censoring; in a sensitivity analysis, we restricted the fit of the weight models to person-visits with *A*_{
k
}*= A*_{0} for 0 < *k* ≤ *t.*

To estimate the denominator of the weights, we fit the model logit(Pr[*M*_{
t
} = 1|\( {A}_0,{\bar{A}}_{t-1},V,{\overline{L}}_t,{C}_t=0 \)]) = α_{0t} + α_{1}*A*_{0} + α_{2}*A*_{t − 1} + α_{3}*V* + α_{4}*L*_{t − 1} to all person-visits, and the model logit(Pr[*A*_{
t
} = 0|\( {A}_0,{\bar{A}}_{t-1},V,{\overline{L}}_t,{C}_t=0 \),*M*_{
t
} = 1]) = β_{0t} + β_{1}*A*_{0} + β_{2}*A*_{t − 1} + β_{3}*V* + β_{4}*L*_{
t
} to the person-visits with measured adherence. When adherence was not measured at a visit (*M*_{
t
} = 0) but the individual was not yet defined to be lost to follow-up (that is, at the first or second consecutive missed visit), adherence was carried forward from the previous visit and the factor in the denominator of the adherence weight was 1 for that visit.

Similar models that did not include the time-varying covariates were fit to estimate the numerators of the weights. The final weight for each individual at each time was the product of the measurement and adherence weights for that individual up to that time point. As in previous studies, we truncated the estimated IP weights at the 99th percentile to avoid undue influence of outliers. The truncated weight estimates had a mean of 1.00 (SD = 0.29) and a range of 0.02 to 2.55.

We used the parameter estimates from the weighted outcome logistic model to estimate the 5-year survival as previously described [2]. We compared the survival for always vs. never at least 80% adherent, that is, *A*_{0} = 0 vs. *A*_{0} = 1.

We conducted a second analysis where, rather than censor individuals who reported a change in adherence, we specified a dose-response function for the effect of adherence on mortality. To do so, we summarized the adherence history *Ā*_{
t
} between baseline and visit *t* by the cumulative average cum(*Ā*_{
t
}) = \( \frac{1}{t+1}\sum \limits_{k=0}^t{A}_k \) (i.e., the proportion of visits during which an individual was adherent to at least 80% of the placebo dose), and then fit the pooled logistic model

$$ \mathrm{logit}\left(\Pr \left[{Y}_{t+1}=1|{\bar{A}}_t,V,{C}_{t+1}=0,{Y}_t=0\ \right]\right)={\uptheta}_{0,\mathrm{t}}+{\uptheta}_1\mathrm{f}\left[\mathrm{cum}\left({\bar{A}}_t\right)\right]+{\uptheta}_2V, $$

where f[·] is a dose-response function and θ_{1} is a vector parameter.

In separate analyses, we specified more flexible dose-response functions. Specifically, we considered both a quadratic dose-response function θ_{1}f[cum(*Ā*_{
t
})] = θ_{1,1}cum(*Ā*_{
t
}) + θ_{1,2}[cum(*Ā*_{
t
})]^{2}, and a function that allowed for a separate effect of recent adherence θ_{1,0}*A*_{
t
} + θ_{1,1}cum(*Ā*_{t - 1}) + θ_{1,2}[cum(*Ā*_{t - 1})]^{2}. We also considered functions that included product terms with the time parameters.

To compute 95% confidence intervals, we used non-parametric bootstrapping with 500 samples.

SAS 9.4 was used for all analyses and code is provided in the supplementary online materials (see Additional file 1).