Simulation for binomial counts for block design for response-adaptive randomization with time as a confounding

binomialbayes(
  p_control,
  p_treatment,
  N_total,
  block_number = 4,
  drift = 0,
  simulation = 10000,
  a0 = 0.5,
  b0 = 0.5,
  p = "n/2N",
  number_mcmc = 10000,
  prob_accept_ha = 0.95,
  early_success_prob = 0.99,
  futility_prob = 0.01,
  alternative = "greater",
  size_equal_randomization = 20,
  min_patient_earlystop = 20,
  max_prob = 0.8
)

Arguments

p_control

scalar. Proportion of events under the control arm.

p_treatment

scalar. Proportion of events under the treatment arm.

N_total

scalar. Total sample size.

block_number

scalar. Number of blocks or time levels. The default is set to 4. If block_number is set to 1. This is a traditional RCT design.

drift

scalar. The increase or decrease in proportion of event over time. In this case, the proportion of failure changes in each block by the number of patient accured over the total sample size. The full drift effect is seen in the final block.

simulation

scalar. Number of simulation to be ran. The default is set to 10000.

a0

scalar. Prior value for the beta rate Beta(a0, b0). Default is 0.5.

b0

scalar. Prior value for the beta rate Beta(a0, b0). Default is 0.5.

p

scalar. Power for randomization ratio.

number_mcmc

scalar. Number of Monte Carlo Markov Chain draws in sampling posterior.

prob_accept_ha

scalar. Probability of accepting alternative hypothesis.

early_success_prob

scalar. Probability of stopping early for success.

futility_prob

scalar. Probability of stopping early for futility.

alternative

character. A string specifying the alternative hypothesis, must be one of "less" or "greater" (default).

size_equal_randomization

scalar. The number of run in patients because adaptive randomization is applied.

min_patient_earlystop

scalar. Minimum number of patients before early stopping rule is applied.

max_prob

scalar. The maximum probability for assigning to treatment/control group is 0.8.

Value

a list with details on the simulation.

power

scalar. The power of the trial, ie. the proportion of success over the number of simulation ran.

p_control_estimate

scalar. The estimated proportion of events under the control group.

p_treatment_estimate

scalar. The estimated proportion of events under the treatment group.

N_enrolled

vector. The number of patients enrolled in the trial (sum of control and experimental group for each simulation. )

N_control

vector. The number of patients enrolled in the control group for each simulation.

N_control

vector. The number of patients enrolled in the experimental group for each simulation.

randomization_ratio

matrix. The randomization ratio allocated for each block.

Examples

binomialbayes(p_control = 0.20, p_treatment = 0.30, N_total = 100, simulation = 3)
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: step size truncated: out of bounds
#> Warning: non-finite coefficients at iteration 39
#> Warning: algorithm did not converge
#> Warning: algorithm stopped at boundary value
#> $power #> [1] 0.3333333 #> #> $prop_diff_estimate #> [1] -0.07581503 0.06362476 0.20617670 #> #> $N_enrolled #> [1] 100 100 100 #> #> $N_control #> [1] 50 44 40 #> #> $N_treatment #> [1] 50 56 60 #> #> $early_success #> [1] 0 0 0 #> #> $early_futilty #> [1] 0 0 0 #> #> $prob_trt #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] #> [1,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 #> [2,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 #> [3,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 #> [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] #> [1,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 #> [2,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 #> [3,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 #> [,26] [,27] [,28] [,29] [,30] [,31] [,32] #> [1,] 0.4829451 0.4829451 0.4829451 0.4829451 0.4829451 0.4829451 0.4829451 #> [2,] 0.5523069 0.5523069 0.5523069 0.5523069 0.5523069 0.5523069 0.5523069 #> [3,] 0.5412908 0.5412908 0.5412908 0.5412908 0.5412908 0.5412908 0.5412908 #> [,33] [,34] [,35] [,36] [,37] [,38] [,39] #> [1,] 0.4829451 0.4829451 0.4829451 0.4829451 0.4829451 0.4829451 0.4829451 #> [2,] 0.5523069 0.5523069 0.5523069 0.5523069 0.5523069 0.5523069 0.5523069 #> [3,] 0.5412908 0.5412908 0.5412908 0.5412908 0.5412908 0.5412908 0.5412908 #> [,40] [,41] [,42] [,43] [,44] [,45] [,46] #> [1,] 0.4829451 0.4829451 0.4829451 0.4829451 0.4829451 0.4829451 0.4829451 #> [2,] 0.5523069 0.5523069 0.5523069 0.5523069 0.5523069 0.5523069 0.5523069 #> [3,] 0.5412908 0.5412908 0.5412908 0.5412908 0.5412908 0.5412908 0.5412908 #> [,47] [,48] [,49] [,50] [,51] [,52] [,53] #> [1,] 0.4829451 0.4829451 0.4829451 0.4829451 0.4454953 0.4454953 0.4454953 #> [2,] 0.5523069 0.5523069 0.5523069 0.5523069 0.5657074 0.5657074 0.5657074 #> [3,] 0.5412908 0.5412908 0.5412908 0.5412908 0.6189535 0.6189535 0.6189535 #> [,54] [,55] [,56] [,57] [,58] [,59] [,60] #> [1,] 0.4454953 0.4454953 0.4454953 0.4454953 0.4454953 0.4454953 0.4454953 #> [2,] 0.5657074 0.5657074 0.5657074 0.5657074 0.5657074 0.5657074 0.5657074 #> [3,] 0.6189535 0.6189535 0.6189535 0.6189535 0.6189535 0.6189535 0.6189535 #> [,61] [,62] [,63] [,64] [,65] [,66] [,67] #> [1,] 0.4454953 0.4454953 0.4454953 0.4454953 0.4454953 0.4454953 0.4454953 #> [2,] 0.5657074 0.5657074 0.5657074 0.5657074 0.5657074 0.5657074 0.5657074 #> [3,] 0.6189535 0.6189535 0.6189535 0.6189535 0.6189535 0.6189535 0.6189535 #> [,68] [,69] [,70] [,71] [,72] [,73] [,74] #> [1,] 0.4454953 0.4454953 0.4454953 0.4454953 0.4454953 0.4454953 0.4454953 #> [2,] 0.5657074 0.5657074 0.5657074 0.5657074 0.5657074 0.5657074 0.5657074 #> [3,] 0.6189535 0.6189535 0.6189535 0.6189535 0.6189535 0.6189535 0.6189535 #> [,75] [,76] [,77] [,78] [,79] [,80] [,81] #> [1,] 0.4454953 0.4095142 0.4095142 0.4095142 0.4095142 0.4095142 0.4095142 #> [2,] 0.5657074 0.4994750 0.4994750 0.4994750 0.4994750 0.4994750 0.4994750 #> [3,] 0.6189535 0.7409405 0.7409405 0.7409405 0.7409405 0.7409405 0.7409405 #> [,82] [,83] [,84] [,85] [,86] [,87] [,88] #> [1,] 0.4095142 0.4095142 0.4095142 0.4095142 0.4095142 0.4095142 0.4095142 #> [2,] 0.4994750 0.4994750 0.4994750 0.4994750 0.4994750 0.4994750 0.4994750 #> [3,] 0.7409405 0.7409405 0.7409405 0.7409405 0.7409405 0.7409405 0.7409405 #> [,89] [,90] [,91] [,92] [,93] [,94] [,95] #> [1,] 0.4095142 0.4095142 0.4095142 0.4095142 0.4095142 0.4095142 0.4095142 #> [2,] 0.4994750 0.4994750 0.4994750 0.4994750 0.4994750 0.4994750 0.4994750 #> [3,] 0.7409405 0.7409405 0.7409405 0.7409405 0.7409405 0.7409405 0.7409405 #> [,96] [,97] [,98] [,99] [,100] #> [1,] 0.4095142 0.4095142 0.4095142 0.4095142 0.4095142 #> [2,] 0.4994750 0.4994750 0.4994750 0.4994750 0.4994750 #> [3,] 0.7409405 0.7409405 0.7409405 0.7409405 0.7409405 #>
binomialbayes(p_control = 0.50, p_treatment = 0.30, N_total = 100, simulation = 3)
#> Warning: step size truncated due to divergence
#> $power #> [1] 0 #> #> $prop_diff_estimate #> [1] -0.5734559 -0.2612439 -0.5600689 #> #> $N_enrolled #> [1] 20 100 20 #> #> $N_control #> [1] 5 73 11 #> #> $N_treatment #> [1] 15 27 9 #> #> $early_success #> [1] 0 0 0 #> #> $early_futilty #> [1] 1 0 1 #> #> $prob_trt #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] #> [1,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 #> [2,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 #> [3,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 #> [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] #> [1,] 0.5 0.5 0.5 0.5 0.5 0.5 0.0 0.0 0.0 0.0 0.0 #> [2,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 #> [3,] 0.5 0.5 0.5 0.5 0.5 0.5 0.0 0.0 0.0 0.0 0.0 #> [,26] [,27] [,28] [,29] [,30] [,31] [,32] #> [1,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [2,] 0.4178926 0.4178926 0.4178926 0.4178926 0.4178926 0.4178926 0.4178926 #> [3,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [,33] [,34] [,35] [,36] [,37] [,38] [,39] #> [1,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [2,] 0.4178926 0.4178926 0.4178926 0.4178926 0.4178926 0.4178926 0.4178926 #> [3,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [,40] [,41] [,42] [,43] [,44] [,45] [,46] #> [1,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [2,] 0.4178926 0.4178926 0.4178926 0.4178926 0.4178926 0.4178926 0.4178926 #> [3,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [,47] [,48] [,49] [,50] [,51] [,52] [,53] #> [1,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [2,] 0.4178926 0.4178926 0.4178926 0.4178926 0.2085675 0.2085675 0.2085675 #> [3,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [,54] [,55] [,56] [,57] [,58] [,59] [,60] #> [1,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [2,] 0.2085675 0.2085675 0.2085675 0.2085675 0.2085675 0.2085675 0.2085675 #> [3,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [,61] [,62] [,63] [,64] [,65] [,66] [,67] #> [1,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [2,] 0.2085675 0.2085675 0.2085675 0.2085675 0.2085675 0.2085675 0.2085675 #> [3,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [,68] [,69] [,70] [,71] [,72] [,73] [,74] #> [1,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [2,] 0.2085675 0.2085675 0.2085675 0.2085675 0.2085675 0.2085675 0.2085675 #> [3,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> [,75] [,76] [,77] [,78] [,79] [,80] [,81] [,82] [,83] [,84] [,85] #> [1,] 0.0000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 #> [2,] 0.2085675 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 #> [3,] 0.0000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 #> [,86] [,87] [,88] [,89] [,90] [,91] [,92] [,93] [,94] [,95] [,96] [,97] #> [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 #> [2,] 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 #> [3,] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 #> [,98] [,99] [,100] #> [1,] 0.0 0.0 0.0 #> [2,] 0.2 0.2 0.2 #> [3,] 0.0 0.0 0.0 #>