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

Description Usage Arguments Value Examples

View source: R/wlr.cov.R

Description

This function calculates the covariance matrix of two weighted log-rank tests at the same analysis time. 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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
wlr.cov(
  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,
  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

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

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.

Value

An object with dataframes below.

data

dataframe with variables: time, event, group, strata1, strata2, strata3.

uni.event.time

dataframe with variables

corr

Correlation between two weigthed log-rank score statistics U1 and U2, 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.

Examples

1
2
wlr.cov(time=rexp(100), event=sample(c(0,1), 100, replace = TRUE), group=c(rep(0, 50), rep(1, 50)), 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)
wlr.cov(time=rexp(100), event=sample(c(0,1), 100, replace = TRUE), group=c(rep(0, 50), rep(1, 50)), 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,strata1=sample(c(1,2), 100, replace = TRUE),strata2=sample(c(1,2), 100, replace = TRUE),strata3=sample(c(1,2), 100, replace = TRUE))

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