Package {WinsCRT}


Title: Win Statistics Inference for Cluster-Randomized Trials
Version: 0.1.0
Description: Provides estimation and inference for win statistics in cluster-randomized trials with prioritized (hierarchical) composite outcomes. Supported summaries include the win ratio, win odds, net benefit, and desirability of outcome ranking (DOOR), with variance estimation and testing procedures that account for within-cluster correlation. Methods are described in the accompanying manuscript (2026) <doi:10.48550/arXiv.2604.18341>.
License: GPL-3
Encoding: UTF-8
Depends: R (≥ 2.10)
Imports: Rcpp, stats
LinkingTo: Rcpp
RoxygenNote: 7.3.2
NeedsCompilation: yes
Packaged: 2026-06-10 22:15:19 UTC; xi32457
Author: Xi Fang [aut, cre], Fan Li [aut]
Maintainer: Xi Fang <x.fang@yale.edu>
Repository: CRAN
Date/Publication: 2026-06-18 13:40:07 UTC

WinsCRT: Win-statistics inference for CRT prioritized event logs

Description

Computes one requested estimand and performs inference using one requested method. Input must be longitudinal event-log data with cluster-level treatment.

Status convention:

Usage

WinsCRT(
  data,
  cluster,
  subject,
  trt,
  time,
  status,
  method = c("wald_score", "wald_u", "wald_jk", "perm", "fs", "jel"),
  estimand = c("WD", "WR", "WO", "DOOR"),
  null = NULL,
  alternative = c("two.sided", "greater", "less"),
  alpha = 0.05,
  use_t = TRUE,
  B = 2000L,
  seed = NULL,
  keep = NULL,
  strict = TRUE
)

Arguments

data

data.frame in long event-log format.

cluster

character: cluster id column.

subject

character: subject id column.

trt

character: treatment column (0/1), constant within cluster.

time

character: event/censoring time column (numeric).

status

character: status/priority column (integer >=0).

method

one of "wald_score","wald_u","wald_jk","perm","fs","jel".

estimand

one of "WD","WR","WO","DOOR".

null

optional null value; default is canonical by estimand.

alternative

"two.sided","greater","less" where applicable.

alpha

confidence level is 1-alpha (default 0.05).

use_t

logical; t-reference where implemented.

B

integer; resamples for perm and optional fs randomization p-value.

seed

optional integer seed.

keep

optional vector of cluster IDs to include.

strict

logical passed to C++ kernels.

Value

Object of class "WinsCRT".

Examples

ex_dat <- data.frame(
  clu = rep(1:4, each = 2),
  id = rep(1:2, times = 4),
  trt = rep(c(0, 0, 1, 1), each = 2),
  t = c(5, 4, 6, 7, 6, 5, 7, 8),
  st = c(0, 1, 0, 1, 0, 1, 0, 1)
)

fit <- WinsCRT(
  data = ex_dat,
  cluster = "clu",
  subject = "id",
  trt = "trt",
  time = "t",
  status = "st",
  method = "perm",
  estimand = "WD",
  B = 19L,
  seed = 1
)
fit
summary(fit)

Example prioritized event-log dataset

Description

dat is an example longitudinal event-log dataset for demonstrating WinsCRT().

Usage

data(dat)

Format

A data frame with columns clu, id, trt, t, st.

Details

Status coding convention:

Columns: