forked from helenyb/DF_Late_Activity_Safety
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TTE_simsv4_noSTOP.R
94 lines (69 loc) · 3.04 KB
/
TTE_simsv4_noSTOP.R
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
##combo trials
##comparison simulations
source("CRM_2_combo_v11.R")
library(rjags)
library(doParallel)
library(mvtnorm)
registerDoParallel(cores=22)
##parameters for the scenarios
eff_scen1<-c(0.2,0.3,0.4,0.5,0.6,0.7)
eff_scen2<-c(0.3,0.4,0.5,0.5,0.5,0.5)
eff_scen3<-c(0.10,0.12,0.14,0.16,0.18,0.20)
eff_scen4<-c(0.10,0.15,0.20,0.30,0.50,0.70)
tox_scen1<-c(0.1,0.2,0.3,0.4,0.5,0.6)
tox_scen2<-c(0.1,0.13,0.16,0.2,0.25,0.4)
tox_scen3<-c(0.4,0.45,0.5,0.55,0.6,0.65)
tox_scen4<-c(0.3,0.4,0.45,0.5,0.55,0.6)
tox_scen5<-c(0.10,0.12,0.14,0.16,0.18,0.20)
eff.pattern1<-rep(1,3)/3
# eff.pattern2<-c(1:3)/6
# eff.pattern3<-c(3:1)/6
ndoses<-6
ncycles<-3
for(pattern in 1){
for(eff_scen in 1:4){
parMat<-matrix(nrow=2,ncol=ndoses)
cycleMat<- cyc_func_eff(cyc1_vec = get(paste(c("eff_scen",eff_scen),collapse="")),
split_vec = get(paste(c("eff.pattern",pattern),collapse="")))
for(j in 1:ncol(cycleMat)){
parMat[,j]<- find_lognormal_parms3(p1=cycleMat[1,j],p3=sum(cycleMat[,j]),int2=seq(0.01,10,0.01))
}
assign(paste(c("eff_scen",eff_scen,".",pattern,"pars"),collapse=""),
parMat)
}
}
for(tox in 1:5){
parMat<-matrix(nrow=2,ncol=ndoses)
cycleMat<-cyc_func_tox(cyc1_vec=get(paste(c("tox_scen",tox),collapse="")),cyc_dec = 1/3,ncycles=ncycles)
for(j in 1:ncol(cycleMat)){
parMat[,j]<- find_lognormal_parms3(p1=cycleMat[1,j],p3=sum(cycleMat[,j]),int2=seq(0.01,10,0.01))
}
assign(paste(c("tox_scen",tox,".pars"),collapse=""),
parMat)
}
nsims<-1000
doses<-c(1.5,2.5,3.5,4.5,6.0,7.0)
#MTD.options<-c("MODEL_ONLY","CHOICE_ESCALTION")
stop.num<-29
BmeamT<-log(1/4)
BprecT<-0.5
for(eff.pattern in 1){
for(eff in 1:4){
for(tox in 1:5){
assign(paste(c("comparison_combo2v4noSTOP_cyc3_eff",eff,".",eff.pattern,"_tox",tox),collapse=""),
foreach(i=1:nsims, combine = list) %dopar% {
##function
CRM_2_combo_v11(seed=i,tru.E.pars = get(paste(c("eff_scen",eff,".",pattern,"pars"),collapse="")),
tru.T.pars=get(paste(c("tox_scen",tox,".pars"),collapse="")),
tru.corET=-0.5,co_size=3,ncohorts=20 ,target=0.391,targetE=0.3,doses=doses,p_a_meanT=log(1/16),p_b_meanT=BmeamT,
p_a_precT=1,p_b_precT=BprecT,ncycles=3,dose.skipping=T,
sufficient.information=F,sufficient.information.lim=stop.num,hard.safety.rule=95,safety.stopping.low.unsafe=F,
safety.stopping.high.toosafe=F,kfold.skipping=T,kfold=2,precision.stopping=F,precision.stopping.level=stop.num,initial.one.cycle=T,
p_a_meanE=-3,p_b_meanE=-0.2,effbound=0.2,
p_a_precE=1,p_b_precE=1,p_phi_mean=0,p_phi_prec=0.01, w1=0.33, w2=1.09, upper.tox=0.392)
}
)
save.image(paste(c("Comparison_combo_cycles_TTE_v4_noSTOP.RData"),collapse=""))
}
}
}