TxEffectsSurvival

The TxEffectsSurvival package implements inference procedures for treatment effects on terminal and non-terminal events when both may be subject to competing risks. An example is when the time to heart failure hospitalization (H) and the time to cardiovascular death (CVD) are of interest, in which case H is subject to the competing risk of all-cause mortality, and CVD is subject to the competing risk of non-cardiovascular deaths. The setting is quite general and includes the often-studied semi-competing risks model as a special case in which the only competing risk is that of the terminal event to the non-terminal event. While the package is primarily designed for joint analysis of terminal and non-terminal events, univariate survival analysis with a single event is also available by assigning identical inputs to both event types, as illustrated by the example below. To apply the package to a situation where more than one non-terminal event is relevant, define the non-terminal event to be the composite of the non-terminal events.

The package provides inference procedures based on several different methods:


Motivation

In many clinical trials:

The TxEffectsSurvival package explores the specific data structure to provide valid and interpretable inference. For easy comparison, the package also provides results for the win ratio (Finkelstein and Schoenfeld 1999, Pocock et al. 2012; Bebu and Lachin 2016).

Details

The semiparametric results were developed in Yang et al. (2021), following the introduction of event-specific win ratios by Yang and Troendle (2021), and the nonparametric results were developed in Yang (2025). Compared with conventional survival methods, these procedures utilize more information for improved efficiency and accommodate competing risks within the semi-competing risks framework. In this package, effect size estimates and confidence intervals are obtained for each event type, and several testing procedures are implemented for the global null hypothesis of no treatment effect on either terminal or non-terminal events. Furthermore, tests of proportional hazards assumptions, under which the event-specific win ratios converge to hazard ratios, and tests of equal hazard ratios are provided. Asymptotic properties of these inference procedures are discussed in Yang et al. (2022) and Yang (2025). Transformations and finite-sample corrections described in the references are applied to achieve better type I error control for moderately sized data sets.


Installation

install.packages("TxEffectsSurvival")
library(TxEffectsSurvival)

Example

The package includes the dataset colon_wr, which is derived from survival::colon. It is restricted to subjects in the Obs and Lev+5FU arms (excluding Lev), and organized for semi-competing risks analyses with a non-terminal event (recurrence) and a terminal event (death).
Each row corresponds to a single subject.

## Example 1: joint analysis (non-terminal + terminal)
## Load example data
data("colon_wr")

## Map variables
yh   <- colon_wr$yh      # non-terminal event time
hcen <- colon_wr$hcen    # censoring indicator for non-terminal event
yd   <- colon_wr$yd      # terminal event time
dcen <- colon_wr$dcen    # censoring indicator for terminal event
z    <- colon_wr$z       # treatment (0 = control, 1 = treatment)

## Run the analysis
## RICH / RITCH (and other measures) with tests and CIs are included in the output
res <- tnt.analysis(yh, hcen, yd, dcen, z, 
  lin   = c(0.5, 0.5),   # optional linear combination weights
  alpha = 0.05
)

print(res)
# Example: pull selected results
# res$global.tests$lincomb
# res$ci.results$lincomb

## Example 2: univariate analysis (workaround)
## As shown in the example, you can handle a single-event setting by
## assigning identical inputs to both event types.
res_uni <- tnt.analysis(yh, hcen, yh, hcen, z)
res_uni$global.tests$lincomb
res_uni$ci.results$lincomb

References