wlr.cov2t: Covariance Matrix of Two Weighted Log-rank Tests (Stratified)...

Description Usage Arguments Value Examples

View source: R/wlr.cov2t.R

Description

This function calculates the covariance matrix of two weighted log-rank tests at different analysis times. The two weight functions are specified by stabilized Fleming-Harrington class with parameters (rho, gamma, tau, s.tau), where tau and s.tau are thresholds for survival time and survival rates, respectively. Either tau or s.tau can be specified. tau = Inf or s.tau = 0 reduces to the Fleming-Harrington test (rho, gamma). User-defined weight functions f.ws1 and f.ws2 can be used as well. For example, f.ws1 = function(s)s^rho*(1-s)^gamma is equivalent to Fleming-Harrington (rho, gamma) test with parameters specified for rho and gamma. The first weighted log-rank statistic has weight function w1 at one analysis and the second weighted log-rank test at a later analysis has weight function w2.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
wlr.cov2t(
  time1 = c(5, 7, 10, 12, 12, 15, 20, 20),
  event1 = c(1, 0, 0, 1, 1, 0, 1, 1),
  time2 = c(5, 10, 13, 12, 14, 15, 20, 20),
  event2 = c(1, 0, 1, 1, 1, 1, 1, 1),
  group = c(0, 1, 0, 1, 0, 1, 0, 1),
  strata1 = NULL,
  strata2 = NULL,
  strata3 = NULL,
  rho1 = 0,
  gamma1 = 0,
  tau1 = NULL,
  s.tau1 = 0.5,
  rho2 = 0,
  gamma2 = 1,
  tau2 = NULL,
  s.tau2 = 0.5,
  f.ws1 = NULL,
  f.ws2 = NULL
)

Arguments

group

Treatment group; 1 = experimental group, 0 = control

strata1

Stratification variable 1

strata2

Stratification variable 2

strata3

Stratification variable 3

rho1

Parameter for Fleming-Harrington (rho1, gamma1) weighted log-rank test.

gamma1

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

tau1

Cut point for stabilized FH test, sFH(rho1, gamma1, tau1); with weight function defined as w1(t) = s_tilda1^rho1*(1-s_tilda1)^gamma1, where s_tilda1 = max(s(t), s.tau1) or max(s(t), s(tau1)) if s.tau1 = NULL tau1 = Inf reduces to regular Fleming-Harrington test(rho1, gamma1)

s.tau1

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

rho2

Parameter for Fleming-Harrington (rho2, gamma2) weighted log-rank test.

gamma2

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

tau2

Cut point for stabilized FH test, sFH(rho2, gamma2, tau2); with weight function defined as w2(t) = s_tilda2^rho2*(1-s_tilda2)^gamma2, where s_tilda2 = max(s(t), s.tau2) or max(s(t), s(tau2)) if s.tau2 = NULL tau2 = Inf reduces to regular Fleming-Harrington test(rho2, gamma2)

s.tau2

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

f.ws1

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

f.ws2

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

time

Survival time

event

Event indicator; 1 = event, 0 = censor

Value

An object with dataframes below.

data

dataframe with variables: time1, event1, group, time2, event2.

uni.event.time1

dataframe at analysis time 1 with variables

uni.event.time2

dataframe at analysis time 2 with variables

corr

Correlation between two weigthed log-rank score statistics U1 and U2 evaluated at two analysis times, equivalent to the correlation between two normalized weigthed log-rank statistics Z1 and Z2, where Zi = Ui/sqrt(var(Ui))

cov

Covariance between two weighted log-rank score statistics, U1 and U2 evaluated at two analysis times.

summary.events

dataframe of events summary

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data = simulation.pwexp(nSim=1, N = 600, A = 24, w=1.5, r=1, lam0=log(2)/12, 
      lam1=c(log(2)/12, log(2)/12*0.65), cuts=6, drop0= 0, drop1= 0, 
      targetEvents = c(400, 500))
data.IA = data[[1]]; data.FA = data[[2]]
data.IA$strata1 = data.FA$strata1 = sample(c(1,2), 600, replace = TRUE);
data.IA$strata2 = data.FA$strata2 = sample(c(1,2), 600, replace = TRUE);
data.IA$strata3 = data.FA$strata3 = sample(c(1,2), 600, replace = TRUE);

group = as.numeric(data.IA$treatment == "experimental")
covv = wlr.cov2t(time1=data.IA$survTimeCut, event1=1-data.IA$cnsrCut, time2=data.FA$survTimeCut, event2=1-data.FA$cnsrCut, group=group, rho1=0, gamma1=0, tau1 = NULL, s.tau1=0,rho2=0, gamma2=0, tau2 = NULL, s.tau2=0,f.ws1=NULL, f.ws2=NULL, strata1=data.IA$strata1, strata2=data.IA$strata2, strata3=data.IA$strata3)

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