Package 'WinsCRT'

Title: Win Statistics Inference for Cluster-Randomized Trials
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>.
Authors: Xi Fang [aut, cre], Fan Li [aut]
Maintainer: Xi Fang <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2026-06-18 19:35:45 UTC
Source: https://github.com/cran/WinsCRT

Help Index


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:

  • st = 0: censoring / terminal no event

  • positive integers denote event types

  • larger positive value indicates higher priority

Columns:

  • clu: cluster ID

  • id: subject ID within cluster

  • trt: cluster treatment indicator (0/1)

  • t: event/censoring time

  • st: event status / priority code


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:

  • status = 0 means censor/no event

  • for positive statuses, larger value means higher priority (smaller value means lower priority)

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)