Response-Adaptive Randomization (RAR) design utilizes accrual information to tilt the randomization ratio to the better performing treatment group. Patients enrolled in these trials are not only treated to obtain effectiveness of a treatment but also treated to the best way possible. Altering the randomization ratio drastically can potentially affect the bias in a trial especially if one treatment is very superior to the other treatment. The major drawback to response-adaptive randomization design is that the trial needs to be short to be able to obtain the outcome of the trial for future randomization. There are various methods developed to address some of this flaws besides developing a proper design for response-adaptive randomization.
Time drift can lead to bias by confounding the treatment effect with time effects. Time trends are nearly universally ignored among RAR proponents. Besides skewed randomization ratio, time trend can be a confounding factor as illustrated in the example below.
Example of time trend issue in response-adaptive randomization (RAR) design:
Therefore, we designed a stratified group-sequential method on altering the randomization ratio in a block/group level to address this issue instead of altering the randomization ratio by patient basis. In each block/group, the randomization ratio is kept constant. However, the ideal number of block/group is still vague.
blockRAR
is an R package for the simulation of response-adaptive randomization trials with binomial outcomes where patients are assigned in block and randomization ratio is altered by block rather than patient by patient basis using both frequentist and Bayesian method. For more details on the method, please look at our preprint.
If you use blockRAR
in published research, please cite our preprint:
Robust Response-Adaptive Randomization Design. Chandereng, T., & Chappell, R. (2019). arXiv preprint arXiv:1904.07758.
If after reading through this vignette you have questions or problems using blockRAR
, please post them to https://github.com/thevaachandereng/blockRAR/issues. This will notify the package maintainers and we can work to address the issue(s). Please note that comments and questions should not be emailed directly to the package authors.
Prior to analyzing your data, the R package needs to be installed. The easiest way to install blockRAR
is through CRAN:
install.packages("blockRAR")
There are additional ways to download blockRAR
. The first option is most useful for downloading a specific version of blockRAR
(which can be found at https://github.com/thevaachandereng/bayesCT/releases):
devtools::install_github("thevaachandereng/blockRAR@vx.xx.x")
# or
devtools::install_version("blockRAR", version = "x.x.x", repos = "http://cran.us.r-project.org")
The second option is to download the most recent stable version through GitHub:
devtools::install_github("thevaachandereng/blockRAR")
After successful installation, the package must be loaded into the working space:
library(blockRAR)
In this section, we will describe each input for the frequentist and Bayesian approach of block design for RAR.
p_control: The object p_control has to be \(0 <\) p_control \(< 1\). This determines the proportion of events in the control group.
p_treatment: The object p_treatment has to be \(0 <\) p_treatment \(< 1\). This determines the proportion of events in the treatment group.
N_total: The object N_total determines the targeted sample size of subjects enrolled in the trial. When early stopping criteria is specified, the total sample size enrolled in the trial might be smaller than the one used.
block_number: The object block_number determines the number of blocks/groups used in the design of the trial. The value of block_number needs to smaller or equal to the size of N_total. For traditional RAR, set block_number equal to N_total. For traditional RCT, select block_number to 1. The early stopping criteria is applied after completing enrollment and data collection in each block. The randomization ratio is also altered at the block level. The default block_number is set to 4.
drift: The object drift controls the size of the patient-drift as described in the preprint.The drift changes the magnitude of proportion of events in either positive/negative direction. The drift is applied at the block level where p_control and p_treatment both increasing in a step-wise manner at each block level from their initial values to final value of the drift. Please make sure that the drift is within the limit specified, 0 < p_treatment + drift < 1 and 0 < p_control + drift < 1.
simulation: The object simulation sets the number of trials to be run.
conf_int: The object conf_int determines the confidence interval of the trial. This value is same as 1- \(\alpha\) in the clinical setting.
alternative: The object alternative only takes two value “greater” (default) or “less”. If alternative is greater then the the trial is successful p_treatment > p_control and vice versa.
correct: The object correct is a logical indicator. If correct is set to FALSE (default), the Yates-continuity correction is not applied and vice-versa.
replace: The object replace is a logical indicator. If replace is set to TRUE (default), the sampling is done with replacement. If replace is set to FALSE, the replacement is done without replacement.
early_stop: The object early_stop is a logical indicator. The default is set to FALSE, which does not allow early stopping. If early stopping is applied, the early stopping is done at block level using the Lan-DeMets alpha-spending function.
p_control: The object p_control has to be \(0 <\) p_control \(< 1\). This determines the proportion of events in the control group.
p_treatment: The object p_treatment has to be \(0 <\) p_treatment \(< 1\). This determines the proportion of events in the treatment group.
N_total: The object N_total determines the targeted sample size of subjects enrolled in the trial. When early stopping criteria is specified, the total sample size enrolled in the trial might be smaller than the one used.
block_number: The object block_number determines the number of blocks/groups used in the design of the trial. The value of block_number needs to smaller or equal to the size of N_total. For traditional RAR, set block_number equal to N_total. For traditional RCT, select block_number to 1. The early stopping criteria is applied after completing enrollment and data collection in each block. The randomization ratio is also altered at the block level. The default block_number is set to 4.
drift: The object drift controls the size of the patient-drift as described in the preprint.The drift changes the magnitude of proportion of events in either positive/negative direction. The drift is applied at the block level where p_control and p_treatment both increasing in a step-wise manner at each block level from their initial values to final value of the drift. Please make sure that the drift is within the limit specified, 0 < p_treatment + drift < 1 and 0 < p_control + drift < 1.
simulation: The object simulation sets the number of trials to be run.
a0: The object a0 set the parameter value of a in the non-informative prior in Beta(a, b).
b0: The object b0 set the parameter value of b in the non-informative prior in Beta(a, b).
p: The object p sets the power in the allocation probability. The probability of randomizing subjects to treatment A in stratum j is defined as \[\pi_{j, A} = \frac{(p_{A>B} (data))^ {p}}{(p_{A>B} (data))^ {p} + (p_{B>A} (data))^ {p}},\] where \(p_{A > B}(data)\) is the posterior probability that treatment A has a higher success rate than treatment B and \(p_{A>B} (data)) = 1 - p_{B>A} (data))\).
number_mcmc: The object number_mcmc determines the number of posterior sample draw randomly using Monte-Carlo method. The default is set to 10,000.
prob_accept_ha: The object prob_accept_ha controls the posterior probability of accepting the alternative hypothesis. The default is set to 0.95.
early_success_prob: The object early_success_prob sets the probability of stopping early for success. The default is set to 0.99. Change this value to 1 if you do not want to stop early for success.
futility_prob: The object futility_prob sets the probability of stopping early for futility. The default is set to 0.01. Change this value to 0 if you do not want to stop early for futility.
alternative: The object alternative only takes two value “greater” (default) or “less”. If alternative is greater then the the trial is successful p_treatment > p_control and vice versa.
blockRAR computes power (true-positive) and return several outputs: power (proportion of true-positive), mean estimated proportion of events in the control and treatment group, stratified proportion difference in treatment, sample size enrolled, sample size in each treatment group.
Computing power, stratified difference in treatment proportion using the binomialfreq function.
An example function execution with proportion of events in control is 0.25, proportion of events in treatment is 0.45, targeted sample size of 200, 5 number of blocks where randomization ratio is altered, no drift is applied, \(\alpha\) of 0.05, alternative of “greater”, sampling with replacement and early stopping not applied.
#> $power
#> [1] 0.9
#>
#> $p_control_estimate
#> [1] 0.2446809 0.2197802 0.2696629 0.2783505 0.3020833 0.1470588 0.2365591
#> [8] 0.2840909 0.1666667 0.2365591 0.2151899 0.2285714 0.1791045 0.1704545
#> [15] 0.1538462 0.2352941 0.2588235 0.2054795 0.2947368 0.1720430 0.2083333
#> [22] 0.2527473 0.2828283 0.1747573 0.2976190 0.1621622 0.2727273 0.2500000
#> [29] 0.2700000 0.2429907 0.2739726 0.2613636 0.2696629 0.2705882 0.2289157
#> [36] 0.2658228 0.2921348 0.2736842 0.1139241 0.2307692 0.2929293 0.2916667
#> [43] 0.2790698 0.2531646 0.2682927 0.1758242 0.1538462 0.3118280 0.2784810
#> [50] 0.2317073 0.2211538 0.2870370 0.2352941 0.2658228 0.2268041 0.2134831
#> [57] 0.2500000 0.2784810 0.2857143 0.2539683 0.2000000 0.2555556 0.2471910
#> [64] 0.2891566 0.2187500 0.2500000 0.3333333 0.2631579 0.2558140 0.2413793
#> [71] 0.1830986 0.2315789 0.2222222 0.2906977 0.2625000 0.2626263 0.2474227
#> [78] 0.2705882 0.2207792 0.2727273 0.2054795 0.2111111 0.3048780 0.2812500
#> [85] 0.2761905 0.2400000 0.2596154 0.2465753 0.3113208 0.3176471 0.2804878
#> [92] 0.1827957 0.2500000 0.2134831 0.2359551 0.3444444 0.2739726 0.1527778
#> [99] 0.2650602 0.2916667
#>
#> $p_treatment_estimate
#> [1] 0.4716981 0.4220183 0.4684685 0.4854369 0.5192308 0.4848485 0.3925234
#> [8] 0.4017857 0.4344262 0.5046729 0.5371901 0.5153846 0.3834586 0.4375000
#> [15] 0.4666667 0.4173913 0.4173913 0.4409449 0.5904762 0.3831776 0.3653846
#> [22] 0.4128440 0.4059406 0.4329897 0.4396552 0.4126984 0.5089286 0.4038462
#> [29] 0.4700000 0.5161290 0.5196850 0.4017857 0.4864865 0.4782609 0.4786325
#> [36] 0.4710744 0.3963964 0.4761905 0.4710744 0.5000000 0.4158416 0.4807692
#> [43] 0.4912281 0.4049587 0.4830508 0.4862385 0.4344262 0.4485981 0.4710744
#> [50] 0.3728814 0.4062500 0.3586957 0.5043478 0.4049587 0.4466019 0.4594595
#> [57] 0.3888889 0.5041322 0.4019608 0.4744526 0.4250000 0.5545455 0.4324324
#> [64] 0.5128205 0.3557692 0.4913793 0.4158416 0.4666667 0.4210526 0.4601770
#> [71] 0.4496124 0.5333333 0.4201681 0.4561404 0.5166667 0.4653465 0.4757282
#> [78] 0.5043478 0.4308943 0.5040650 0.4724409 0.4000000 0.3983051 0.3750000
#> [85] 0.4736842 0.5200000 0.3645833 0.4488189 0.4042553 0.4869565 0.4152542
#> [92] 0.4299065 0.4351852 0.4594595 0.4594595 0.3909091 0.4330709 0.4453125
#> [99] 0.4615385 0.4326923
#>
#> $prop_diff_estimate
#> [1] 0.21878279 0.20671835 0.18832194 0.20629921 0.22759674 0.31322506
#> [7] 0.14588592 0.11562179 0.25605727 0.25298082 0.33083110 0.27142857
#> [13] 0.19156415 0.26736842 0.31116252 0.17677553 0.16330749 0.23399433
#> [19] 0.30341207 0.22448980 0.14771574 0.16059518 0.10512688 0.26288923
#> [25] 0.13592751 0.26152074 0.23435897 0.15532995 0.18331617 0.25871942
#> [31] 0.25598219 0.13949843 0.22299839 0.19451630 0.21628768 0.20751720
#> [37] 0.09868766 0.21828454 0.36729223 0.30939227 0.12456052 0.17638037
#> [43] 0.19065521 0.15311005 0.21204188 0.28137092 0.30056497 0.12480418
#> [49] 0.21105795 0.13597884 0.19050051 0.05968586 0.26420010 0.14203051
#> [55] 0.21759500 0.22347873 0.10874089 0.23545405 0.12010309 0.22537764
#> [61] 0.22842105 0.30804954 0.19813761 0.23026674 0.15092402 0.25313808
#> [67] 0.05841742 0.20652728 0.17045455 0.21003621 0.26925338 0.29914098
#> [73] 0.19121585 0.14943123 0.24358974 0.20746040 0.23490614 0.23789693
#> [79] 0.22760981 0.21656407 0.26946438 0.20472009 0.09884332 0.10243408
#> [85] 0.19603860 0.28696127 0.10515672 0.20162602 0.08646999 0.17539126
#> [91] 0.12303665 0.26541009 0.19070010 0.22674095 0.22312787 0.05015674
#> [97] 0.16826111 0.30022321 0.21574803 0.14554974
#>
#> $N_enrolled
#> [1] 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200
#> [18] 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200
#> [35] 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200
#> [52] 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200
#> [69] 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200
#> [86] 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200
#>
#> $N_control
#> [1] 94 91 89 97 96 68 93 88 78 93 79 70 67 88 65 85 85
#> [18] 73 95 93 96 91 99 103 84 74 88 96 100 107 73 88 89 85
#> [35] 83 79 89 95 79 78 99 96 86 79 82 91 78 93 79 82 104
#> [52] 108 85 79 97 89 92 79 98 63 80 90 89 83 96 84 99 95
#> [69] 86 87 71 95 81 86 80 99 97 85 77 77 73 90 82 96 105
#> [86] 75 104 73 106 85 82 93 92 89 89 90 73 72 83 96
#>
#> $N_treatment
#> [1] 106 109 111 103 104 132 107 112 122 107 121 130 133 112 135 115 115
#> [18] 127 105 107 104 109 101 97 116 126 112 104 100 93 127 112 111 115
#> [35] 117 121 111 105 121 122 101 104 114 121 118 109 122 107 121 118 96
#> [52] 92 115 121 103 111 108 121 102 137 120 110 111 117 104 116 101 105
#> [69] 114 113 129 105 119 114 120 101 103 115 123 123 127 110 118 104 95
#> [86] 125 96 127 94 115 118 107 108 111 111 110 127 128 117 104
Computing power, stratified difference in treatment proportion using the binomialbayes function.
An example function execution with proportion of events in control is 0.35, proportion of events in treatment is 0.35, targeted sample size of 150, 2 number of blocks where randomization ratio is altered, 0.10 drift is applied, \(Beta(0.5, 0.5)\) non-informative prior is used, probability of accepting alternative of 0.95, alternative of “greater”, sampling with replacement and early stopping not applied.
#> $power
#> [1] 0.14
#>
#> $prop_diff_estimate
#> [1] 0.179605218 -0.096250351 -0.023740624 0.030620196 -0.069010838
#> [6] -0.134546636 -0.025178217 0.086149386 -0.015030624 0.146519677
#> [11] 0.211309027 0.016106372 0.021033281 0.034212252 -0.010214150
#> [16] 0.055368146 0.003761014 -0.096809134 0.024545134 0.027000311
#> [21] -0.083498715 0.084879244 0.171424741 -0.036038606 0.137161630
#> [26] -0.047212645 0.162462415 -0.076793132 -0.007625169 0.084774358
#> [31] 0.129479478 -0.149948866 0.001114347 0.074530541 0.202850215
#> [36] 0.075823650 0.025962079 0.017307523 0.072999012 0.139462742
#> [41] -0.094929642 -0.141804760 0.122248103 -0.027994537 -0.085930666
#> [46] 0.029755774 0.380043687 0.019254497 -0.138866733 0.151591753
#>
#> $N_enrolled
#> [1] 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150
#> [18] 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150
#> [35] 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150
#>
#> $N_control
#> [1] 50 83 81 83 82 70 70 73 66 50 42 74 90 82 89 93 72
#> [18] 65 65 80 87 55 55 83 50 61 63 77 84 54 69 98 76 54
#> [35] 48 57 69 74 78 41 100 79 72 76 80 93 39 73 94 54
#>
#> $N_treatment
#> [1] 100 67 69 67 68 80 80 77 84 100 108 76 60 68 61 57 78
#> [18] 85 85 70 63 95 95 67 100 89 87 73 66 96 81 52 74 96
#> [35] 102 93 81 76 72 109 50 71 78 74 70 57 111 77 56 96
#>
#> $early_success
#> [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> [36] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#>
#> $early_futilty
#> [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> [36] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> R version 3.5.2 (2018-12-20)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS Mojave 10.14
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] blockRAR_1.0.0 ggplot2_3.1.0
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.1 nloptr_1.2.1 pillar_1.3.1 compiler_3.5.2
#> [5] plyr_1.8.4 tools_3.5.2 boot_1.3-20 lme4_1.1-21
#> [9] digest_0.6.18 nlme_3.1-137 evaluate_0.13 tibble_2.1.1
#> [13] gtable_0.3.0 lattice_0.20-38 pkgconfig_2.0.2 rlang_0.3.1.9000
#> [17] Matrix_1.2-15 yaml_2.2.0 xfun_0.5 coda_0.19-2
#> [21] withr_2.1.2 dplyr_0.8.0.1 stringr_1.4.0 knitr_1.22
#> [25] ldbounds_1.1-1.1 grid_3.5.2 tidyselect_0.2.5 glue_1.3.1
#> [29] R6_2.4.0 survival_2.43-3 arm_1.10-1 rmarkdown_1.11
#> [33] bayesDP_1.3.2 minqa_1.2.4 purrr_0.3.2 magrittr_1.5
#> [37] splines_3.5.2 MASS_7.3-51.1 scales_1.0.0 htmltools_0.3.6
#> [41] abind_1.4-5 assertthat_0.2.1 colorspace_1.4-1 labeling_0.3
#> [45] stringi_1.4.3 lazyeval_0.2.2 munsell_0.5.0 crayon_1.3.4