simulation.pwexp.pfs: Simulate PFS data following piece-wise exponential...

Description Usage Arguments Value Examples

View source: R/simulation.pwexp.pfs.R

Description

Simulate Randomized two-arm trial data with the following characteristics: (1) randomization time (entry time) is generated according to the specified non-uniform accrual pattern, i.e. the cumulative recruitment at calendar time t is (t/A)^w with weight w and enrollment complete in A months. w = 1 means uniform enrollment, which is usually not realistic due to graduate sites activation process. (2) Survival time follows piece-wise exponential distribution for each arm. (3) N total patients with r:1 randomization ratio (4) Random drop off can be incorporated into the censoring process. (5) Data cutoff dates are determined by specified vector of target events for all analyses. (6) A dataset is generated for each analysis according to the specified number of target events. Multiple analyses can be specified according to the vector of targetEvents, eg, targetEvents = c(100, 200, 300) defines 3 analyses at 100, 200, and 300 events separately.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
simulation.pwexp.pfs(
  nSim = 100,
  N = 600,
  A = 21,
  w = 1.5,
  r = 1,
  lam0 = log(2)/12,
  lam1 = log(2)/12 * 0.65,
  cuts = NULL,
  drop0 = 0,
  drop1 = 0,
  targetEvents = c(400, 500),
  DCO = NULL,
  scanfreq0 = c(rep(6, 2), rep(9, 100)) * 7/(365.25/12),
  scanfreq1 = c(rep(6, 2), rep(9, 100)) * 7/(365.25/12)
)

Arguments

nSim

Number of trials

N

Total number patients in two arms.

A

Total accrual period in months

w

Weight parameter in cumulative enrollment pattern. The cumulative enrollment at month t is (t / A)^w, eg, at month 6, the enrollment is N*(6/24)^2 = N/16 for 24 months planned accrual period.

r

Randomization ratio r:1, where r refers to the experimental arm, eg, r=2 in 2:1 ratio

lam0

Hazard rates for control arm of intervals defined by cuts; for exponential(lam0) distribution, lam0 = log(2) / median;

lam1

Hazard rates for experimental arm for intervals; for exponential(lam1) distribution, lam1 = log(2) / median; For delayed effect under H1, lam1 is a vector (below).

cuts

Timepoints to form intervals for piecewise exponential distribution. For example, experimental arm has hr = 0.6 after delay, then cuts = 6, and lam0 = log(2) / m0 or lam0 = rep(log(2) / m0, 2), lam1 = c(log(2)/m0, log(2)/m0hr). treatment after 24 mo, so its hazard decreases 20%. Then, lam0 = c(log(2)/m0, log(2)/m0, log(2)/m00.8), lam1 = c(log(2)/m0, log(2)/m0hr, log(2)/m0hr), and cuts = c(6, 24), which forms 3 intervals (0, 6), (6, 24), (24, infinity)

drop0

Drop Off rate per month, eg, 3% every year for control arm, then drop0=0.03/12

drop1

Drop Off rate per month, eg, 1%, for experimental arm

targetEvents

A vector of target events is used to determine DCOs. For example, 397 target events are used to determine IA DCO; and 496 events are used to determine the FA cutoff.

DCO

A vector of data cut-off time in months, calculated from first subject in. Default NULL. The date cut-off times will be determined by targetEvents. If provided, then the targetEvents will be ignored.

scanfreq0

A vector of scan frequency for control arm, eg, every 6 weeks for 2 scans, then every 9 weeks thereafter. scanfreq = c(rep(6, 2), rep(9, 1000))*7. Applicable for PFS data.

scanfreq1

A vector of scan frequency for experimental arm, eg, every 6 weeks for 2 scans, then every 9 weeks thereafter. scanfreq = c(rep(6, 2), rep(9, 1000))*7. Applicable for PFS data.

Value

An object with a dataframe for each analysis including the following variables:

sim

sequence number of simulated dataset;

treatment

treatment group with values of "control" and "experimental"

enterTime

Time of randomization in calendar time

calendarTime

the time when event/censoring occurred in calendar time

survTime

Survival time for analysis, = calendarTime - enterTime

cnsr

censor status (0=event; 1=censor) before administrative censoring due to data cut

calendarCutOff

Data CutOff Time (DCO);

survTimeCut

Survival time after cut

cnsrCut

Censor status after cut

Examples

 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
#Example Simulate 1 sample from proportional hazards scenario. 
#Total 600 pts, 1:1 randomization, control median OS 12 mo; 
#HR = 0.65, enrollment 24 months, weight 1.5, no drop offs; 
#IA and FA are performed at 400 and 500 events respectively.
 
sim.ph = simulation.pwexp.pfs(nSim=1, N = 600, A = 24, w=1.5, r=1, 
lam0=log(2)/12, lam1= log(2)/12*0.65, cuts=NULL, 
drop0= 0, drop1= 0, targetEvents = c(300, 500),
, scanfreq0=c(rep(6, 2), rep(9, 100))*7/(365.25/12), 
scanfreq1=c(rep(6, 2), rep(9, 100))*7/(365.25/12))

km.IA<-survival::survfit(survival::Surv(survTimeCut,1-cnsrCut)~treatment,data=sim.ph[[1]][sim==1,])
km.FA<-survival::survfit(survival::Surv(survTimeCut,1-cnsrCut)~treatment,data=sim.ph[[2]][sim==1,])
plot(km.IA,xlab="Month Since Randomization",ylab="Survival",lty=1:2,xlim=range(km.FA$time))
plot(km.FA,xlab="Month Since Randomization",ylab="Survival",lty=1:2,xlim=range(km.FA$time))

#No consideration of scan intervals
set.seed(2022)
data0 = simulation.pwexp.pfs(nSim=1, N = 600, A = 24, w=1.5, r=1, 
lam0=log(2)/12, lam1= log(2)/12*0.65, cuts=NULL, 
drop0= 0, drop1= 0, targetEvents = c(300, 500),
scanfreq0=NULL, scanfreq1=NULL)

km.IA0<-survival::survfit(survival::Surv(survTimeCut,1-cnsrCut)~treatment,data=data0[[1]][sim==1,])
km.FA0<-survival::survfit(survival::Surv(survTimeCut,1-cnsrCut)~treatment,data=data0[[2]][sim==1,])
plot(km.IA0,xlab="Month Since Randomization",ylab="Survival",lty=1:2,xlim=range(km.FA0$time))
plot(km.FA0,xlab="Month Since Randomization",ylab="Survival",lty=1:2,xlim=range(km.FA0$time))

phe9480/rgs documentation built on March 1, 2022, 12:26 a.m.