Create a class of controller to run a trial.
Public methods in this R6 class are used in developing this package. Thus, we have to export the whole R6 class which exposures all public methods. However, only the public methods in the list below are useful to end users.
$run()
$get_output()
$reset()
Methods
Method new()
initialize a controller of the trial
Usage
Controllers$new(trial, listener)
Arguments
trial
a trial object returned from
trial()
.listener
a listener object returned from
listener()
.
Method reset()
reset the trial and listener registered to the controller before running
additional replicate of simulation. This is usually done between two
calls of controller$run()
.
Method run()
run trial simulation.
Arguments
n
integer. Number of replicates of simulation.
n = 1
by default. Simulation results can be accessed bycontroller$get_output()
.plot_event
logical. Create event plot if
FALSE
. Users should set it to beFALSE
ifn > 1
.silent
logical.
TRUE
if muting all messages during a trial. Note that warning messages are still displayed.dry_run
logical. We are considering retire this argument.
TRUE
if action function provided by users is ignored and an internal default action.default_action
is called instead. This default function only locks data when the milestone is triggered. Milestone time and number of endpoints' events or sample sizes are saved. It is suggested to setdry_run = TRUE
to estimate distributions of triggering time and number of events before formally using custom action functions if a fixed design is in use. This helps determining planned maximum information for group sequential design and reasonable time of milestone of interest when planning a trial. Set it toFALSE
for formal simulations. However, for an adaptive design where arm(s) could possibly be added or removed, settingdry_run
toTRUE
is usually not helpful because adaption should be executed before estimating the milestone time.