Description Usage Arguments Details Value References Examples
View source: R/optimizeTrial.r
We aim to minimize an objective function which we aim to minimize is the expected sample size, with additive penalties on power. If power for any alternative hypothesis is less than a supplied threshold (see cases
), a penalty will be applied.
1 2 3 4 5 6 7 8 9 | optimizeTrial(args_list_init, args_list_fixed, cases, max_K = 20,
objective_fun = min_E_SS_power_constraints, logit_search = c(),
local_n_search = FALSE, max_n_local = NULL, min_n_local = NULL,
time_limit_optim_cpu = NA, time_limit_optim_elapsed = NA,
max_n_feas = NULL, optim_method = "SANN", maxit = 1000, trial_method,
parscale_ratio_N = 100, parscale_ratio_K = 1, parscale_ratio_logit = 3,
build_precision = TRUE, print_interval = NULL, npoints_sqrt = 25,
stage1_feasible = NULL, returnFullPath = FALSE,
verbose = is.null(print_interval), print_obj = FALSE)
|
args_list_init |
a list containing a subset of the arguments for the functions |
args_list_fixed |
a subset of arguments for the functions |
cases |
a list of lists describing power constraints, and prior distribution of treatment effects over which to calculate the expected sample size (or duration). List elements are individually passed to |
max_K |
an upper limit for the number of stages for the trial. |
objective_fun |
objective function to minimize. This depends on the evaluation of the current proposed design at each element of |
logit_search |
a list of parameters for which optim will search in the logit space. This can include parameters which are bounded to the range (0,1). |
local_n_search |
[DEPRECATED] (logical) whether a search over n_total should be done at each iteration of optim. This had previously generated the output |
max_n_local |
[DEPRECATED] largest sample size for searches within iterations of optimization. Especially useful to set for optimizing a 1-stage design. |
min_n_local |
[DEPRECATED] smallest sample size for searches within iterations of optimization. Especially useful to set for optimizing a 1-stage design. |
time_limit_optim_cpu |
used to set a session time limit (see |
time_limit_optim_elapsed |
used to set a session time limit (see |
max_n_feas |
largest total sample size to consider when checking feasibility |
optim_method |
passed to |
maxit |
passed to |
trial_method |
the type of trial to run. 'cov' for covariance-based, 'MB' for Maurer Bretz (2013). |
parscale_ratio_N |
used to create the |
parscale_ratio_K |
used to create the |
parscale_ratio_logit |
used to create the |
build_precision |
if TRUE, the search will start by making approximate calculations for the efficacy boundaries, and will increase the precision of these efficacy boundary calculations as the search progresses. |
print_interval |
if set to |
npoints_sqrt |
passed to |
stage1_feasible |
output from |
returnFullPath |
(logical) tells whether the entire history of the search should be returned as well. |
verbose |
(logical) should progress be printed via |
print_obj |
(logical) In progress reports, should the objective function be printed rather than just the interpretable, unpenalized expected sample size. |
The argument trial_method
determines which type of trial should be performed ('cov' or 'MB'). Based on this, the relevant trial parameters to be optimized should be listed in args_list_init
. The parameters to hold fixed should be listed in args_list_fixed
.
The cases
argument should be a list of cases in which power, expected sample size and/or expected duration should be calculated. Internally, at each iteration of the search, the get_case_perf_obj
function is used to evaluate the trial.
A list of results with
soln |
the best design found during optimization |
performance_crossvalidated |
The solution found by optim may have low sample size or duration only due to Monte-Carlo error in calculating trial performance. To counter this potential bias, we recalculate the performance of the design returned by our optimization, and return the results in |
obj_final_crossvalidated |
The objective function value of the design from optim. Like |
optim_results |
output from |
obj_penalized_trajectory |
Each evaluation of the objective function. |
fullPath |
design and results from each iteration of the optimization |
time_optimized |
time taken for optimization procedure |
stage1_feasible |
output from |
feasible |
[DEPRECATED] |
optim_iterations |
Number of iterations performed |
local_search_calls |
[DEPRECATED] |
Maurer, W. and F. Bretz (2013). Multiple testing in group sequential trials using graphical approaches. Statistics in Biopharmaceutical Research.
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 | ## Not run:
## Generate example inputs
set.seed(0)
bound_style <- 'unstructured'
trial_method <- 'cov'
inputsMISTIE <- getExampleInputsMISTIE(iter=50, bound_style=bound_style, trial_method=trial_method)
inputsMISTIE$npoints_sqrt <- 9 # set to low resolution for example search for 1-stage reference trial
str(inputsMISTIE,1) # list of inputs
## Optimize adaptive trial
optimized <- do.call(optimizeTrial,inputsMISTIE) #~ 4-7 minutes
## Visualize results for approximately optimized trial
soln <- optimized$soln
bounds<-getBoundsFromOptimSoln(
soln = soln,
case = inputsMISTIE$cases[[1]],
trial_method = trial_method
)
# If calculation of efficacy boundary is unstable, particularly in
# later stages, increase soln$maxpts or decrease soln$abseps
# and recompute eff_bounds
matplot(x=cumsum(soln$n_per_stage),
y=data.frame(bounds$eff_bounds),type='o',pch=1:3,lty=1:3,
ylim=range(unlist(bounds)),
ylab='Boundary (z-scale)',
xlab='Cumulative number with outcome observed',
col='blue', main='Trial decision boundaries')
matlines(x=cumsum(soln$n_per_stage)[(1:soln$num_stages-1)],
y=bounds$fut_bounds[(1:soln$num_stages-1),],
col='red',type='o',pch=1:3,lty=1:3)
legend('bottomright',
c('H01 Eff','H02 Eff', 'H0C Eff','H01 Fut','H02 Fut', 'H0C Fut'),
col=rep(c('blue','red'),each=3),
pch=rep(1:3,times=2),lty=rep(1:3,times=2))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.