This will calculate the timepoint where a certain power of the specified test statistics is obtained accouting for staggered entry, delayed treatment effect, treatment crossover and loss to follow-up.
pwepowerfindt(power=0.9,alpha=0.05,twosided=1,tupp=5,tlow=1,taur=1.2,
u=c(1/taur,1/taur),ut=c(taur/2,taur),pi1=0.5,
rate11=c(1,0.5),rate21=rate11,rate31=c(0.7,0.4),
rate41=rate21,rate51=rate21,ratec1=c(0.5,0.6),
rate10=rate11,rate20=rate10,rate30=rate31,
rate40=rate20,rate50=rate20,ratec0=c(0.6,0.5),
tchange=c(0,1),type1=1,type0=1,
rp21=0.5,rp20=0.5,eps=1.0e-2,veps=1.0e-2,
epsbeta=1.0e-04,iterbeta=25,
n=1000,testtype=1,maxiter=20,itereps=0.001)
type of statistic, =1 log-rank;=2 Cox model; =3 log-rank with robust variance
time calculated when the iterations stop
the power at time
distance from the desired power
number of bi-section iterations performed
the desired power
type-1 error
twoside test or not
an upper time point where the power should be larger than power
a lower time point where the power should be smaller than power
recruitment time
Piecewise constant recuitment rate
Recruitment intervals
Allocation probability for the treatment group
Hazard before crossover for the treatment group
Hazard after crossover for the treatment group
Hazard for time to crossover for the treatment group
Hazard after crossover for the treatment group for complex case
Hazard after crossover for the treatment group for complex case
Hazard for time to censoring for the treatment group
Hazard before crossover for the control group
Hazard after crossover for the control group
Hazard for time to crossover for the control group
Hazard after crossover for the control group for complex case
Hazard after crossover for the control group for complex case
Hazard for time to censoring for the control group
A strictly increasing sequence of time points at which the event rates changes. The first element of tchange must be zero. It must have the same length as rate11
, rate21
, rate31
, etc.
Type of crossover in the treatment group
Type of crossover in the control group
re-randomization prob in the treatment group
re-randomization prob in the control group
error tolerence
error tolenrence for calculating variance
error tolerance for calculating overall log HR
maximum number of iterations for calculating overall log HR
total number of subjects
test statistics, =1 log-rank;=2 Cox model; =3 log-rank with robust variance
maximum number of bi-section iterations
error tolerance of power
Xiaodong Luo
The hazard functions corresponding to rate11
,...,rate51
,ratec1
, rate10
,...,rate50
,ratec0
are all piecewise constant function taking the form tchange
.
Luo, et al. (2017)
pwe
,rpwe
,qpwe
,ovbeta
,innervar
t<-seq(3,6,by=1)
taur<-1.2
u<-c(1/taur,1/taur)
ut<-c(taur/2,taur)
r11<-c(0.2,0.1)
r21<-r11
r31<-c(0.03,0.02)
r41<-r51<-r21
rc1<-c(0.01,0.02)
r10<-c(0.2,0.2)
r20<-r10
r30<-c(0.02,0.01)
r40<-r50<-r20
rc0<-c(0.02,0.01)
getpower<-pwepower(t=t,alpha=0.05,twosided=1,taur=taur,u=u,ut=ut,pi1=0.5,
rate11=r11,rate21=r21,rate31=r31,rate41=r41,rate51=r51,ratec1=rc1,
rate10=r10,rate20=r20,rate30=r30,rate40=r40,rate50=r50,ratec0=rc0,
tchange=c(0,1),type1=1,type0=1,n=1000)
###powers at each time point
cbind(t,getpower$power[,1:3])
###90% power should be in (3,3.5)
getpwtime<-pwepowerfindt(power=0.9,alpha=0.05,twosided=1,tupp=3.5,tlow=3,taur=taur,
u=u,ut=ut,pi1=0.5,rate11=r11,rate21=r21,rate31=r31,rate41=r41,rate51=r51,ratec1=rc1,
rate10=r10,rate20=r20,rate30=r30,rate40=r40,rate50=r50,ratec0=rc0,
tchange=c(0,1),type1=1,type0=1,n=1000,testtype=1,maxiter=30)
getpwtime
Run the code above in your browser using DataLab