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.

causalWins

A package for estimating the causal win ratio, win proportion, and net benefit using three distinct approaches as proposed in Even et al. (2025): nearest neighbor matching, distributed regression forests, and efficient influence functions.

Installation

You can install the development version of causalWins from GitHub with:

# install.packages("pak")
pak::pak("FranciscoAndrade90/causalWins")

Example

This is a basic usage example:

library(causalWins)
# ---------------------------------------------------------
    # Generate data with mixed covariates
# ---------------------------------------------------------
set.seed(123)
n <- 100
base <- data.frame(
  X1 = rnorm(n, mean = 5, sd = 2), # numeric covariate 1
  X2 = rnorm(n, mean = 10, sd = 3), # numeric covariate 2
  X3 = factor(sample(c("A", "B", "C"), n, replace = TRUE)), # factor covariate
  Y1 = rnorm(n, mean = 50, sd = 10), # numeric outcome 1
  Y2 = rnorm(n, mean = 100, sd = 20), # numeric outcome 2
  arm = sample(c(0, 1), n, replace = TRUE) # binary treatment arm
)
# ---------------------------------------------------------
    # Compute win ratio with nearest neighbor pairing
# ---------------------------------------------------------
res_nn <- nn_win_ratio(
  base = base,
  treatment_name = "arm",
  outcome_names = c("Y1", "Y2")
)
#> Covariates are both categorical and numerical.
#> No custom distance was provided.
#> Performing FAMD and setting distance to 'euclidean'.
#> Specify a distance function to override this choice.
# ---------------------------------------------------------
    # Compute win ratio with Distributional Random Forests
# ---------------------------------------------------------
res_drf <- drf_win_ratio(
  base = base,
  treatment_name = "arm",
  outcome_names = c("Y1", "Y2")
)
# ---------------------------------------------------------
    # Compute win ratio with Efficient Influence Functions
# ---------------------------------------------------------
res_eif <- eif_win_ratio(
  base = base,
  treatment_name = "arm",
  outcome_names = c("Y1", "Y2")
)
#> Covariates are both categorical and numerical.
#> No custom distance was provided.
#> Performing FAMD and setting distance to 'euclidean'.
#> Specify a distance function to override this choice.
#> No 'propensity_scores' was provided. 'Probability forest' will be used instead to compute those scores.
#> Specify 'propensity_scores' to override this choice.

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.