# \donttest{
#### Generate with copula: This example is for three endpoints, noted as Y_1, Y_2, and Y_3,
#### with endpoint type as TTE, TTE and continuous.
#### For both the treatment group and the control group, the correlation coefficients
#### cor(Y_1,Y_2), cor(Y_1,Y_3) and cor(Y_2,Y_3) are 0.9, 0.8 and 0.95, respectively.
#### For each treatment group, the marginal distribution for Y_1, Y_2, and Y_3 are Gamma,
#### Beta and Student t specified as a vector in "margins_trt"/"margins_con". The parameters
#### are specified as a list corresponding to the margianl distributions in "paramMargins_trt"
#### or "paramMargins_con".
sim.data <- sim.data(n_trt = 150, n_con = 100, n_ep = 3, arm.name = c("A","B"),
ep_type = c("tte","tte","continuous"), cdist.rate = 0.5, sim_method = "copula",
copula_trt=copula::normalCopula(param=c(0.9,0.8,0.95), dim = 3, dispstr = "un"),
margins_trt=c("gamma", "beta", "t"),
paramMargins_trt=list(list(shape=2, scale=1),list(shape1=2, shape2=2),list(df=5)),
copula_con=copula::normalCopula(param=c(0.9,0.8,0.95), dim = 3, dispstr = "un"),
margins_con=c("gamma", "beta", "t"),
paramMargins_con=list(list(shape=1, scale=1),list(shape1=1, shape2=2),list(df=2)),
max_accrual_time = 5)
win_stat <- win.stat(data = sim.data, ep_type = c("tte","tte","continuous"),
arm.name = c("A","B"), priority = c(1,2,3))
#### Generate two TTE endpoints with the more important TTE endpoint expected to occur later
#### with exponential distribution.
sim.data2 <- sim.data(n_trt = 150, n_con = 100, n_ep = 2, arm.name = c("A","B"),
ep_type = c("tte","tte"), cdist.rate = 0.5, sim_method = "tte_exponential",
rate_trt = c(0.2,0.25),rate_con = c(0.4,0.5), max_accrual_time = 5)
win_stat2 <- win.stat(data = sim.data2, ep_type = c("tte","tte"), arm.name = c("A","B"),
priority = c(1,2))
# }
Run the code above in your browser using DataLab