# pwecxpwuforvar: calculate the utility function used for varaince calculation In PWEALL: Design and Monitoring of Survival Trials Accounting for Complex Situations

## Description

This is a utility function to calculate the overall variance accouting for staggered entry, delayed treatment effect, treatment crossover and loss to follow-up.

## Usage

 1 2 3 pwecxpwuforvar(tfix=10,t=seq(0,10,by=0.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) 

## Arguments

 tfix The upper point where the integral is computed. t A vector of lower bounds where the integral is computed. taur Recruitment time u Piecewise constant recuitment rate ut Recruitment intervals rate1 Hazard before crossover rate2 Hazard after crossover rate3 Hazard for time to crossover rate4 Hazard after crossover for complex case rate5 Hazard after crossover for complex case ratec Hazard for time to censoring 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 rate1, rate2, rate3, etc. type Type of crossover rp2 re-randomization prob eps A small number representing the error tolerance when calculating the utility function Φ_l(x)=\frac{\int_0^x s^l e^{-s}ds}{x^{l+1}} with l=0,1,2.

## Details

This is to calculate the function

B_l(t,s)=\int_0^s x^l G_E(t-x)\widetilde{f}(x)S_C(x)dx,

where G_E is the accrual function defined by taur, u and ut, S_C is the piecewise exponential survival function of the censoring time, defined by tchange and ratec, and \widetilde{f} is the density for the event distribution subject to crossover defined by tchange, rate1 to rate5 and type. This function is useful when calculating the overall varaince and covariance.

## Value

 f0 the integral when l=0 f1 the integral when l=1

## Note

Version 1.0 (7/19/2016)

Xiaodong Luo

## References

Luo, et al. (2017)

## See Also

pwe,rpwe,qpwe,ovbeta,innervar

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 taur<-1.2 u<-c(1/taur,1/taur) ut<-c(taur/2,taur) r11<-c(1,0.5) r21<-c(0.5,0.8) r31<-c(0.7,0.4) r41<-r51<-r21 rc1<-c(0.5,0.6) getf<-pwecxpwuforvar(tfix=3,t=seq(0,3,by=1),taur=taur,u=u,ut=ut, rate1=r11,rate2=r21,rate3=r31,rate4=r41,rate5=r51,ratec=rc1, tchange=c(0,1),type=1,eps=1.0e-2) getf 

PWEALL documentation built on May 2, 2019, 4:16 a.m.