causalCmprsk: An R package for nonparametric and Cox-based estimation of average treatment effects in competing risks data

Bella Vakulenko-Lagun, Colin Magdamo, Marie Laure Charpignon, Bang Zheng, Mark W. Albers, Sudeshna Das

Research output: Contribution to journalArticlepeer-review


Background and Objective: Competing risks data arise in both observational and experimental clinical studies with time-to-event outcomes, when each patient might follow one of the multiple mutually exclusive competing paths. Ignoring competing risks in the analysis can result in biased conclusions. In addition, possible confounding bias of the treatment-outcome relationship has to be addressed, when estimating treatment effects from observational data. In order to provide tools for estimation of average treatment effects on time-to-event outcomes in the presence of competing risks, we developed the R package causalCmprsk. We illustrate the package functionality in the estimation of effects of a right heart catheterization procedure on discharge and in-hospital death from observational data. Methods: The causalCmprsk package implements an inverse probability weighting estimation approach, aiming to emulate baseline randomization and alleviate possible treatment selection bias. The package allows for different types of weights, representing different target populations. causalCmprsk builds on existing methods from survival analysis and adapts them to the causal analysis in non-parametric and semi-parametric frameworks. Results: The causalCmprsk package has two main functions: fit.cox assumes a semiparametric structural Cox proportional hazards model for the counterfactual cause-specific hazards, while fit.nonpar does not impose any structural assumptions. In both frameworks, causalCmprsk implements estimators of (i) absolute risks for each treatment arm, e.g., cumulative hazards or cumulative incidence functions, and (ii) relative treatment effects, e.g., hazard ratios, or restricted mean time differences. The latter treatment effect measure translates the treatment effect from probability into more intuitive time domain and allows the user to quantify, for example, by how many days or months the treatment accelerates the recovery or postpones illness or death. Conclusions: The causalCmprsk package provides a convenient and useful tool for causal analysis of competing risks data. It allows the user to distinguish between different causes of the end of follow-up and provides several time-varying measures of treatment effects. The package is accompanied by a vignette that contains more details, examples and code, making the package accessible even for non-expert users.

Original languageEnglish
Article number107819
JournalComputer Methods and Programs in Biomedicine
StatePublished - Dec 2023

Bibliographical note

Publisher Copyright:
© 2023 Elsevier B.V.


  • Cause-specific hazards
  • Cumulative incidence functions
  • Proportional hazards model
  • Restricted mean time
  • Right heart catheterization data
  • Time-varying hazard ratio

ASJC Scopus subject areas

  • Software
  • Health Informatics
  • Computer Science Applications


Dive into the research topics of 'causalCmprsk: An R package for nonparametric and Cox-based estimation of average treatment effects in competing risks data'. Together they form a unique fingerprint.

Cite this