generates $S$ bootstrap samples with replacement from the original dataset, then repeats all the above steps for each bootstrap sample. The 95% confidence interval for each parameter in model (1) and (2) is computed by using the 2.5% and 97.5% quantiles of the bootstrap distribution of the corresponding estimator.

Addressing complications due to censoring
-----------------------------------------

Denote $C$ the time-to-censoring. As stated above, when the censoring is non-informative conditional on the exposure (figure 2a), the provided estimating procedure remains valid without further adjustment. When censoring is dependent upon the baseline covariate vector $L_0$ and the exposure $A$, one could adjust for censoring by alternatively focusing on the so-called conditional cause-specific natural effect proportional hazard model, that is, $$\begin{aligned}
\lambda^j_{a, a^*}(t|L_0 = l_0) = \lambda_0^j(t)e^{\alpha_{1j}a + \alpha_{2j}a^* + \alpha_{2j}'l_0}\end{aligned}$$ Note that an interaction between $a^*$ and $l_0$ could also be permitted in such model to assess the possibility of mediator-baseline covariate interaction. The procedure discussed in section 2.2 can then be applied to estimate the parameters in this model, with a slight adjustment in step 6 where apart from $A$ and $A^*$, the covariates $L_0$ (and the product of $A^*$ and $L_0$ if mediator- baseline covariate interaction is assessed) are also included 