Randomised controlled trials (RCTs) are regarded as the gold standard for estimating causal treatment effects on health outcomes. However, RCTs are not always feasible, because of time, budget or ethical constraints. Observational data such as those from electronic health records (EHRs) offer an alternative way to estimate the causal effects of treatments. Recently, the `target trial emulation' framework was proposed by Hernan and Robins (2016) to provide a formal structure for estimating causal treatment effects from observational data. To promote more widespread implementation of target trial emulation in practice, we develop the R package TrialEmulation to emulate a sequence of target trials using observational time-to-event data, where individuals who start to receive treatment and those who have not been on the treatment at the baseline of the emulated trials are compared in terms of their risks of an outcome event. Specifically, TrialEmulation provides (1) data preparation for emulating a sequence of target trials, (2) calculation of the inverse probability of treatment and censoring weights to handle treatment switching and dependent censoring, (3) fitting of marginal structural models for the time-to-event outcome given baseline covariates, (4) estimation and inference of marginal intention to treat and per-protocol effects of the treatment in terms of marginal risk differences between treated and untreated for a user-specified target trial population. In particular, TrialEmulation can accommodate large data sets (e.g., from EHRs) within memory constraints of R by processing data in chunks and applying case-control sampling. We demonstrate the functionality of TrialEmulation using a simulated data set that mimics typical observational time-to-event data in practice.
翻译:随机对照试验(RCT)被视为评估治疗对健康结局因果效应的金标准。然而,由于时间、预算或伦理限制,RCT并非总是可行。电子健康记录(EHRs)等观察性数据为评估治疗的因果效应提供了替代途径。近期,Hernan和Robins(2016)提出了"靶向试验模拟"框架,为从观察性数据中估计因果治疗效应提供了规范化结构。为促进靶向试验模拟在实践中的广泛实施,我们开发了R包TrialEmulation,通过使用观察性时间事件数据模拟一系列靶向试验,比较在模拟试验基线时开始接受治疗者与未接受治疗者的结局事件风险。具体而言,TrialEmulation提供:(1)用于模拟靶向试验序列的数据预处理;(2)计算治疗和删失的逆概率权重以处理治疗转换和依赖性删失;(3)针对基线协变量拟合时间事件结局的边缘结构模型;(4)针对用户指定的靶向试验群体,以治疗组与未治疗组间的边际风险差异形式,估计和推断治疗的边缘意向性治疗效应和符合方案效应。特别地,TrialEmulation通过分块处理数据和病例对照采样,能够在R内存限制下处理大规模数据集(如来自EHRs的数据)。我们使用模拟数据集(模拟实际观察性时间事件数据特征)演示了TrialEmulation的功能。