Scoring_TTE: Score Time-to-Event Pairwise Comparisons

View source: R/Scoring_TTE.R

Scoring_TTER Documentation

Score Time-to-Event Pairwise Comparisons

Description

Assigns win, loss, or unresolved scores to subject pairs based on a time-to-event endpoint. This function is typically used for the first, highest-priority layer in a hierarchical win ratio analysis.

Usage

Scoring_TTE(dataset, var1, var2, censor1, censor2)

Arguments

dataset

A data frame containing pairwise subject comparisons. The data frame must contain columns named score, WR_cat, usubjid1, and usubjid2.

var1

Character. Name of the time-to-event column for subject 1.

var2

Character. Name of the time-to-event column for subject 2.

censor1

Character. Name of the event indicator column for subject 1, coded as 1 for event and 0 for censored.

censor2

Character. Name of the event indicator column for subject 2, coded as 1 for event and 0 for censored.

Value

A data frame matching dataset, with updated score and WR_cat columns. Scores are 1 when subject 1 wins, -1 when subject 2 wins, and NA when the comparison remains tied or unresolved because of censoring.

Examples

pairs <- data.frame(
  usubjid1 = c(1, 1),
  usubjid2 = c(2, 3),
  deathdays1 = c(360, 120),
  deathdays2 = c(100, 200),
  death1 = c(0, 1),
  death2 = c(1, 1),
  score = NA_real_,
  WR_cat = ""
)

Scoring_TTE(pairs, "deathdays1", "deathdays2", "death1", "death2")

winratiosim documentation built on July 7, 2026, 1:07 a.m.