Description Usage Arguments Value Examples
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.
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
)
|
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 |
An object with dataframes below.
dataframe with variables: time1, event1, group, time2, event2.
dataframe at analysis time 1 with variables
u.Ne: Number of unique event times;
u.eTime: Unique event times;
Y0: Risk set of control arm at each of unique event times;
Y1: Risk set of experimental arm at each of unique event times;
Y: Risk set of pooled data at each of unique event times;
dN0: Event set of control arm at each of unique event times;
dN1: Event set of experimental arm at each of unique event times;
dN: Event set of pooled data at each of unique event times;
s1: Survival time of pooled data by KM method;
w1: Weight function w1(t) at each of unique event times;
w2t1: Weight function w2(t) evaluated at each of unique event times at analysis time 1;
V11: Variance statistic at each of unique event times for w1;
V12: Covariance statistic at each of unique event times for weighted log-rank test 1 and 2;
dataframe at analysis time 2 with variables
u.Ne: Number of unique event times;
u.eTime: Unique event times;
Y0: Risk set of control arm at each of unique event times;
Y1: Risk set of experimental arm at each of unique event times;
Y: Risk set of pooled data at each of unique event times;
dN0: Event set of control arm at each of unique event times;
dN1: Event set of experimental arm at each of unique event times;
dN: Event set of pooled data at each of unique event times;
s2: Survival time of pooled data by KM method;
w2: Weight function w1(t) at each of unique event times;
V22: Variance statistic at each of unique event times for weighted log-rank test 2;
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))
Covariance between two weighted log-rank score statistics, U1 and U2 evaluated at two analysis times.
dataframe of events summary
total.events1: Total number of events at analysis time 1
total.events2: Total number of events at analysis time 2
event.ratio: Ratio of events for analysis time 1 vs 2
sqrt.event.ratio: Square root of event.ratio. With large samples, when the same weighted log-rank test is used at two analysis times, the square root of event.ratio is approximately the correlation, estimated based on its consistent estimator, between the two weighted log-rank test statistics evaluated at two different times. Note: sqrt.event.ratio is not an approximation to the correlation when two different weighted log-rank tests are used at two different analysis times. In addition, sqrt.event.ratio doesn't consider stratified analysis.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.