pwepower: Calculating the powers of various the test statistics for...

View source: R/pwepower.R

pwepowerR Documentation

Calculating the powers of various the test statistics for superiority trials

Description

This will calculate the powers for the test statistics accouting for staggered entry, delayed treatment effect, treatment crossover and loss to follow-up.

Usage

pwepower(t=seq(0.1,3,by=0.5),alpha=0.05,twosided=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-4,iterbeta=25,
             n=1000)

Arguments

t

a vector of time points at which power is calculated, t must be positive

alpha

type-1 error rate

twosided

twosided test or not

taur

Recruitment time

u

Piecewise constant recuitment rate

ut

Recruitment intervals

pi1

Allocation probability for the treatment group

rate11

Hazard before crossover for the treatment group

rate21

Hazard after crossover for the treatment group

rate31

Hazard for time to crossover for the treatment group

rate41

Hazard after crossover for the treatment group for complex case

rate51

Hazard after crossover for the treatment group for complex case

ratec1

Hazard for time to censoring for the treatment group

rate10

Hazard before crossover for the control group

rate20

Hazard after crossover for the control group

rate30

Hazard for time to crossover for the control group

rate40

Hazard after crossover for the control group for complex case

rate50

Hazard after crossover for the control group for complex case

ratec0

Hazard for time to censoring for the control group

tchange

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.

type1

Type of crossover in the treatment group

type0

Type of crossover in the control group

rp21

re-randomization prob for the treatment group

rp20

re-randomization prob for the control group

eps

error tolerence

veps

error tolenrence for calculating variance

epsbeta

error tolerance for calculating overall log HR

iterbeta

maximum number of iterations for calculating overall log HR

n

total number of subjects

Details

The hazard functions corresponding to rate11,...,rate51,ratec1, rate10,...,rate50,ratec0 are all piecewise constant function taking the form \lambda(t)=\sum_{j=1}^m \lambda_j I(t_{j-1}\le t<t_j), where \lambda_1,\ldots,\lambda_m are the corresponding elements of the rates and t_0,\ldots,t_{m-1} are the corresponding elements of tchange, t_m=\infty. Note that all the rates must have the same tchange.

Value

power

powers for various test statistics. Columns 2-6 are for log-rank and columns 12-16 are for cox model. Column 2 is the exact power based on log-rank/score test; column 3 uses variance approximated by Fisher information, i.e. Lakatos's method; column 4 uses approximated Fisher info by number of events i.e. 4/D(t); column 5 uses approximated Fisher info by assuming exp dist. 1/D1(t)+1/D0(t); column 6 uses Fisher information at beta. Column 12 is the exact power based on Wald test; column 13 uses variance approximated by Fisher information; column 14 uses approximated Fisher info by number of events i.e. 4/D(t); column 15 uses approximated Fisher info by assuming exp dist. 1/D1(t)+1/D0(t); column 16 uses Fisher information at beta=0.

Note

Version 1.0 (7/19/2016)

Author(s)

Xiaodong Luo

References

Luo, et al. (2017)

See Also

pwe,rpwe,qpwe,ovbeta,innervar, pwepowerni,pwepowereq

Examples

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[,c(2:4,12:14)])

PWEALL documentation built on Aug. 9, 2023, 9:08 a.m.

Related to pwepower in PWEALL...