Causal effect on the number of life years lost due to a specific event: average treatment effect and variable importance Authors: Simon Christoffer Ziersen, Torben Martinussen Published: 2026 ABSTRACT AbstractCompeting risk is a common phenomenon when dealing with time-to-event outcomes in biostatistical applications. An attractive estimand in this setting is the “number of life-years lost due to a specific cause of death”. It provides a direct interpretation on the time-scale on which the data is observed. In this paper, we introduce the causal effect on the number of life years lost due to a specific event and give assumptions under which the average treatment effect (ATE) and the conditional average treatment effect (CATE) are identified from the observed data. Semiparametric estimators for the ATE and a partially linear projection of CATE, serving as a variable importance measure, are proposed. These estimators leverage machine learning for nuisance parameters and are model-agnostic, asymptotically normal, and efficient. We give conditions under which the estimators are asymptotically normal, and their performance is investigated in a simulation study. Lastly, the methods are implemented in a study concerning the response to different antidepressants using data from the Danish national registers.Keywords: Causal inference, Competing risks, Heterogeneity, Nonparametric inference, Number of life years lost, Variable importance measure Introduction Time-to-event outcomes are very common in the biomedical sciences, and often there is the additional complication of competing events. For example, Kessing et al. (2024) were interested in the time to non-response to different antidepressants for patients with a major depressive disorder. The event of interest was defined as a switch to or add-on of another antidepressant or antipsychotic medicine or readmission to a psychiatric hospital with a major depressive disorder, while admission to a psychiatric hospital with a higher order psychiatric diagnosis (bipolar disorder, schizophrenia or organic mental disorder) or death were competing risks. One purpose of that study was to compare a potential causal effect of treatment with the antidepressant Setraline versus treatment with another antidepressant, Escitalopram, and to determine whether such an effect was dependent on individual characteristics. With competing risk data, it is standard practice to target the average treatment effect (ATE) based on the cumulative incidence functions (CIF) associated with the competing events. Estimation of the ATE in this setting has been described by Ozenne et al. (2020) under working Cox models and logistic regression for the nuisance parameters, whereas Rytgaard et al. (2023) provided estimators of the ATE under data-adaptive nuisance estimators. From a causal perspective, contrasts in counterfactual cause-specific CIFs correspond to total effects in the sense discussed by Young et al. (2020), which connects these quantities to the broader causal mediation framework of Robins and Greenland (1992). Such total effects rely on relatively weak identifying assumptions compared with notions of direct effects, since they do not attempt to disentangle treatment mechanisms operating through competing events. In some scientific settings, investigators may be primarily interested in understanding treatment mechanisms operating through different event types. In such cases, alternative causal estimands may be considered. In particular, Stensrud et al. (2021, 2022) introduced the concept of separable effects, which aims to decompose treatment effects into components acting through distinct causal pathways associated with competing events. Martinussen and Stensrud (2023) generalized this concept to the continuous time setting. These estimands require stronger assumptions than the total effect we consider here. In this paper we focus on a summary of total effects based on the concept of “years of life lost” proposed by Andersen (2013). Within a given time frame it aims, in the classical setting of competing causes of death, to decompose the years of life lost (in the considered time window) due to the specific causes of death. In our working example, where the first two years after the initiation of treatment were of most interest, it corresponds to healthy days lost before two years after the treatment initiation due to the primary cause and the competing causes. The resulting quantity can be viewed as a restricted mean - type measure defined relative to the fixed time horizon , corresponding to an area-under-the-curve summary of the cause-specific cumulative incidence function over . As such, it provides a scalar summary of the total effect captured by the cause-specific cumulative incidence function. While reporting the entire cumulative incidence curve may reveal potential time variation in effects, the restricted mean–type summary offers a concise and interpretable measure expressed directly in time units. In this paper, we introduce the ATE based on this quantity - number of life years lost due to a specific event. We provide an estimator of the ATE based on semiparametric efficiency theory, allowing for the use of machine learning methods for nuisance parameter estimation without relying on model-specifications. We further give assumptions on the nuisance estimators under which the proposed ATE estimator is asymptotically normal and nonparametric locally efficient. Andersen et al. (2017) provide a general procedure for estimating the ATE with censored data, where the ATE based on the number of life years lost due to a specific event serves as an example. Their estimator is based on pseudo-observations and its asymptotic properties in the presence of covariate dependent censoring are derived in Overgaard et al. (2019). Specifically, their estimator relies on a correctly specified parametric model for the conditional average treatment effect along with a correctly specified model for the censoring distribution. In contrast, our estimator does not rely on such parametric model specifications, and it allows for estimation of the involved nuisance parameters based on machine learning, while still providing inference for the ATE estimate. Importantly, we also extend the treatment effect variable importance measure given in Ziersen and Martinussen (2025) as a best partially linear projection of the conditional average treatment effect (CATE). The projection parameter provides an attractive measure of potential treatment effect heterogeneity through a given covariate - this is of great interest in many real applications as the one we present in Sect. 6 on evaluating antidepressant treatment effects as mentioned above. We develop an estimator of this estimand that is also semiparametrically efficient and allows for machine learning methods to estimate nuisance parameters. The estimator admits an asymptotic normal distribution which defines a test of treatment effect heterogeneity of a given covariate. In Sect. 2 we state the notation and setup used in the paper, and in Sect. 3 we define two target parameters. Section 4 gives the efficient influence functions for the two target parameters and utilizes these to construct cross-fitted one-step estimators. The asymptotic distributions of the estimators are then proved under high level assumptions on the nuisance parameter estimates. In Sect. 5, the finite sample performance of the proposed estimators are investigated in a simulation study and in Sect. 6 we apply the estimators to a study on treatment response to different antidepressants based on data from the Danish national registers (Kessing et al. 2024). Section 7 concludes the paper with some final remarks. Notation and setup We consider a time-to-event setting with competing risks. Let T be the time to event and the event indicator for two competing events. Let X be a d-dimensional vector of covariates, and let A denote the baseline treatment indicator. We enforce censoring through a censoring time C, such that the observed event time is and the observed event indicator is . Our observed data, , is given by n i.i.d. copies of , where , with being a nonparametric model. We introduce the conditional cause-specific hazard functions, , for the j’th cause, j=1,2, and let denote the censoring hazard function. We let and denote the corresponding cumulative hazard functions. We denote the survival function, and the conditional distribution of A given X. Let denote the observed counting process for the j’th event and let denote the corresponding martingale conditional on A=a and X=x such that . We use the notation and , and is the expectation of f(O) under the true data generating distribution. Throughout, for a given function , which might be estimated from data, all expectations, , considers the function fixed, i.e. the expectation is not taken with respect to the randomness in . Finally, denotes the -norm, such that . Causal estimand and nuisance parameters Define . Then , where is the cumulative incidence function for event j. In the following we will motivate the choice of as an outcome of interest, and use it to construct counterfactuals. Inspired by Andersen (2013), we introduce for a given time-horizon , which can be interpreted as the expected number of years lost before time in strata (a, x). As Andersen (2013) shows, this quantity can be decomposed naturally into where can be interpreted as number of years lost “due to cause j” (Andersen 2013), with being the jth cumulative incidence function given A=a and X=x, i.e. . We now introduce the counterfactual for a=0,1, where and are the time to event and event indicator, respectively, under treatment a. Then is the number of life-years lost due to event j before time under treatment a. We define the j’th-specific ATE as and the CATE is In order to identify the ATE and CATE from the observed data we need the following assumptions: Assumption A (Identification) (Consistency) a.s. (Consistency) a.s. (Exchangeability) (Exchangeability) (Positivity) . (Positivity) . (Independent censoring) . (Independent censoring) . Define In Appendix B, we show that the CATE function is identified in the observed data because and the average treatment effect as under assumption A. Going forward we drop the dependence of and write to ease notation. Based on the identification results, we define two target parameters as mappings from the model on the observed data to the reals. The first parameter is the j-specific average treatment effect, defined as the mapping , where The second parameter is defined as a variable importance measure of the l’th covariate on based on the best partially linear projection given in Ziersen and Martinussen (2025). It is defined as the mapping with where denotes the covariates indexed by . The parameter can be viewed as a weighted average of the conditional covariance of the CATE and the covariate given the rest of the covariates. The parameter is dependent on the scale of the covariate in question, and when assessing the importance of different covariates it is not the estimate of the parameter that determines if a covariate is deemed of variable importance, but rather the test of , since is zero if there is no heterogeneity explained by , as is seen by the following observation. The parameter can be derived as the least-squares projection of the CATE onto the partially linear model. To see this, let and define where and w is some measurable function with finite variance. Then (Ziersen and Martinussen 2025). Note that the partially linear model is not assumed to hold, but in the case of no heterogeneity, i.e. β =R=0, we have . Hence a test of is conservative in the sense that is identically zero when there is no heterogeneity, but it may also be zero in the case of actual heterogeneity through via e.g. an interaction between and , l≠ l' (i.e. when R≠ 0). From the definition above can be interpreted as a regression coefficient when the partially linear model holds for (and not only in the case of no heterogeneity). But since this is rarely known in practice, caution should be taken in interpreting directly. For more details and discussion, see Ziersen and Martinussen (2025). Nonparametric estimation and inference We base the estimation of the two target parameters, and , on semiparametric efficiency theory (Bickel et al. 1993; van der Vaart 2000, Ch. 25). A key ingredient is the efficient influence function (EIF), which establishes the information bound related to the given target parameter and is used to construct estimators with desirable properties, such as robustness and efficiency, for said parameter. We refer to Kennedy (2022) for an introduction to these methods, which we briefly outline in Appendix A in relation to our target parameters. Average treatment effect To derive an estimator for the ATE we first derive its EIF. We define the nuisance parameter . The EIF is then given in the following lemma. Lemma 1 For a given j, the efficient influence function of is given by where is a real-valued function defined on the sample space of O at a given value of ν with where Proof See Appendix C. □ The function is the uncentered EIF of the ATE and will also appear in the development of an estimator for the best partially linear projection in Sect. 4.2. As the EIF of the ATE is linear in the target parameter, the one-step estimator for reduces to where is an estimate of ν. In Appendix A, we detail the construction of the so-called cross-fitted one-step estimator, which is used to alleviate a ceratin Donsker class condition, thus allowing for more flexible nuisance estimators. It is a sample-splitted version of the one-step estimator, where data is split into K folds , k=1… K. For each fold k, a nuisance estimator is obtained from the k’th leave-out sample , excluding the k’th fold, and the average in Eq. (3) is taken over observations in the k’th fold. The cross-fitted estimator, denoted , is then obtained as a weighted (according to the number of observations in each fold) average of the K estimates. In order to derive asymptotic results for we need a set of assumptions on the nuisance estimators. The assumptions below are stated for a general nuisance estimator , but in applications to cross-fitted estimators, they are assumed to hold for each leave-out sample . We will be explicit about this when stating results on the obtained estimators, but it is left out of assumption B for notational convenience. Assumption B The nuisance estimator satisfies the following conditions There exist a real-valued constant η>0 such that , , , , , for all . There exist a real-valued constant η>0 such that , , , , , for all . For a=0,1, it holds that For a=0,1, it holds that For a=0,1, it holds that For a=0,1, it holds that Assumption B1 is the usual positivity assumption found through out the causal inference literature (for examples with censored data, see e.g. Westling et al. (2024), Rytgaard et al. (2023)). Whereas assumption A3 relates to the true data generating mechanism, assumption B1 extends to the estimators as well. We note that employing cross-fitting in relatively small sample sizes can sometimes lead to practical positivity-violations, when a “rare” covariate lies in but not in . For B3 to hold, all nuisance estimators must be consistent, and for the hazard estimators this amounts to uniform consistency. This requirement suggest the use of flexible learners for nuisance estimation. Assumption B2 reflects the dobule robustness that is common for one-step estimators. In Lemma D1 in the Appendix it is shown that the so-called remainder term, related to a decomposition of the estimator, takes this form. It is sometimes referred to as a second order remainder term, when it can be shown to hold if each of the nuisance estimators converge on -rate in -norm. If one considers cumulative hazard estimators that are absolute continuous, the result can be obtained from a simple application of the Cauchy-Schwarz inequality (for examples involving Highly Adaptive Lasso, see Munch et al. (2024), Rytgaard et al. (2022, 2023), but this exclude many commonly used cumulative hazard estimators such as any Breslow-type estimators. For such estimators, other techniques are required (see e.g. Munch et al. 2023). We expect nonetheless that the double robustness is obtained for most reasonable estimators, and in the later simulation studies, this will be exemplified by the use of random survival forests (Ishwaran et al. 2008). Next follows our main result for the cross-fitted ATE estimator: Theorem 1 Assume that the nuisance estimators , k=1… K, follow assumption B for each k. Then the cross-fitted estimator for a given j, , is asymptotically linear with influence function given by and hence Proof See Appendix D. □ In practice, the variance of the influence function is estimated by the cross-fitted plug-in estimator , which we detail in Appendix A. The standard error of is then given by . Best partially linear projection Estimation of follows the same overall strategy, i.e., construct an asymptotically linear estimator using semiparametric theory. The difference now is that the target parameter is a ratio of two parameters which can both be written as a map from to the reals. If we construct asymptotically linear estimators for both parameters in the ratio, separately, then the ratio of the estimators will also be asymptotically linear. Furthermore, if each estimator in the ratio has their respective EIF as their influence function, the ratio of the estimators will have its EIF as its influence, by the functional delta method (van der Vaart 2000, Ch. 25.7). In the following we will extend the approach of Ziersen and Martinussen (2025) to the CATE function defined by the number of life years lost, , for a given time-horizon , where each of the parameters in the ratio of is estimated separately. We start by calculating the EIF for the relevant parameters. Lemma 2 For a fixed l and j, define the mappings and as and such that . The efficient influence functions of , and , respectively, are given by Proof See Appendix C. □ The EIF’s above depend explicitly on the conditional distribution of given through and , so to express them as mappings of the nuisance parameter, we extend the notion of ν. Let and , and define and . We define the uncentered EIF’s corresponding to the EIF’s and as The construction of the estimators and for and , respectively, now follow similar to the procedure in the ATE setting, as described in Appendix A. We note that estimation of is given in Ziersen and Martinussen (2025), but is included here as well for completeness. Since the estimators and depend on the extended nuisance estimators, we have to make additional assumption in order to derive the desired asymptotic linearity. Accordingly, we have the following result: Theorem 2 For a fixed l and j, assume that for each fold k=1,… , K it holds that (i) for all n and some M>0. for all n and some M>0. (ii) (iii). . Then, if assumption B holds for each k, it follows that is asymptotically linear with influence function given by and hence Proof See Appendix D. □ Assumptions (i)-(iii) in Theorem 2 refer to the nuisance estimators related to the conditional distribution of given . Regarding assumption B2 for ATE estimation, we discussed the double robustness properties of the cross-fitted estimator in relation to the convergence rates of the nuisance estimators, and we can add to that discussion the rates given in (ii) and (iii). We see that the estimator for our target parameter achieves parametric rates (asymptotic linearity) if the nuisance estimators related to are estimated at -rate, adding to the notion of “double robustness”. The rate in assumption (iii) is known for many estimators, as it is an assumption on a typical regression estimator. Whether it is fulfilled depends on the type of the estimator used and possibly on the dimension d in relation to n, but we note that the assumption is to be considered rather mild, allowing for many types of data-adaptive estimators (see e.g. the discussion in Kennedy 2022, Sect. 4.3). For estimation of , we regress the CATE estimates onto in line with the approach suggested in Hines and Diaz-Ordaz (n.d.), and Ziersen and Martinussen (2025). This approach constitutes a certain type of meta-learning and convergence rates related to (ii) are generally less known compared to the regression in assumption (iii). We refer to Hines and Diaz-Ordaz (2023) for a discussion of a specific meta-learner termed the DR-learner (Kennedy 2023) for estimation of (their analogy is termed ) and convergence rates analogous to (ii). Because of scale sensitivity, the estimate of may be of less interest than testing the null-hypothesis . A test statistic for can be defined by where the construction of is given in Appendix A. The following corollary (analogous to Corollary 4 in Ziersen and Martinussen (2025)) gives the desired asymptotic properties of our test-statistic: Corollary 1 Under the same setup as in Theorem 2, we have under the null-hypothesis, , that Proof Since the variance estimator is consistent (Ziersen and Martinussen 2025, Lemma 1), Theorem 2 together with Slutsky’s theorem and an application of the delta method gives the result. □ Simulation study We conduct simulation studies to investigate the proposed asymptotic properties of the estimators and under two different nuisance estimator settings with and without cross-fitting (i.e. setting K=1). In the following we set , and for a given nuisance estimator . For all cross-fitted estimators, we set K=10. In one nuisance estimator setting we consider correctly specified (semi)parametric nuisance estimators and in the other we use completely nonparametric estimators via random forest. The parametric nuisance estimators adhere to assumption B and so we would expect the target parameter estimators to perform according to theory both with and without cross-fitting. In case of nonparametric estimators, random survival forest are shown to adhere to assumption B3 in Cui et al. (2022), but it is unclear to what extend they admit rates corresponding to B2. Furthermore, the nonparametric estimators do not in general belong to a Donsker class, and we therefore expect the cross-fitted estimators to perform more in line with the theory compared to the non-cross-fitted version (see Chernozhukov et al. (2018) and Kennedy (2022) for a discussion on cross-fitted one-step estimators). We consider data generated from the following models: . . Note that the above hazard functions correspond to Cox models with baseline hazards given by a Weibull hazard, , where b and k are the scale and shape parameter, respectively. We consider four sample size settings of n=250, 500, 750, 1000, and for each setting we run 1000 simulations. For each simulation we generate data according to the models above and estimate the target parameters according to specifications given below. Additionally, we conducted the same simulation study as described above but with correlated covariates following a multivariate normal distribution. The results are similar to the uniform setting presented here, and they can be found in Appendix E. Average treatment effect For estimation of we choose the time-horsizon Under the model, the folliwing true values were approximated by Monte-Carlo simulation using draws from the true distribution, , , , , , . We consider two nuisance settings for estimation of (here dropping k from the notation). In one setting consists of correctly specified Cox models with corresponding Breslow estimators for the cumulative hazards and a correctly specified logistic regression for the propensity score model. This setting is abbreviated cor in Table 1. In the second setting we estimate the cumulative hazards by random survival forests (Ishwaran et al. 2008) as implemented in the R-package randomForestSRC with default tuning parameters (see Ishwaran and Kogalur 2023 for documentation), and we estimate the propensity score by random forest, again with the implementation and tuning parameters given by randomForestSRC. This setting is abbreviated RF. Furthermore, each setting will be given the suffix CF if cross-fitting is used. Table 1Results of 1000 simulations of estimators of with varying nuisance estimators, with and without cross-fitting, for sample sizes n=250, 500, 750, 1000. nmethodbiasSDmean SEcoverage250cor−0.15210.94240.97460.9550corCF−0.04940.97011.03400.9620RF−0.35010.90200.56440.7520RFCF0.09531.20121.34290.9710500cor−0.09800.69460.68930.9570corCF−0.05380.70400.70840.9550RF−0.35760.67500.39570.6800RFCF−0.03830.79120.87990.9680750cor−0.06650.56500.56330.9480corCF−0.03770.56840.57350.9500RF−0.32690.55380.32370.6750RFCF−0.06780.63940.69700.96701000cor−0.02650.47240.48840.9540corCF−0.00460.47540.49490.9570RF−0.28000.46360.28080.6950RFCF−0.03190.53830.59430.9710The abbreveations of the methods are read as follows: cor corresponds to the nuisance parameters estimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed in estimation of . The tables gives the bias, empirical standard deviation (SD), mean of the estimated standard error (mean SE), and coverage. Results of 1000 simulations of estimators of with varying nuisance estimators, with and without cross-fitting, for sample sizes n=250, 500, 750, 1000. The abbreveations of the methods are read as follows: cor corresponds to the nuisance parameters estimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed in estimation of . The tables gives the bias, empirical standard deviation (SD), mean of the estimated standard error (mean SE), and coverage. Table 1 gives the results for ATE-estimation. For correctly specified nuisance estimators the bias decreases with n and standard deviations decrease at an approximately -rate. With a coverage around 0.95, even for relatively small n, it looks as if the estimator follows the asymptotic distribution from Theorem 1. Surprisingly though, cross-fitting seems to decrease the bias of the estimator with correctly specified nuisance parameters even further. Overall we find that the estimator performs as expected for correctly specified (semi)parametric nuisance estimators. For the nuisance estimators using random forests, we see a non-vanishing bias for the non-cross-fitted estimators. Furthermore, the standard errors are underestimated compared to the empirical standard deviation of the estimators which, together with the bias result in undercoverage. When using cross-fitting together with random forests, the bias disappears on roughly the same order as the correctly specified parametric estimators (without cross-fitting), and the standard deviation of the estimator seem to be on roughly -rate, as with the correctly specified nuisance parameters. The standard errors seem to be slighty overestimated, though, resulting in a slight overcoverage. This might be due to the hyperparameter choices for the random forests or to inherent limitations on the convergence rates of random forests in regards to the number of covariates (Biau 2012). Best partially linear projection For estimation of , we set . The true value of the target parameters are approximately . We consider two nuisance settings for estimation of (here dropping k from the notation). In one setting consists of correctly specified Cox models with corresponding Breslow estimators for the cumulative hazards, and a correctly specified logistic regression for the propensity score model, and and are estimated with a generalised additive model (GAM) including spline smoothing of each term but without interactions as implemented in the R-package mgcv. This setting will be abbreviated cor in figures going forward. In the second, all nuisance parameters are estimated by random (survival) forests with default tuning parameters as implemented in the R-package randomForestSRC. This setting will be abbreviated RF. Furthermore, each setting will be given the suffix CF if cross-fitting is used. In Fig. 1, we see the absolute bias for estimation of , l = 1, … , 4, for the different nuisance settings. In general, we see that cor and corCF perform similarly across all sample sizes and across all l, with a bias converging to zero. The RFCF-setting performs slightly worse than cor and corCF for small n, but has approximately similar performance for large n, whereas RF has a large bias for large enough values of . Generally, the estimators seem to perform as we would expect according to Theorem 2 in terms of bias. The coverage of the estimators are presented in Fig. 2. The settings cor, corCF and RFCF all exhibit approximately nominal coverage across n and l, whereas RF has poor coverage. Again, this is in line with our expectations. Figure 3 gives the estimated probability of rejecting , i.e. the type-1 error (since in our data generating mechanism), together with Monte Carlo confidence intervals. The type-1 error is approximately 0.05 for all n, except for RF where the type 1-error increases with n. Results based on 1000 simulations of the estimators of with for l=1,… ,4 with varying nuisance estimators and across sample sizes n=250, 500, 750, 1000. The plot shows the absolute bias of the estimators, where cor corresponds to the nuisance parameters estimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed. The true values are . Results based on 1000 simulations of the estimators of with for l=1,… ,4 with varying nuisance estimators and across sample sizes n=250, 500, 750, 1000. The plot shows coverage of the estimators, where cor corresponds to the nuisance parameters estimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed. The black line indicates a coverage of 0.95. Results based on 1000 simulations of the test statistic corresponding to the test with varying nuisance estimators and across sample sizes n=250, 500, 750, 1000. The plot shows probability of rejecting , which equals the type-1 error as . cor corresponds to the nuisance parameters estimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed. Lastly, Fig. 4 shows the probability of rejecting , l = 1,2,3, which correspond the power of the test. Interestingly, using data-adaptive estimation of the nuisance parameters seem to decrease the power of the test . Results based on 1000 simulations of the test statistic corresponding to the test , for l=1,2,3, with varying nuisance estimators and across sample sizes n=250, 500, 750, 1000. The plot shows probability of rejecting , which corresponds to the power of the test as for l=1,2,3. cor corresponds to the nuisance parameters estimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed. Application To demonstrate the methods outlined in the previous sections, we consider the study by Kessing et al. (2024). In this study, the potential non-responses to 17 different antidepressants are compared based on data from the Danish national registers. Patients enter the study at their first diagnosis with major depressive disorder from a psychiatric hospital. Their treatment, in terms of a specific antidepressant, is defined as the first purchase of an antidepressant after discharge from the hospital, which also determines the index date. The main outcome is time to non-response, defined as a switch to or add-on of another antidepressant or antipsychotic medicine or readmission to a psychiatric hospital with a major depressive disorder. Competing risk for the time to non-response was admission to a psychiatric hospital with a higher order psychiatric diagnosis (bipolar disorder, schizophrenia or organic mental disorder) or death. The 17 antidepressants are categorised into six groups (SSRI, NARI, SNRI, NaSSA, TCA, and others) and within each group a reference drug is chosen to which the other drugs in that group are compared. The estimand for each comparison is the average treatment effect on the risk of non-response within two years after index date, i.e., it is defined as , where is the conditional cumulative incidence function for non-response, A=0 denotes the reference drug, A=1 is the comparitor and t=2 corresponds to the time-horizon. The study includes patients from 1995-2018 and not all of the antidepressants considered were available on the marked in the entire period. Accordingly, for each comparison, a minimum date is set for which both drugs in comparison were available and all patients with index dates prior to the minimum date are excluded. Additionally, censoring was defined at emigration or end of follow-up. For the sake of illustration we restrict ourselves to the comparison of Setraline (reference drug, n=14416) and Escitalopram (comparitor, n=7508). The censoring and event rates for non-response and competing risks, respectively, at time days were 0.135, 0.433 and 0.066. Kessing et al. (2024) used the G-formula with estimated by cause-specific Cox regressions (Ozenne et al. 2020) to estimate the ATE. To control for confounding, the Cox-regressions were adjusted for the covariates in Table 2. Here, the secondary psychiatric diagnoses and the somatic disorders at baseline are indicator variables and they are defined as having a diagnosis within the specific groups, according to ICD10 codes, within 10 years prior to the index date. The ATE was estimated to be 0.10 (0.09, 0.12), that is, the probability of non-response was 0.1 higher amongst patients treated with Escitalopram within two years after treatment initiation. For comparison, instead of defining the treatment effect through the cumulative incidence function, , we consider estimation of the ATE and the best partially linear projection based on the number of life-years-lost estimands defined in Sect. 3. That is, we consider estimation of and with (2 years). We include the same confounders as in Kessing et al. (2024) with the exception that age is included as a numeric variable instead of a categorised version. The target parameters are estimated with the cross-fitted estimators described in Sect. 4 with all nuisance parameters estimated by random forests (as described in the simulation study) and K=10 folds. Table 2Confounders in Kessing et al. (2024)AnnotationExplanationageage in years at index-datesexfemale, maleSecondary diagnosis from the psychiatric hospital at inclusion. The annotations reflect the ICD-10 codes used in the definition: F10-19other psychiatric disorders F40-48neurotic, stress-related and somatoform disorders F60-69personalitiy disordersDiagnosis with somatic disorder within 10 years prior to index date. The annotations are given in form of the corresponding ICD-10 chapter: Iinfections IIneoplasms IIIblood diseases IV+IX+Xendocrine, nutritional, and metabolic diseases and diseases of the circulatory or respiratory system VI-VIIIdiseases of the nervous system, eye and ear XIdiseases of the digestive system XIIdiseases of the skin and subcutaneous tissue XIIIdiseases if the musculoskeletal system XIXphysical lesions and poisoning) Confounders in Kessing et al. (2024) The ATE is estimated to 48.96 (40.02, 57.90). The interpretation here is that patients on Setraline on average lost 49 “healthy” days less before two years after treatment initiation due to non-response compared to patients who start on Escitalopram, where “healthy” is meant as time without a non-response event or a competing event. For comparison, we also estimated the effect of treatment on the competing event, i.e. , to 4.06 (−0.54, 8.66). Table 3 shows the estimates , for l given by each confounder in Table 2, together with a p-value associated with the test statistic . Table 3Estimates of ranked according to the p-value associated with the test of , for l ranging over different covariatesagesexXIIIXIF60-69IIVI-VIIIIV+IX+XF40-48IIIXIXXIIIF10-19−0.8518.7−28.3−16.715.117.48.884.385.21−4.80−2.85−2.00−0.410.23p-value0.030.040.170.270.300.360.400.730.760.820.830.880.980.98The acronyms in the table are described in Table 2. Random Forest was used for all nuisance parameter estimators. The data comes from the study Kessing et al. (2024), and the outcome is time to non-response, which is defined as a switch in psychiatric treatment or re-hospitalization at psychiatric ward. The treatment effect was defined as the difference in the number of healthy days lost (days without switch of treatment or re-hospitalization) due to non-response before two years after treatment initiation between Escitalopram and Setraline. Estimates of ranked according to the p-value associated with the test of , for l ranging over different covariates The acronyms in the table are described in Table 2. Random Forest was used for all nuisance parameter estimators. The data comes from the study Kessing et al. (2024), and the outcome is time to non-response, which is defined as a switch in psychiatric treatment or re-hospitalization at psychiatric ward. The treatment effect was defined as the difference in the number of healthy days lost (days without switch of treatment or re-hospitalization) due to non-response before two years after treatment initiation between Escitalopram and Setraline. The p-values indicate that potential treatment effect heterogeneity can be attributed to sex and age, while the treatment effect does not seem to vary across any of the other variables. Specifically, since is defined as the projection of the CATE function onto the partially linear model, the estimates related to sex and age can be interpreted as regression coefficients. The CATE function is defined as the difference in number of healthy days lost due to non-response between Escitalopram and Setraline, and the estimate then corresponds to the treatment effect being larger among women compared to men, i.e., the difference in number of healthy days lost due to non-response between Escitalopram and Setraline was 19 days larger among women than men. This interpretation is of course relying on the partially linear model to hold for the CATE function, but as the parameter still measures the association between and sex, when the partially linear model does not hold, we would still conclude, that the treatment effect is larger among women. Discussion In this paper, we have introduced the causal effect of a treatment on the number of life-years lost due to a specific event. We have shown that the ATE and the CATE are identifiable from the observed data under common assumptions found throughout the causal inference and survival literature. Different measures of treatment effect in the presence of competing risk are available in causal inference (Rytgaard et al. 2023; Ozenne et al. 2020; Stensrud et al. 2021, 2022; Martinussen and Stensrud 2023) and the treatment effect studied in this paper adds a new interpretability compared to existing variants. One advantage is that the treatment effect is defined on the time scale of the study and thus provides a quantity that is easy to communicate to non-statisticians, whereas treatment effects based on the cumulative incidence function are harder to communicate. As is common when assessing the treatment effect in the presence of competing risk, the effect of a treatment on the number of life years lost due to a specific event depends on the effect of the treatment on both the hazard of the event of interest and on the competing event. As such, one can in principle conclude that there is an effect of treatment, even when all of the effect is driven by the effect on the competing event. Martinussen and Stensrud (2023) provide a measure of separable treatment effects based on the cumulative incidence function, which allow one to estimate the effect of treatment only driven by the intensity of the event of interest under additional causal assumptions. An interesting avenue for future research is to extend their method to the number of life years lost due to a specific event. We have provided an estimator of the ATE based on semiparametric efficiency theory, which allows for data-adaptive estimation of the nuisance parameters. The estimator is efficient in the nonnparametric model with variance given by the efficient influence function. One of the assumptions needed to ensure the asymptotic results relies on convergence of a remainder term on -rate (assumption B2), which is reminiscent of a similar assumption in the causal inference literature with censored data (Westling et al. 2024; Rytgaard et al. 2023). Without assuming absolute continuity of the cumulative hazard estimators, it is difficult to obtain an equivalent double rate-robustness property as is seen in the literature on uncensored data (e.g. Kennedy 2022; Hines et al. 2022; Chernozhukov et al. 2018; van der Laan and Rose 2011). Accordingly, we conducted a simulation study, where the nuisance parameters were estimated by different variants of random forests, which confirmed that the estimator performed according to asymptotic results when using data-adaptive nuisance estimators. Lastly, we extended a measure of treatment effect heterogeneity, termed the best partially linear projection (Ziersen and Martinussen 2025), to the CATE-function defined on the number of life-years lost due to a specific event. The measure asserts the importance of a given covariate on the treatment effect, but with competing risk the interpretation is more delicate compared to the survival setting. When the effect of treatment on the competing event is large, one can imagine scenarios where the importance of one covariate on the CATE is driven by the effect on the competing event, and an assertion of importance (shown in Sect. 6) based on the event of interest might be misleading. In such scenarios, one can switch the event of interest and competing event to get a full picture. Appendix A On nonparametric estimation and efficiency theory We give a brief introduction to semiparametric efficiency theory (Bickel et al. 1993; Van Der Vaart 2000, Ch. 25; van der Laan and Rose 2011) used to construct and analyze the estimators from Sect. 4. For a nice introduction, with the aim of leveraging the theory to construct nonparametric estimators incorporating data-adaptive methods, see Kennedy (2022). For a general target parameter ψ, an estimator is said to be asymptotically linear if it can be written on the form with . The function is called the influence function of the estimator , and it characterizes the asymptotic distribution of the estimator. This can be seen by applying the central limit theorem together with Slutsky’s lemma, from which . If the target parameter is differentiable at P as a map , there exist a unique function, say , associated to the pathwise derivative of the parameter, which characterizes the information bound of any regular estimator. The function is called the efficient influence function (EIF), and any estimator is regular and asymptotically efficient, if it is asymptotically linear with influence function given by the EIF (Van Der Vaart 2000, Ch. 25.3). Since the EIF is uniquely determined by the target parameter and the model, it can be calculated without reference to any estimator. Once it is known, several techniques exist for constructing estimators that are asymptotically linear with the EIF as their influence function (van der Laan and Rose 2011; Chernozhukov et al. 2018; Kennedy 2022; Hines et al. 2022). We focus on the so-called one-step estimator, which is defined as where is obtained from some (possibly) data-adaptive estimators. When the EIF is linear in the target parameter, i.e., , for some function φ (O;P), the one-step estimator becomes In the rest of this section we assume this form of the one-step estimator, since all estimators in the main text of the article take this form. In order to show that the one-step estimator is asymptotically linear, one typically relies on a certain decomposition involving an empirical process term and a remainder term, which are both required to be . The former can be obtained if is assumed to belong to a Donsker class, but this requirement has been shown to be too restrictive for some data-adaptive estimators, and a certain type of sample splitting, termed cross-fitting, has to be applied to the one-step estimator in order to obtain the required convergence rate (Chernozhukov et al. 2018; Kennedy 2022). To define the sample splitting involved in constructing the cross-fitted estimator, let be an index vector drawn from an n-dimensional multinomial distribution with K events with probability , k=1,… , K, for the k’th event. Define the index sets for k=1… K such that , where denotes the disjoint union. Corresponding to the index sets, we define K disjoint data splits by such that , and we define K leave-out data splits by . To construct the cross-fitted one-step estimator corresponding to ψ, let be an estimate of P based on data in the k’th leave out sample, , and let be the empirical measure of . We define the K-fold cross-fitted estimator of ψ as where is the number of observations in the k’th data split. The construction of the cross-fitted estimator detailed here is quite general, see Kennedy (2022) for a nice discussion and comparison to the one-step estimator without cross-fitting. As mentioned above, the cross-fitted one-step estimator will be asymptotically linear if the associated empirical process term and remainder term converge in probability on -rate. Then , and the variance of the EIF can be estimated consistently, under the same assumptions required for asymptotic linearity of (Ziersen and Martinussen 2025, Lemma 1), by the cross-fitted plug-in estimator and the standard error of is given by . The estimators in the main text follow this exact recipe, but they are expressed through estimates of a nuisance parameter ν instead of P. For the sake of completeness we here give the exact construction of all estimators appearing in the main text. The estimators related to the ATE are given by The Estimators of the target parameters related to the partially linear projection are given by As in the ATE setting, the variance, , is estimated by the cross-fitted plugin estimator: where (with some abuse of notation) we define Appendix B Identification of causal estimands We present an argument for the identification results in the main text. The argument follows usual steps in the causal inference literature on censored data, and it is based of a combination of the G-formula (Robins 1986) and identification results from the literature on survival analysis (see e.g. Andersen et al. 1993; Martinussen 2006). Since we have that which is identified in the observed data under assumption A4 and A3 (Andersen et al. 1993). For the ATE, this allows us to write where assumption A3 ensures that all conditional distributions are well defined. We note that CATE is identified by the same arguments. Appendix C Derivation of influence functions In the following we consider the parametric submodel , where Q is the Dirac measure with pointmass in the observation , and we define the operator with . Lemma C1 The Gateaux derivative of is given by where Proof Observe □ Lemma C2 The Gateaux derivative of S(s∣ a,x) is given by Proof First we note that by lemma C1. Then Applying (13) gives the result. □ Lemma C3 The Gateaux derivative of is given by where Proof First we note that For the first term in (15), observe by lemma C2, and for the second term by lemma C1. Plugging into (15) gives Finally, by (18), we have □ Proof (Proof of lemma 1) We have Applying lemma C3 gives the result. □ Proof (Proof of lemma 2) The EIF of is given by theorem 3 in Ziersen and Martinussen (2025). By remark 2 in Ziersen and Martinussen (2025), the EIF of is given by provided that the CATE function has Gateaux derivative given by , which is seen to hold by lemma C3. The EIF of then follows from the chain rule. □ Appendix D Proof of asymptotic results In the following, we let , a=0,1, such that . Similarly, we define a=0,1, such that . Lemma D1 The remainder term , a=0,1, can be represented as where the expectation is taken with respect to an observation O, considering the nuisance estimators, , fixed. Under assumption B2 it holds that . Proof Throughout the proof, expectations and conditional expectations will be taken with respect to an observation O, considering estimated nuisance parameters fixed. For the first statement we have and we will expand the two terms separately. For the first term note that Define then Duhamel’s equations (Gill and Johansen 1990) gives Plugging this into the first term in (21) gives Using this expansion, we can write (21) as For the second term in (20) note that Hence, by collecting (22) and (23), and using iterated expectation, we can write (20) as which gives the first statement. For the second statement note that Applying the representation above along with assumption B2 gives the result. □ Lemma D2 Let and . Under assumption B1 and B3, the uncentered EIF, , is bounded in -norm as: Furthermorre, Proof Observe that We will deal with each of the terms separately, but first we will derive some results for the consistency of , and . For we have that for constants and . The second equality follows from partial integration and the second inequality follows from the mean value theorem with C>0 is some value between and together with assumption B1. From (28) it follows immediately that For , observe for some constants and , which follows from (28). Now we proceed to bound each of the three terms initially stated. The bound of (25) follows directly from (29): For (26) we have The first inequality follows from assumption B1 and the second inequality follows from (30) together with by assumption B1. Lastly, for (27) we have and we will bound (a) and (b) separately. For (a) we have that for almost all x by (34) together with assumption B1. Next, to control (b), define and let such that . Observe that where (*) follows from the backward equation (theorem 5, Gill and Johansen 1990). Hence From this expression we can derive a bound for (b) using integration by parts: for some constants and . Applying the bounds (36) and (37) to (35) gives that (27) is bounded by Thus, applying (31), (32) and (38) to (25), (26) and (27), respectively, gives the first result. For the second result, note that Hence, the first result combined with assumption B3 gives the second result. □ Proof (Proof of Theorem 1) Consider the decomposition such that Now, if both the empirical process term and the remainder term in the above display are , it follows that is asymptotically linear with influence function given by . By Proposition 2 in Kennedy (2022) this is achieved if for each k and if the remainder is . Under assumption B for each k, the former is achieved by lemma D2 and the latter is achieved by lemma D1. An application of the central limit theorem together with Slutsky’s lemma gives the convergence in distribution. □ Proof (Proof of Theorem 2) We will show that and are asymptotically linear with influence function given by and , respectively. Since is a ratio of the two, it follows from the functional delta method that it is asymptotically linear with influence function given by (Van Der Vaart 2000, Ch. 25.7). That is asymptotically linear follows from Theorem 5 in Ziersen and Martinussen (2025). To show that is asymptotically linear, we consider the decomposition such that Again, by Proposition 2 in Kennedy (2022), the desired asymptotic linearity follows if we can show that for each k and that the remainder term is . For both results, we will consider arguments that are similar to the ones given in the proof of Theorem 4 in Ziersen and Martinussen (2025). Empirical process term Consider the following expansion for a given k: For the first term we have where the inequality follows from assumption (i) and the equality follows from lemma D2, since we have assumed that assumption B3 holds for each k. Consistency in of the second term follows by analogous arguments, replacing assumption B3 with assumption (ii). Consistency of the third term in follows from assumption (iii) if is bounded almost surely. To that end, observe that for almost all we have Hence consistency of the empirical process term follows, if we can bound each term in the display above. The first term is clearly bounded, since is bounded by . For the second and third term observe that where the first and third inequality follows from assumption B1 and the second inequality follows from (34). Thus, it follows that for each k. Remainder term As in Ziersen and Martinussen (2025), we consider the decomposition and we want to show that each term is . For the third term we note that since the integral is a martingale conditional on A and X, and hence, that the third term is equal to 0 by iterated expectation. The second term is by Cauchy-Schwarz together with assumption (ii) and (iii). Following the derivations in the proof of D1, we can use iterated expectation to write the first term as By assumption (i) this is bounded by which is by assumption B2. We have now shown that summands of the empirical process term and remainder term are for each k, and hence it follows from Proposition 2 in Kennedy (2022) that is asymptotically linear with influence function given by . The convergence in distribution of follows from the central limit theorem together with Slutsky’s lemma. □ Appendix E Additional simulation results We conduct an additional simulation study with correlated covariates, to test the robustness of the estimator. The nuisance parameters are simulated from the same models as in Sect. 5, but with the covariates simulated from where . Otherwise, the setting is the same with the target parameters defined at and with a 1000 simulations for each sample size. For each single simulation, four different nuisance settings are used, amounting to a total of 16000 estimates of . In 56 instances one of the cumulative hazard estimators produced an infinite estimate when predicting the counterfactual outcome. These instances are removed from the results presented in the following. It should be noted that the error occurred with all four difference methods, i.e. cor, corCF, RF and RFCF. Appendix E.1 Average treatment effect Under the multivariate normal distributed covariates the following parameters are approximated using Monte-Carlo simulation: , , , , , . We use the same nuisance estimators as in Sect. 5 and adopt the same naming conventions. Table 4 displays the results. The results are similar to those given in Table 1 for covariates with a uniform distribution; thus reaching the same conclusions as reported in Sect. 5. Table 4Results of 1000 simulations of estimators of with varying nuisance estimators, and with and without cross-fitting for sample sizes n=250, 500, 750, 1000nmethodbiasSDmean SEcoverage250cor−0.22200.99591.00230.9419corCF−0.10611.04261.07970.9519RF−0.51780.99380.56360.7015RFCF0.03801.59851.60120.9780500cor−0.12110.71370.71100.9428corCF−0.08050.72670.73570.9488RF−0.43460.68770.39870.6653RFCF−0.04660.95601.00270.9699750cor−0.08480.58070.58070.9499corCF−0.05830.58790.59380.9550RF−0.40120.56200.32700.6313RFCF−0.06580.73420.77920.96601000cor−0.07040.50410.50270.9419corCF−0.04690.50750.51080.9510RF−0.37990.48800.28410.6141RFCF−0.04860.61750.66010.9759The covariates are correlated and follow a multivariate normal distribution. The abbreveations of the methods are read as follows: cor corresponds to the nuisance parametersestimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed in estimation of. The tables gives the bias, empirical standard deviation (SD), mean of the estimated standard error (mean SE), and coverage Results of 1000 simulations of estimators of with varying nuisance estimators, and with and without cross-fitting for sample sizes n=250, 500, 750, 1000 The covariates are correlated and follow a multivariate normal distribution. The abbreveations of the methods are read as follows: cor corresponds to the nuisance parametersestimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed in estimation of. The tables gives the bias, empirical standard deviation (SD), mean of the estimated standard error (mean SE), and coverage Appendix F Best partially linear projection The true values are approximated to using Monte-Carlo simulation. When the covariates are correlated, the Monte-Carlo simulation is not as straight forward as in Sect. 5, since we need to estimate the conditional distributions . As such, we generate draws from X, and for each draw we simulate 1000 draws from to calculate the conditional mean. After that, the Monte-Carlo simulation proceeds as usual. In Fig. 5 we see the biases of the different estimators for varying sample sizes. Largely, we see the biases decrease across the board, but now it is a bit more irregular compared to the uniform covarite setting in Sect. 5. The cross-fitted and non-cross-fitted versions of the correctly specified estimators (with GAM used for estimation of the conditional means) are still performing similarly, as in the uniform setting, and the biggest difference between the two settings are the performance of the estimators using random forest. Aside from , the cross-fitted and non-cross-fitted estimators have switched places in terms of performance compared to the uniform setting. However, since the one-step estimators for are constructed from ratios of two separate estimators, the bias from each estimator can cancel each other out, and the estimator for can thus appear unbiased. Indeed, this is what we see here. Looking at the coverage in Fig. 6 it becomes clear that the estimator using random forest without cross-fitting does not perform as intended. Results based on 1000 simulations of the estimators of with for l=1,… ,4 with varying nuisance estimators and across sample sizes n=250, 500, 750, 1000. The covariates are correlated and follow a multivariate normal distribution. The plot shows the absolute bias of the estimators, where cor corresponds to the nuisance parameters estimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed. The true values are . Results based on 1000 simulations of the estimators of with for l=1,… ,4 with varying nuisance estimators and across sample sizes n=250, 500, 750, 1000. The covariates are correlated and follow a multivariate normal distribution. The plot shows coverage of the estimators, where cor corresponds to the nuisance parameters estimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed. The black line indicates a coverage of 0.95 In Figs. 7 and 8 we see the probability of rejecting the hypotheses and , l=1,2,3, respectively. As the true value of is approximated to 0.008, Fig. 7 no longer corresponds to a type-1 error, but rather, it is the power of the test of . But since the true value is very close to zero, the performance of the estimators behave as in the uniform setting, where Fig. 3 indeed corresponded to the type-1 error. The power of the estimators shown in Fig. 8 display the same behavior as in the uniform setting. Results based on 1000 simulations of the test statistic corresponding to the test with varying nuisance estimators and across sample sizes n=250, 500, 750, 1000. The covariates are correlated and follow a multivariate normal distribution. The plot shows probability of rejecting , with the true . cor corresponds to the nuisance parameters estimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed Results based on 1000 simulations of the test statistic corresponding to the test , for l=1,2,3, with varying nuisance estimators and across sample sizes n=250, 500, 750, 1000. The covariates are correlated and follow a multivariate normal distribution. The plot shows probability of rejecting , which corresponds to the power of the test as for l=1,2,3. cor corresponds to the nuisance parameters estimated by correctly specified Cox and logistic regressions, and RF corresponds to the same parameters estimated by Random Forest. A suffix CF indicates that cross-fitting was employed In general, the conclusions from these simulation studies are the same as for the uniform setting, where the general recommendation is to use cross-fitting with data-adaptive estimators. Funding Open access funding provided by University of Oslo (incl Oslo University Hospital). Simon Christoffer Ziersen was funded by the Lundbeck Foundation (R279–2018–1145, BrainDrugs). Data availability Implementation of the methods as well as code for reproducing the simulation study is found at https://github.com/simonziersen/causal-effect-on-the-number-of-life-years-lost. Data used in the application are comprised of patient sensitive information and are not publicly available. Declarations Conflict of interest The authors declare no conflict of interest. Footnotes Publisher's Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Data Availability Statement Implementation of the methods as well as code for reproducing the simulation study is found at https://github.com/simonziersen/causal-effect-on-the-number-of-life-years-lost. Data used in the application are comprised of patient sensitive information and are not publicly available.