simulation.rgs.mcr: Streamlined Trial Data Simulations and Analysis Using...

Description Usage Arguments Value Examples

View source: R/simulation.rgs.mcr.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. (7) Weighted log-rank test is then performed for each simulated group sequential dataset.

Usage

 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
28
simulation.rgs.mcr(
  nSim = 10,
  N = 600,
  A = 18,
  w = 1.5,
  r = 1,
  p = c(0.1, 0.1),
  alpha = c(log(2)/12, log(2)/12),
  beta = c(1, 1),
  gamma = c(1, 1),
  lambda = c(0, 0),
  tau = c(0, 6),
  psi = c(1, 0.6),
  drop = c(0, 0),
  targetEvents = NULL,
  DCO = NULL,
  sf = "LDOF",
  overall.alpha = 0.025,
  type1err = NULL,
  logrank = "N",
  fws.options = NULL,
  H0 = "N",
  Cox = "N",
  Median = "N",
  scanfreq0 = NULL,
  scanfreq1 = NULL,
  seed = 2022
)

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

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.

overall.alpha

One-sided overall type I error, default 0.025.

type1err

Incremental type I error. sum(type1err) = overall.alpha. When targetEvents is NULL, type1err is required.

logrank

Indicator whether log-rank test is requested besides the weighted logrank tests. "Y" or "N". Default "Y". If "Y", the traditional log-rank test will be used based on survdiff() function. If "N", the weighted log-rank test with weighting function specified in fws will be used.

H0

"Y" or "N" to indicate whether the simulation is for type I error

Cox

"Y" or "N" to indicate whether Cox regression model is required to produce HR estimate

Median

"Y" or "N" to indicate whether median is requested to estimate.

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.

lambda0

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

lambda1

Hazard rates for experimental arm for intervals; for exponential(lambda1) distribution, lambda1 = log(2) / median; For delayed effect under H1, lambda1 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 lamda0 = log(2) / m0 or lambda0 = rep(log(2) / m0, 2), lamda1 = c(log(2)/m0, log(2)/m0hr). treatment after 24 mo, so its hazard decreases 20%. Then, lambda0 = c(log(2)/m0, log(2)/m0, log(2)/m00.8), lambda1 = 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)

dropOff0

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

dropOff1

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

Value

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

power

Power for each analysis

overall.power

Overall power of the group sequential design

wlr.simulations

Simulation results for each simulated study data. An array with dimensions: nSim simulations X M testing strategies (fws.options) X K analyses X 5 variables:

  • z value

  • p value

  • analysis

  • rejection boundary

  • testing result (1 = positive; 0 = negative)

lr.power

Power for each analysis using log-rank test. Available if logrank ="Y"

lr.overall.power

Overall power of the group sequential design using logrank test

lr.simulations

Simulation results for each simulated study data using logrank test. nSim simulations X K analyses X 5 variables as above

CutOff

A matrix with dimension (nSim, K). Date cutoff date for each analysis in each simulated trial.

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
28
29
30
31
32
33
34
35
36
lr = function(s){1}
fh01 = function(s){1-s}
fh11 = function(s){s*(1-s)}
sfh01 = function(s){s1 = apply(cbind(s, 0.5), MARGIN=1,FUN=max); return(1-s1)}

#Example (1): Simulate 10 samples from proportional hazards scenario. 
fws1 = list(IA1 = list(lr), FA = list(lr))
fws2 = list(IA1 = list(lr), FA = list(fh11))
fws3 = list(IA1 = list(lr), FA = list(lr, fh11))


#7 weighting strategies for exploration 
fws = list(fws1, fws2, fws3)

set.seed(2022)

#Simulations for exploring 3 weighting strategies
#medians 12.8 vs 17.9
m0 = qmcr(0.5, p = 0.12, alpha = log(2)/10, beta=1, gamma=1, lambda=0, tau=0, psi=1)

m1 = qmcr(0.5, p = 0.12, alpha = log(2)/10, beta=1, gamma=1, lambda=0, tau=6, psi=0.6)

sim = simulation.rgs.mcr(nSim=10, N = 600, A = 18, w=1.5, r=1, p=c(0.12, 0.12),
alpha = c(log(2)/10,log(2)/10), beta=c(1,1), gamma=c(1,1), 
lambda=c(0,0), tau=c(0,6), psi=c(1,0.6), drop=c(0,0),
targetEvents = c(300, 420), DCO = NULL,
sf = "LDOF", overall.alpha = 0.025, type1err = NULL,
logrank="N", fws.options=fws, H0 = "N")

sim = simulation.rgs.mcr(nSim=1, N = 500, A = 18, w=1.5, r=1, p=c(0.12, 0.12),
alpha = c(log(2)/10,log(2)/10), beta=c(1,1), gamma=c(1,1), 
lambda=c(0,0), tau=c(0,6), psi=c(1,0.6), drop=c(0,0),
targetEvents = c(300, 420), DCO = NULL,
sf = "LDOF", overall.alpha = 0.025, type1err = NULL,
Cox = "Y", scanfreq0=NULL, scanfreq1=NULL,
logrank="N", fws.options=fws, H0 = "N")

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