simWRSEdata {DTR}R Documentation

Function to simulate data from sequentially randomized clinical trials (Guo and Tsiatis 2005)


This function generates a data set from sequentially randomized clinical trials as described in the simulation study of Guo and Tsiatis (2005). Because different assignments at the first stage are independent to each other, the function only generates data for one of the assignments at the first stage. For example, if there are two first-stage therapies A1 and A2 available, the function only simulates the data for one of the two arms (e.g. A1).


simWRSEdata(n, max.c, pi.r, pi.z, mean.T0, 
mean.TR, mean.T1, mean.T2)



number of subjects assigned to A1


censoring time C is generated from uniform(0, max.c)


the probability of response. Response status R is generated from Bernoulli(pi.r)


the probability of being assigned to B2 among responders. The second-stage treatment indicator Z is generated from Bernoulli(pi.z) among responders (R=1). Z=0 if assigned to B1 at the second stage, and Z=1 if assigned to B2 at the second stage. For non-responders (R=0), Z=0


for nonresponders (R=0), a survival time T0 is drawn from exponential(1/mean.T0) with mean equal to mean.T0


for responders (R=1), a response time TR is drawn from exponential(1/mean.TR) with mean equal to mean.TR


the survival time from the response/consent to event time if assigned to B1, T1* is generated from exponential(1/mean.T1) with mean equal to mean.T1


the survival time from the response/consent to event time if assigned to B2, T2* is generated from exponential(1/mean.T2) with mean equal to mean.T2


In sequentially randomized designs, there could be more than two therapies available at each stage. For simplicity, and to maintain similarity to the most common sequentially randomized clinical trials, a simple two-stage randomization design allowing two treatment options at each stage is used in the current version of the package. In detail, patients are initially randomized to either A1 or A2 at the first stage. Based on their response status, they are then randomized to either B1 or B2 at the second stage. Therefore, there are a total of four dynamic treatment regimes (DTRs): A1B1, A1B2, A2B1, and A2B2.


The function returns a data set with columns: TR, R, Z, U, and delta.


a time to response for responders (R=1)


response status, R=1 for responders, and R=0 for non-responders


second-stage indicator, Z=0 if assigned to B1, and Z=1 if assigned to B2


observed survival time, U is event time if delta=1, and U is censoring time if delta=0


censoring indicator, delta=1 for event, and delta=0 for censored


Set a seed right before simWRSEdata will help reproduce the same data.


Guo X, Tsiatis AA: A weighted risk set estimator for survival distributions in two-stage randomization designs with censored survival data. Int. J. Biostatistics 1:1-15, 2005

See Also



#-------Example function usage-----------
n <- 100
max.c <- 3.5*365 
pi.r <- 0.5 
pi.z <- 0.5 
mean.T0 <- 182.5 
mean.TR <- 365 
mean.T1 <- 365 
mean.T2 <- 547.5

# Generate full data from SRD
data.A1 <- simWRSEdata(n,max.c,pi.r,pi.z,
data.A2 <- simWRSEdata(n,max.c,pi.r,pi.z,
WRSEdata <- cbind(X=c(rep(0,n), rep(1,n)), 
rbind(data.A1, data.A2)) # X=0 for A1; X=1 for A2

[Package DTR version 1.7 Index]