The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

winratiosim

winratiosim provides simulation tools for two-arm clinical trials with a hierarchical win ratio endpoint. It simulates time-to-event, recurrent event, and continuous outcomes; applies prioritized pairwise win/loss scoring; and summarizes operating characteristics for the win ratio and Finkelstein-Schoenfeld tests.

The package implements the simulation workflow used in:

Lee, S. Y. (2025). A note on the sample size formula for a win ratio endpoint. Statistics in Medicine, 44, e70165. https://doi.org/10.1002/sim.70165

Installation

After CRAN acceptance, install with:

install.packages("winratiosim")

The development version can be installed from GitHub:

# install.packages("remotes")
remotes::install_github("yain22/winratiosim")

Example

library(winratiosim)

result <- winratiosim(
  nsim = 10,
  N = 400,
  Randomization.ratio = c(1, 1),
  alpha.JFM = 0,
  theta.JFM = 1,
  lambda_trt = 0.13,
  lambda_ctl = 0.15,
  ann.icr_trt = 0.32,
  ann.icr_ctl = 0.55,
  xbase_trt = 45,
  xfinal_trt = 52.5,
  xbase_ctl = 45,
  xfinal_ctl = 45,
  sd.delta.x_trt = 20,
  sd.delta.x_ctl = 20,
  censorrate_trt = 0.2,
  censorrate_ctl = 0.2,
  nc = 1,
  seed = 20250518
)

result$df_WR.analysis.summary

For publication-scale operating characteristics, increase nsim substantially and set nc to the number of worker processes you want to use.

After installation, open the package vignette for a longer worked example:

vignette("winratiosim", package = "winratiosim")

Power and Type I Error Summaries

power_fs <- mean(result$df_FS.analysis.summary$p_value_FS < 0.025,
                 na.rm = TRUE)
power_wr <- mean(result$df_WR.analysis.summary$LB_R_w > 1,
                 na.rm = TRUE)

binom.conf.exact(
  x = sum(result$df_WR.analysis.summary$LB_R_w > 1, na.rm = TRUE),
  n = sum(!is.na(result$df_WR.analysis.summary$LB_R_w))
)

References

  1. Lee, S. Y. (2025). A note on the sample size formula for a win ratio endpoint. Statistics in Medicine, 44, e70165. https://doi.org/10.1002/sim.70165
  2. Yu, R. X., and Ganju, J. (2022). Sample size formula for a win ratio endpoint. Statistics in Medicine, 41(6), 950-963.
  3. Finkelstein, D. M., and Schoenfeld, D. A. (1999). Combining mortality and longitudinal measures in clinical trials. Statistics in Medicine, 18(11), 1341-1354.
  4. Pocock, S. J., Ariti, C. A., Collier, T. J., and Wang, D. (2012). The win ratio: a new approach to the analysis of composite endpoints in clinical trials based on clinical priorities. European Heart Journal, 33(2), 176-182.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.