Description Usage Arguments Value Examples
View source: R/wlr.inference.R
This function calculates the actual rejection boundary for the next analysis using weighted log-rank test based on the datasets from previous analyses. In standard log-rank test, the rejection boundaries can be determined based on the number of events and the alpha spending function, because the asymptotic distribution can be approximated by the number of events. However, when using weighted log-rank test, the asymptotic distribution is usually associated with the pooled survival curve estimated from the actual data, eg, Fleming-Harrington class. As a result, the actual rejection boundary depends on the asymptotic correlation estimated from the actual data. Refer to Tsiatis (1982) for the consistent estimator of the asymptotic correlation matrix.
1 2 3 4 5 6 7 8 |
data |
The dataframe used for the analyses including all data in previous analyses. For example, for the first analysis, data = list(IA1 = data1). For the 2nd analysis, data = list(IA1 = data1, IA2=data2), where data1 is the data used for the first analysis. If IA2 is the final analysis, data = list(IA1 = data1, FA=data2). For the 3rd analysis, data = list(IA1 = data1, IA2=data2, IA3=data3) or data = list(IA1 = data1, IA2=data2, FA=data3). Every dataset must be sorted by subject id and is required have a format of 1 subject 1 record. In the current version, every dataset must have the same subjects. Furthermore, each dataset must include the following variables: (1) survTimeCut - Survival time for each analysis; (2) cnsrCut - Censoring status for each analysis (0 = event; 1 = censored); (3) group - Treatment group (0 = control, 1 = experimental treatment); (4) strata1, strata2, strata3: Stratification variables. Up to 3 stratification factors are allowed in the current version. |
alpha |
Incremental type I errors (1-sided) allocated to the analyses in group sequential tests. Must be 1-sided type I error. The sum of alpha is the overall alpha allocated to the hypothesis test. For example, IA has type I error 0.01, and the overall type I error is 0.025, then alpha = c(0.01, 0.015). If alpha is specified, sf is ignored. For another example, if the current analysis is IA2 and the cumulative type I error spending up to IA2 is 0.02, and IA1 has type I error spending of 0.005, then alpha = c(0.005, 0.015). alpha_i = P(accept H0 for first i-1 analyses and reject H0 at ith analysis | H0). If the cumulative alpha spending by ith analysis is ai, then alpha_i = ai - a_i-1. |
f.ws |
Weight functions in the weighted logrank tests for all previous analyses and the current analysis. For example, IA1 uses standard log-rank test, IA2 uses a maxcombo test of (logrank, FH01), and FA uses a maxcombo test of (logrank, FH01, FH11). Then f.ws = list(IA1=list(lr), IA2=list(lr, fh01), FA=list(lr, fh01, fh11)), where define lr = function(s)1; fh01=function(s)1-s; fh11 = function(s)s*(1-s). For another example, if only fh01 is used for all three analyses, then f.ws = list(IA1=list(fh01), IA2=list(fh01), FA1=list(fh01)). |
test.results: Including actual rejection boundary and statistical inference.
corr: Correlation matrix among the weighted log-rank tests at different analyses.
wt: Weight functions used for each analysis
alpha: Incremental type I error used for each analysis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #Simulate a dataset: 600 subjects, control arm median 12 months following exponential
distribution, 1:1 randomization, recruitment period 24 months with weight parameter 1.5.
Experimental arm has delayed effect of 6 months. The HR after delay is 0.65.
Three analyses are performed at 300, 400, and 500 events.
data0 = 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(300, 400, 500))
data1 = data0[[1]][sim==1,]; data2 = data0[[2]][sim==1,]; data3 = data0[[3]][sim==1,]
#Add strata variables
data1$strata1 = data1$strata2 =data1$strata3 =sample(c(1,2), 600, replace = TRUE);
data2$strata1 = data2$strata2 =data2$strata3 =sample(c(1,2), 600, replace = TRUE);
data3$strata1 = data3$strata2 =data3$strata3 =sample(c(1,2), 600, replace = TRUE);
data1$group = as.numeric(data1$treatment == "experimental")
data2$group = as.numeric(data2$treatment == "experimental")
data3$group = as.numeric(data3$treatment == "experimental")
km.IA1<-survival::survfit(survival::Surv(survTimeCut,1-cnsrCut)~treatment,data=data1)
plot(km.IA1,xlab="Month Since Randomization",ylab="Survival",lty=1:2,xlim=c(0,36))
km.IA2<-survival::survfit(survival::Surv(survTimeCut,1-cnsrCut)~treatment,data=data2)
plot(km.IA2,xlab="Month Since Randomization",ylab="Survival",lty=1:2,xlim=c(0,36))
km.FA<-survival::survfit(survival::Surv(survTimeCut,1-cnsrCut)~treatment,data=data3)
plot(km.FA,xlab="Month Since Randomization",ylab="Survival",lty=1:2,xlim=c(0,36))
#Define weight functions for weighted log-rank tests
lr = function(s){1}; fh01 = function(s){(1-s)}; fh11 = function(s){s*(1-s)}
sfh01 = function(s){s1 = apply(cbind(s, 0.5), MARGIN=1,FUN=max); return(1-s1)}
#Example (1). 2 IAs and FA. IA1 uses log-rank test; IA2 uses max(log-rank and FH01);
# FA uses max(log-rank, FH01, FH11).
wlr.inference(data=list(IA1=data1, IA2=data2, FA=data3),
alpha = c(0.005, 0.01, 0.01),
strata1 = data1$strata1, strata2 = data1$strata2, strata3 = NULL,
f.ws=list(IA1=list(lr), IA2=list(lr, fh01), FA=list(lr, fh01, fh11)))
#Example (2a). 2 IAs and FA. IA1 uses log-rank test; IA2 uses max(log-rank and sFH01);
# FA uses max(log-rank, FH01). Unstratified analysis
wlr.inference(data=list(IA1=data1, IA2=data2, FA=data3),
alpha = c(0.005, 0.01, 0.01), strata1 = NULL, strata2 = NULL, strata3 = NULL,
f.ws=list(IA1=list(lr), IA2=list(lr, sfh01), FA=list(lr, fh01)))
#Example (2b). 2 IAs and FA. IA1 uses log-rank test; IA2 uses max(log-rank and sFH01);
# FA uses max(log-rank, FH01).
# Stratified analysis of 2 stratification factors
wlr.inference(data=list(IA1=data1, IA2=data2, FA=data3),
alpha = c(0.005, 0.01, 0.01), strata1 = data1$strata1,
strata2 = data1$strata2, strata3 = NULL,
f.ws=list(IA1=list(lr), IA2=list(lr, sfh01), FA=list(lr, fh01)))
#Example (2c). 2 IAs and FA. IA1 uses log-rank test; IA2 uses max(log-rank and sFH01);
# FA uses max(log-rank, FH01).
# Stratified analysis of 3 stratification factors
wlr.inference(data=list(IA1=data1, IA2=data2, FA=data3),
alpha = c(0.005, 0.01, 0.01),strata1 = data1$strata1,
strata2 = data1$strata2, strata3 = data1$strata3,
f.ws=list(IA1=list(lr), IA2=list(lr, sfh01), FA=list(lr, fh01)))
#Example (3). 2 IAs and FA. IA1 uses log-rank test; IA2 uses max(log-rank and sFH01);
# FA uses max(log-rank, FH01).
wlr.inference(data=list(IA1=data1, IA2=data2, FA=data3),
alpha = c(0.005, 0.01, 0.01), strata1 = data1$strata1,
strata2 = data1$strata2, strata3 = NULL,
f.ws=list(IA1=list(lr), IA2=list(lr, sfh01), FA=list(lr, fh01)))
#Example (4). 2 IAs and FA. All analyses use max(logrank, sfh01).
wlr.inference(data=list(IA1=data1, IA2=data2, FA=data3),
alpha = c(0.005, 0.01, 0.01), strata1 = data1$strata1,
strata2 = data1$strata2, strata3 = NULL,
f.ws=list(IA1=list(lr, sfh01), IA2=list(lr, sfh01), FA=list(lr, sfh01)))
#For each analysis, the wlr.maxcombo() function can perform
#stratified maxcombo test and produce the equivalent p value.
#However, wlr.maxcombo() function cannot provide statistical inference
#without considering the actual rejection boundary.
wlr.maxcombo(time=data1$survTimeCut, event=1-data1$cnsrCut, group=data1$group,
rho=NULL, gamma=NULL, tau = NULL, s.tau=NULL,
strata1 = data1$strata1, strata2=data1$strata2, strata3=data1$strata3,
f.ws=list(lr, sfh01), side = 1)
#Example (5). 2 IAs and FA. All analyses use logrank.
wlr.inference(data=list(IA1=data1, IA2=data2, FA=data3),
alpha = c(0.005, 0.01, 0.01), strata1 = data1$strata1,
strata2 = data1$strata2, strata3 = NULL,
f.ws=list(IA1=list(lr), IA2=list(lr), FA=list(lr)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.