A function to calculate the variance and covariance of estimated restricted mean survival time using data from different cut-off points accounting for delayed treatment, discontinued treatment and non-uniform entry
rmstcov(t1cut=2.0,t1study=2.5,t2cut=3.0,t2study=3.5,taur=5,
u=c(1/taur,1/taur),ut=c(taur/2,taur),
rate1=c(1,0.5),rate2=rate1,rate3=c(0.7,0.4),
rate4=rate2,rate5=rate2,ratec=c(0.5,0.6),
tchange=c(0,1),type=1,rp2=0.5,
eps=1.0e-2,veps=1.0e-2)
time point at which rmst is calculated
the study time point from first patient in, it must be larger than t1cut
. This will be used for study monitoring.
time point at which rmst is calculated. t2cut
must be not smaller than t1cut
.
the study time point from first patient in, it must be larger than t2cut
. This will be used for study monitoring.
rmst at cut-point t1cut
with study time t1study
rmst at cut-point t2cut
with study time t2study
rmst at cut-point t1cut
with study time t2study
, which should be the same as rmst
.
the variance of rmst
the variance of rmst1
the covariance of rmst
and rmst1
another covariance of rmst
and rmst1
, should be the same as cov
time point at which rmst is calculated
the study time point from first patient in, it must be larger than t1cut
. This will be used for study monitoring.
time point at which rmst is calculated. t2cut
must be not smaller than t1cut
.
the study time point from first patient in, it must be larger than t2cut
. This will be used for study monitoring.
Recruitment time
Piecewise constant recuitment rate
Recruitment intervals
piecewise constant event rate before crossover
piecewise constant event rate after crossover
piecewise constant event rate for crossover
additional piecewise constant event rate for more complex crossover
additional piecewise constant event rate for more complex crossover
Hazard for time to censoring
a strictly increasing sequence of time points starting from zero at which event rate changes. The first element of tchange must be zero. The above rates rate1
to ratec
and tchange must have the same length.
type of crossover, 1=markov, 2=semi-markov, 3=hybrid
re-randomization probability to receive the rescue treatment when semi-markov crossover occurs. When it happens, the overall hazard will be pi2*r2(t-s)+(1-pi2)*r4(t), where r2 is the hazard for the semi-markov rescue treatment and r4 is hazard for the markov rescue treatment.
A small number representing the error tolerance when calculating the utility function $$\Phi_l(x)=\frac{\int_0^x s^l e^{-s}ds}{x^{l+1}}$$ with \(l=0,1,2\).
A small number representing the error tolerance when calculating the variance.
Xiaodong Luo
More details
Luo et al. (2018) Design and monitoring of survival trials in complex scenarios, Statistics in Medicine <doi: https://doi.org/10.1002/sim.7975>.
r1<-c(0.6,0.3)
r2<-c(0.6,0.6)
r3<-c(0.1,0.2)
r4<-c(0.5,0.4)
r5<-c(0.4,0.5)
rc<-c(0.1,0.1)
rmcov<-rmstcov(t1cut=2.0,t1study=2.5,t2cut=3.0,t2study=3.5,taur=5,
rate1=r1,rate2=r2,rate3=r3,rate4=r4,rate5=r5,ratec=rc,
tchange=c(0,1),type=1)
rmcov
Run the code above in your browser using DataLab