| WR_analysis | R Documentation |
Analyzes treatment-control pairwise comparisons across three prioritized outcome layers. The function computes layer-specific win, tie, and loss counts; sample sizes; Finkelstein-Schoenfeld statistics; and win ratio statistics based on permutation and large-sample variance formulas.
WR_analysis(dataset1, dataset2, dataset3)
dataset1 |
Data frame containing pairwise scores for the first, highest-priority layer. |
dataset2 |
Data frame containing pairwise scores through the second layer. |
dataset3 |
Data frame containing pairwise scores through the third layer. |
A named list with four elements:
Counts and proportions of treatment wins, ties, and treatment losses by layer and overall.
Treatment, control, total, and pairwise comparison counts.
Finkelstein-Schoenfeld statistic, variance, z-score, and one-sided p-value.
Win ratio, log win ratio, variance estimates, confidence limits, and one-sided p-value.
Finkelstein, D. M., and Schoenfeld, D. A. (1999). Combining mortality and longitudinal measures in clinical trials. Statistics in Medicine, 18(11), 1341-1354.
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.
Yu, R. X., and Ganju, J. (2022). Sample size formula for a win ratio endpoint. Statistics in Medicine, 41(6), 950-963.
subjects <- data.frame(
usubjid = c(1, 2, 1001, 1002),
treatment = c(1, 1, 0, 0)
)
dataset1 <- merge(subjects, subjects, by = NULL)
names(dataset1) <- c("usubjid1", "treatment1", "usubjid2", "treatment2")
dataset1$score <- NA_real_
wr_rows <- dataset1$treatment1 == 1 & dataset1$treatment2 == 0
dataset1$score[wr_rows] <- c(1, 1, -1, -1)
dataset2 <- dataset1
dataset3 <- dataset1
WR_analysis(dataset1, dataset2, dataset3)$sample.size.summary
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.