forked from helenyb/DF_Late_Activity_Safety
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eff_patterns.R
148 lines (102 loc) · 5.97 KB
/
eff_patterns.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
##combo trials
##comparison simulations
source("CRM_2_combo_v11.R")
source("compare_Yuan_v4.R")
source("LiuJohnson_compare_v2.R")
library(rjags)
library(doParallel)
library(mvtnorm)
registerDoParallel(cores=64)
##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 c(1:3)){
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
scen_list<-list(c(1,1),c(4,2),c(2,4),c(3,5))
for(eff.pattern in 2:3){
for(sceni in 1:length(secn_list)){
eff<-secn_list[[sceni]][1]
tox<-secn_list[[sceni]][2]
assign(paste(c("comparison_combo2v4_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=T,sufficient.information.lim=stop.num,hard.safety.rule=95,safety.stopping.low.unsafe=T,
safety.stopping.high.toosafe=T,kfold.skipping=T,kfold=2,precision.stopping="SAFETY_AND_EFFICACY",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_effpats.RData"),collapse=""))
assign(paste(c("comparison_comboLJv4_cyc3_eff",eff,".",eff.pattern,"_tox",tox),collapse=""),
foreach(i=1:nsims, combine = list) %dopar% {
##function
LiuJohnson_v2(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,
pa_T=c(0.05,0.1,0.2,0.25,0.3,0.35),pb_T=c(0.95,0.9,0.8,0.75,0.7,0.65),
pa_E=c(0.2,0.3,0.4,0.45,0.5,0.6),pb_E=c(0.8,0.7,0.6,0.55,0.5,0.4),ncycles=3,dose.skipping=T,
sufficient.information=T,sufficient.information.lim=stop.num,hard.safety.rule=95,safety.stopping.low.unsafe=T,
safety.stopping.high.toosafe=T,kfold.skipping=T,kfold=2,precision.stopping="SAFETY_AND_EFFICACY",precision.stopping.level=stop.num,initial.one.cycle=T,
w1=0.33, w2=1.09, upper.tox=0.392,C_eff=0.2,C_tox=0.2,effbound=0.2,toxbound=0.391,
backfill=F,backfill.num=2)
}
)
save.image(paste(c("Comparison_combo_cycles_TTE_v4_effpats.RData"),collapse=""))
assign(paste(c("comparison_combo2_cyc3YYv4_eff",eff,".",eff.pattern,"_tox",tox),collapse=""),
foreach(i=1:nsims, combine = list) %dopar% {
##function
Yuan2008_comp_v4(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,ncycles=3,dose.skipping=T,
sufficient.information=T,sufficient.information.lim=29,hard.safety.rule=95,
safety.stopping.low.unsafe=T,
safety.stopping.high.toosafe=T,kfold.skipping=T,kfold=2,
precision.stopping=T,precision.stopping.level=29,initial.one.cycle=T,
C_eff=0.2,C_tox=0.2,effbound=0.2,toxbound=0.392,p_cross=0.8,
backfill=F,backfill.num=2)
}
)
save.image(paste(c("Comparison_combo_cycles_TTE_v4_effpats.RData"),collapse=""))
}
}