Description Usage Arguments Details Value Examples
This function calculates the Fisher's information matrix for two weighted log-rank tests under null and alternative hypotheses at two calendar times, which are counted from first subject randomized. The function returns the information matrix, based on the provided enrollment distribution function and random lost-to-followup distribution if applicable.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | wlr.info(
T = c(24, 36),
r = 1,
n = 450,
h0 = function(t) { log(2)/12 },
S0 = function(t) { exp(-log(2)/12 * t) },
h1 = function(t) { log(2)/12 * 0.7 },
S1 = function(t) { exp(-log(2)/12 * 0.7 * t) },
rho = c(0, 0),
gamma = c(0, 0),
tau = NULL,
s.tau = c(0, 0),
f.ws = NULL,
F.entry = function(t) { (t/18) * as.numeric(t <= 18) + as.numeric(t > 18) },
G.ltfu = function(t) { 0 }
)
|
T |
A vector of two calendar times, calculated from first subject randomization date. If the two calendar times are the same or just one calendar time is provided, the two weighted log-rank tests will be evaluated at the same calendar time. |
r |
Randomization ratio of experimental arm : control arm as r:1. When r = 1, it is equal allocation. Default r = 1. |
n |
Total sample size for two arms. Default is NULL. |
h0 |
Hazard function of control arm. h0(t) = log(2)/m0 means T~exponential distribution with median m0. |
S0 |
Survival function of control arm. In general, S0(t) = exp(- integral of h0(u) for u from 0 to t). but providing S0(t) can improves computational efficiency and usually the survival function is known in study design. The density function f0(t) = h0(t) * S0(t). |
h1 |
Hazard function of experimental arm. h1(t) = log(2)/m1 means T~exponential distribution with median m0. |
S1 |
Survival function of experimental arm. In general, S1(t) = exp(- integral of h1(u) for u from 0 to t). but providing S1(t) can improves computational efficiency and usually the survival function is known in study design. The density function f1(t) = h1(t) * S1(t). |
F.entry |
Distribution function of enrollment. For uniform enrollment, F.entry(t) = (t/A) where A is the enrollment period, i.e., F.entry(t) = t/A for 0<=t<=A, and F.entry(t) = 1 when t > A. For more general non-uniform enrollment with weight psi, F.entry(t) = (t/A)^psi*I(0<=t<=A) + I(t>A). Default F.entry is uniform distribution function. |
G.ltfu |
Distribution function of lost-to-follow-up censoring process. The observed survival time is min(survival time, lost-to-follow-up time). Default G.ltfu = 0 (no lost-to-followup) |
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) |
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. |
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.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. |
If the only one weighted log-rank test is provided, the Fisher information will be calculated only for the provided weighted log-rank test. A weighted log-rank test specification requires the explicit weight function.
If the total sample size is not provided, then the covariance matrix of n^-1/2*(U1, U2) will be provided, where U1 and U2 are the corresponding weighted log-rank scores. U1 and U2 can be based on two different calendar times. A combination test can be constructed accordingly based on the asymptotic multivariate normal distribution of n^-1/2*(U1, U2) when U1 and U2 are from the same calendar time, i.e. the same analysis.
An object with dataframes below.
cov.H0: Covariance matrix of n**(- 1 / 2) * (U1, U2) under H1, where U1 and U2 are weighted log-rank score statistics.
info.H0: Fisher's information under H0. H0: survival distribution follows control arm.
corr.H0: Correlation between U1 and U2 under H0
cov.H1: Covariance matrix of n**(- 1 / 2) * (U1, U2) under H1, where U1 and U2 are weighted log-rank score statistics.
info.H1: Fisher's information under H1. H1: survival distribution follows weighted average of control arm and experimental arm, i.e., S = p1 * S1 + p0 * S0.
corr.H1: Correlation between U1 and U2 under H1
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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | #Example (1) Trial scenario: 1:1 randomization, n = 450, enrollment follows non-uniform
#enrollment distribution with weight 1.5 and enrollment period is 18 months.
#Control arm ~ exponential distribution with median 12 months, and
#Experimental arm ~ exponential distribution (Proportional Hazards) with median 12 / 0.7 months.
#Assuming no lost-to-followup. Find the expected number of events at calendar time 24 months, i.e.
#6 months after last patient randomized.
HR = 0.65; delay = 6; lambda0 = log(2) / 12;
h0 = function(t){lambda0}; S0 = function(t){exp(-lambda0 * t)}
lambda1 = lambda0 * HR
h1 = function(t){lambda1}; S1= function(t){exp(-lambda1 * t)}
F.entry = function(t){(t/18)^1.5*as.numeric(t <= 18) + as.numeric(t > 18)}
#(a) 1 weighted log-rank test at 1 analysis time
wlr.info(T = c(24), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0), gamma = c(0), tau = NULL, s.tau = c(0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
#(b) 2 weighted log-rank tests at 1 analysis time
wlr.info(T = c(24), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(0,1), tau = NULL, s.tau = c(0,0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
#(c) 1 weighted log-rank test at 2 analysis times. If run
#the same weighted log-rank test at each analysis time separately,
#then no correation will be produced.
wlr.info(T = c(24, 36), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0), gamma = c(0), tau = NULL, s.tau = c(0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
#(d) 2 weighted log-rank tests at 2 analysis times.
#Log-rank and FH01 at 24 and 36 months respectively.
wlr.info(T = c(24,36), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(0,1), tau = NULL, s.tau = c(0,0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
#Same results using f.ws2() function to specify the F-H weight
wlr.info(T = c(24,36), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(0,1), tau = NULL, s.tau = c(0,0), f.ws = list(function(s){1},function(s){(1-s)}),
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
#(e) Draw plot of information for log-rank test and FH01 for T in (0, 48)
maxT = 48
info.lr.H0 = info.lr.H1 =info.fh.H0 =info.fh.H1 =info.sfh.H0 =info.sfh.H1 = rep(NA, maxT)
for (i in 1:maxT) {
lr = wlr.info(T = i, r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0), gamma = c(0), tau = NULL, s.tau = c(0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
info.lr.H0[i] = lr$info.H0; info.lr.H1[i] = lr$info.Hp;
fh = wlr.info(T = i, r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0), gamma = c(1), tau = NULL, s.tau = c(0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
info.fh.H0[i] = fh$info.H0; info.fh.H1[i] = fh$info.Hp;
sfh = wlr.info(T = i, r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0), gamma = c(1), tau = NULL, s.tau = c(0.5), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
info.sfh.H0[i] = sfh$info.H0; info.sfh.H1[i] = sfh$info.Hp;
}
plot(1:maxT, info.lr.H0/info.lr.H0[maxT], type="n", ylim=c(0, 1),
xlab="Months", ylab = "Information Fraction")
lines(1:maxT, info.lr.H0/info.lr.H0[maxT], lty = 1, col=1)
lines(1:maxT, info.lr.H1/info.lr.H1[maxT], lty = 2, col=1)
lines(1:maxT, info.fh.H0/info.fh.H0[maxT], lty = 1, col=2)
lines(1:maxT, info.fh.H1/info.fh.H1[maxT], lty = 2, col=2)
lines(1:maxT, info.sfh.H0/info.sfh.H0[maxT], lty = 1, col=3)
lines(1:maxT, info.sfh.H1/info.sfh.H1[maxT], lty = 2, col=3)
legend(0, 1, c("Log-rank(H0)", "Log-rank(H1)", "FH01(H0)", "FH01(H1)", "sFH01(H0)", "sFH01(H1)"), col=c(1,1,2,2,3,3), lty=c(1,2,1,2,1,2), bty="n", cex=0.8)
#(f) Draw plot of correlation between IA and FA over the timing of IA
maxT = 48
corr.lr.H0 = corr.lr.H1 =corr.fh.H0 =corr.fh.H1 =corr.sfh.H0 =corr.sfh.H1 = rep(NA, maxT)
for (i in 1:maxT) {
lr = wlr.info(T = c(i, maxT), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0), gamma = c(0), tau = NULL, s.tau = c(0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.lr.H0[i] = lr$corr.H0; corr.lr.H1[i] = lr$corr.Hp;
fh = wlr.info(T = c(i, 48), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0), gamma = c(1), tau = NULL, s.tau = c(0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.fh.H0[i] = fh$corr.H0; corr.fh.H1[i] = fh$corr.Hp;
sfh = wlr.info(T = c(i, 48), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0), gamma = c(1), tau = NULL, s.tau = c(0.5), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.sfh.H0[i] = sfh$corr.H0; corr.sfh.H1[i] = sfh$corr.Hp;
}
plot(1:maxT, corr.lr.H0, type="n", ylim=c(0, 1),
xlab="Months", ylab = "Correlation btw IA and FA")
lines(1:maxT, corr.lr.H0, lty = 1, col=1)
lines(1:maxT, corr.lr.H1, lty = 2, col=1)
lines(1:maxT, corr.fh.H0, lty = 1, col=2)
lines(1:maxT, corr.fh.H1, lty = 2, col=2)
lines(1:maxT, corr.sfh.H0, lty = 1, col=3)
lines(1:maxT, corr.sfh.H1, lty = 2, col=3)
legend(0, 1, c("Log-rank(H0)", "Log-rank(H1)", "FH01(H0)", "FH01(H1)", "sFH01(H0)", "sFH01(H1)"), col=c(1,1,2,2,3,3), lty=c(1,2,1,2,1,2), bty="n", cex=0.8)
#(g) Draw a plot to show the theoretical calculation between correlation and sqrt(information fraction)
#Before enrollment complete, the correlation > sqrt(Information Fraction).
#After enrollment complete, they are equivalent.
plot(1:maxT, corr.lr.H0, type="n", ylim=c(0, 1),
xlab="Months", ylab = "Correlation btw IA and FA")
lines(1:maxT, corr.lr.H0, lty = 1, col=1)
lines(1:maxT, sqrt(info.lr.H0/info.lr.H0[maxT]), lty = 2, col=1)
lines(1:maxT, corr.fh.H0, lty = 1, col=2)
lines(1:maxT, sqrt(info.fh.H0/info.fh.H0[maxT]), lty = 2, col=2)
lines(1:maxT, corr.sfh.H0, lty = 1, col=3)
lines(1:maxT, sqrt(info.sfh.H0/info.sfh.H0[maxT]), lty = 2, col=3)
legend(0, 1, c("Log-rank(H0): corr", "Log-rank(H0): sqrt(IF)", "FH01(H0): corr", "FH01(H0): sqrt(IF)", "sFH01(H0): corr", "sFH01(H0): sqrt(IF)"), col=c(1,1,2,2,3,3), lty=c(1,2,1,2,1,2), bty="n", cex=0.8)
#(h) Draw plot of correlation between IA and FA for different choices of tests at IA and FA
maxT = 48
corr.lr.lr.H0 =corr.lr.fh.H0 = corr.lr.sfh.H0 = rep(NA, maxT)
corr.fh.lr.H0 =corr.fh.fh.H0 =corr.fh.sfh.H0 = rep(NA, maxT)
corr.sfh.lr.H0 =corr.sfh.fh.H0 =corr.sfh.sfh.H0 = rep(NA, maxT)
for (i in 1:maxT) {
lr.lr = wlr.info(T = c(i, maxT), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(0,0), tau = NULL, s.tau = c(0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.lr.lr.H0[i] = lr.lr$corr.H0;
lr.fh = wlr.info(T = c(i, 48), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(0,1), tau = NULL, s.tau = c(0,0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.lr.fh.H0[i] = lr.fh$corr.H0;
lr.sfh = wlr.info(T = c(i, 48), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(0,1), tau = NULL, s.tau = c(0, 0.5), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.lr.sfh.H0[i] = lr.sfh$corr.H0;
fh.lr = wlr.info(T = c(i, maxT), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(1,0), tau = NULL, s.tau = c(0,0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.fh.lr.H0[i] = fh.lr$corr.H0;
fh.fh = wlr.info(T = c(i, 48), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(1,1), tau = NULL, s.tau = c(0,0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.fh.fh.H0[i] = fh.fh$corr.H0;
fh.sfh = wlr.info(T = c(i, 48), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(1,1), tau = NULL, s.tau = c(0,0.5), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.fh.sfh.H0[i] = fh.sfh$corr.H0;
sfh.lr = wlr.info(T = c(i, maxT), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(1,0), tau = NULL, s.tau = c(0.5, 0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.sfh.lr.H0[i] = sfh.lr$corr.H0;
sfh.fh = wlr.info(T = c(i, 48), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,1), gamma = c(0,1), tau = NULL, s.tau = c(0.5, 0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.sfh.fh.H0[i] = sfh.fh$corr.H0;
sfh.sfh = wlr.info(T = c(i, 48), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,1), gamma = c(0,1), tau = NULL, s.tau = c(0.5, 0.5), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
corr.sfh.sfh.H0[i] = sfh.sfh$corr.H0;
}
plot(1:maxT, corr.lr.H0, type="n", ylim=c(0, 1),
xlab="Months", ylab = "Correlation btw IA and FA")
lines(1:maxT, corr.lr.lr.H0, lty = 1, col=1)
lines(1:maxT, corr.lr.fh.H0, lty = 2, col=1)
lines(1:maxT, corr.lr.sfh.H0, lty = 3, col=1)
lines(1:maxT, corr.fh.lr.H0, lty = 1, col=2)
lines(1:maxT, corr.fh.fh.H0, lty = 2, col=2)
lines(1:maxT, corr.fh.sfh.H0, lty = 3, col=2)
lines(1:maxT, corr.sfh.lr.H0, lty = 1, col=3)
lines(1:maxT, corr.sfh.fh.H0, lty = 2, col=3)
lines(1:maxT, corr.sfh.sfh.H0, lty = 3, col=3)
legend(0, 1, c("LR-LR(H0)", "LR-FH(H0)", "LR-sFH(H0)",
"FH-LR(H0)", "FH-FH(H0)", "FH-sFH(H0)",
"sFH-LR(H0)", "sFH-FH(H0)", "sFH-sFH(H0)"), col=c(1,1,1,2,2,2,3,3,3),
lty=c(1:3,1:3,1:3), bty="n", cex=0.8)
#Example (2) Same trial set up as example (1) but assuming delayed effect for
experimental arm. The delayed period is assumed 6 months, and after delay the
hazard ratio is assumed 0.65.
HR = 0.65; delay = 6; lambda0 = log(2) / 12;
h0 = function(t){lambda0}; S0 = function(t){exp(-lambda0 * t)}
#Hazard function and survival function for experimental arm
h1 = function(t){lambda0*as.numeric(t < delay)+HR*lambda0*as.numeric(t >= delay)}
c = exp(-delay*lambda0*(1-HR));
S1 = function(t){exp(-lambda0*t)*as.numeric(t<delay) + c*exp(-HR*lambda0*t)*as.numeric(t>=delay)}
F.entry = function(t){(t/18)^1.5*as.numeric(t <= 18) + as.numeric(t > 18)}
#2 weighted log-rank tests at 2 analysis times.
#Log-rank and FH01 at 24 and 36 months respectively.
wlr.info(T = c(24,36), r = 1, h0 = h0, S0= S0, h1 = h1, S1=S1,
rho = c(0,0), gamma = c(0,1), tau = NULL, s.tau = c(0,0), f.ws = NULL,
F.entry = F.entry, G.ltfu = function(t){0}, n = 450)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.