source("C:\\Users\\ZC\\Box Sync\\Braun\\2-agent phase I design\\R code\\revision - Clinical Trials\\BCD_2d_function.R") source("C:\\Users\\ZC\\Box Sync\\Braun\\2-agent phase I design\\R code\\revision - Clinical Trials\\BCD_2d_adaptive_function.R") ## Targeted DLT rate gamma = 0.2 ## The number of dose levels of Agent A J = 4 ## The number of dose levels of Agent B K = 4 ## The total sample size N = 50 ## The sample size in Stage 1 N1 = 16 #The maximum number of allowable DLTs for combination (1,1) in Stage 1 before early termination of the trial C1 = 3 #The maximum number of allowable DLTs at each combination before elimination of that combination and higher from further study C2 = 3 #The hyperparameter for the prior distribution of the collective probabilities p2a and p2b. theta = 3 ## Combinations assigned to the first 50 patients combo = rbind(c(1,1), c(1,1), c(1,1), c(1,1), c(1,1), c(2,2), c(2,2), c(2,2), c(2,2), c(2,2), c(2,2), c(3,3), c(2,2), c(2,2), c(2,2), c(1,1), c(2,2), c(3,1), c(2,1), c(2,1), c(2,1), c(2,1), c(2,1), c(2,1), c(2,1), c(2,1), c(3,2), c(4,1), c(3,1), c(4,2), c(4,2), c(3,1), c(2,1), c(2,2), c(1,3), c(2,2), c(1,2), c(1,2), c(2,3), c(2,4), c(2,4), c(2,4), c(2,4), c(2,4), c(2,4), c(2,4), c(2,4), c(2,4), c(1,3), c(2,2)) ## Toxicity outcomes on the first 50 patients y = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0) ## Example 1: the next patient will be in Stage 1, using the BCD-2d combo = combo[1:12,] y = y[1:12] result1 = BCD.2d(J=J, K=K, N=N, N1=N1, C1=C1, C2=C2, combo=combo, y=y) # return a recommended combination for the next patient result1$combo.rec # return estimated DLT rates of all combinations result1$tox.est ## Example 2: the next patient will be the first one in Stage 2a, using the BCD-2d combo = combo[1:16,] y = y[1:16] result2 = BCD.2d(J=J, K=K, N=N, N1=N1, C1=C1, C2=C2, combo=combo, y=y) result2$combo.rec result2$tox.est ## Example 3: the next patient will be in Stage 2b, using the BCD-2d combo = combo[1:44,] y = y[1:44] result3 = BCD.2d(J=J, K=K, N=N, N1=N1, C1=C1, C2=C2, combo=combo, y=y) result3$combo.rec result3$tox.est ## Example 4: identify the MTC when all patients are enrolled and observed, using the BCD-2d combo = combo[1:N,] y = y[1:N] result4 = BCD.2d(J=J, K=K, N=N, N1=N1, C1=C1, C2=C2, combo=combo, y=y) result4$combo.rec result4$tox.est ## Example 5: the next patient will be in Stage 2, using the adaptive BCD-2d ## Combinations assigned to the first 50 patients combo = rbind(c(1,1), c(1,1), c(1,1), c(1,1), c(1,1), c(2,2), c(2,2), c(2,2), c(2,2), c(2,2), c(2,2), c(1,1), c(2,2), c(1,1), c(1,1), c(1,1), c(2,2), c(3,1), c(1,3), c(2,4), c(2,4), c(2,2), c(3,1), c(4,2), c(4,2), c(4,2), c(3,1), c(2,1), c(2,1), c(3,2), c(4,1), c(4,2), c(3,1), c(2,1), c(3,2)) ## Toxicity outcomes on the first 50 patients y = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1) combo = combo[1:22,] y = y[1:22] result5 = BCD.2da(J=J, K=K, N=N, N1=N1, C1=C1, C2=C2, theta=theta, combo=combo, y=y) result5$combo.rec result5$tox.est