wlr: Stratified Weighted Log-rank Test

Description Usage Arguments Value Examples

View source: R/wlr.R

Description

The weight function includes Stabilized Fleming-Harrington class (rho, gamma, tau, s.tau), and any user-defined weight function. For the stabilized Fleming-Harrington class, to produce stabilized weighting function from pooled survival curve, specify either tau or s.tau, which are thresholds in survival time and survival rate, respectively. The weight function is based on the pooled survival curve within each strata by default.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
wlr(
  time = c(5, 7, 10, 12, 12, 15, 20, 20),
  event = c(1, 0, 0, 1, 1, 0, 1, 1),
  group = c(0, 1, 0, 1, 0, 1, 0, 1),
  strata1 = NULL,
  strata2 = NULL,
  strata3 = NULL,
  rho = 0,
  gamma = 1,
  tau = NULL,
  s.tau = 0.5,
  f.ws = NULL,
  side = c("two.sided", "one.sided")
)

Arguments

time

Survival time

event

Event indicator; 1 = event, 0 = censor

group

Treatment group; 1 = experimental group, 0 = control

strata1

Stratification variable 1

strata2

Stratification variable 2

strata3

Stratification variable 3

rho

Parameter for Fleming-Harrington (rho, gamma) weighted log-rank test.

gamma

Parameter for Fleming-Harrington (rho, gamma) weighted log-rank test. For log-rank test, set rho = gamma = 0.

tau

Cut point for stabilized FH test, sFH(rho, gamma, tau); with weight function defined as w(t) = s_tilda^rho*(1-s_tilda)^gamma, where s_tilda = max(s(t), s.tau) or max(s(t), s(tau)) if s.tau = NULL tau = Inf reduces to regular Fleming-Harrington test(rho, gamma)

s.tau

Survival rate cut S(tau) at t = tau; default 0.5, ie. cut at median. s.tau = 0 reduces to regular Fleming-Harrington test(rho, gamma)

f.ws

Self-defined weight function of survival rate. For example, f.ws = function(s)1/max(s, 0.25) When f.ws is specified, the weight function takes it as priority.

    Note: The actual math formula for weighting function is based on 
    the left of each event time t, i.e., w(t) = f.ws(s(t-)). 
    For FH(rho, gamma) test, when gamma = 0, then the first event time has 
    weight 1;  when gamma > 0, the first event weight is 0. This can 
    ensure consistency with FH(0,0) = logrank; and FH(1,0) = generalized Wilcoxon.
side

Type of test. one.sided or two.sided. default = two.sided

Value

An object with dataframes below.

data

dataframe including the following variables:

uni.event.time

dataframe of unique event times and intermediate statistics including the following variables:

test.results.strata

dataframe of intermediate calculation per stratum

test.results

dataframe including the following variables:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
wlr(time=rexp(100), event=sample(c(0,1), 100, replace = TRUE), group=c(rep(0, 50), rep(1, 50)), rho=0, gamma=1, tau = NULL, s.tau=0, strata1=sample(c(1,2), 100, replace = TRUE),strata2=NULL, strata3=NULL)
wlr(time=rexp(100), event=sample(c(0,1), 100, replace = TRUE), group=c(rep(0, 50), rep(1, 50)), rho=0, gamma=1, tau = NULL, s.tau=0, strata1=sample(c(1,2), 100, replace = TRUE), strata2=sample(c(1,2), 100, replace = TRUE))
wlr(time=rexp(100), event=sample(c(0,1), 100, replace = TRUE), group=c(rep(0, 50), rep(1, 50)), rho=0, gamma=1, tau = NULL, s.tau=0, strata1=sample(c(1,2), 100, replace = TRUE), strata2=sample(c(1,2), 100, replace = TRUE), strata3=sample(c(1,2), 100, replace = TRUE))
wlr(time=rexp(100), event=sample(c(0,1), 100, replace = TRUE), group=c(rep(0, 50), rep(1, 50)), rho=0, gamma=1, tau = NULL, s.tau=0, strata1=sample(c(1,2), 100, replace = TRUE), strata2=sample(c(1,2), 100, replace = TRUE), strata3=sample(c(3,4), 100, replace = TRUE), f.ws=function(s){1/max(s^2, 0.25)})
wlr(time=c(5,7,10,12,12,15,20,20), event=c(1,0,0,1,1,0,1,1), group=c(0,1,0,1,0,1,0,1), rho=0, gamma=1, tau = 3, s.tau=NULL)
wlr(time=c(5,7,10,12,12,15,20,20), event=c(1,0,0,1,1,0,1,1), group=c(0,1,0,1,0,1,0,1), rho=0, gamma=1, tau = 20, s.tau=NULL)
wlr(time=c(5,7,10,12,12,15,20,20), event=c(1,0,0,1,1,0,1,1), group=c(0,1,0,1,0,1,0,1), rho=0, gamma=1, tau = Inf, s.tau=NULL)
wlr(time=c(12,7,10,5,12,15,20,20), event=c(1,0,0,1,1,0,1,1), group=c(1,1,0,0,0,1,0,1), rho=0, gamma=1, tau = 10, s.tau=NULL)
wlr(time=c(12,7,10,5,12,15,20,20), event=c(1,0,0,1,1,0,1,1), group=c(1,1,0,0,0,1,0,1), rho=0, gamma=1, tau = 10, s.tau=0.5, side="one.sided")
wlr(time=c(12,7,10,5,12,15,20,20), event=c(1,0,0,1,1,0,1,1), group=c(1,1,0,0,0,1,0,1), rho=0, gamma=0, tau = 10, s.tau=0.5, side="one.sided")
wlr(time=c(12,7,10,5,12,15,20,20), event=c(1,0,0,1,1,0,1,1), group=c(1,1,0,0,0,1,0,1), rho=0, gamma=0, tau = 10, s.tau=0, side="one.sided")

phe9480/rgs documentation built on March 1, 2022, 12:26 a.m.