Skip to contents

Create a class of controller to run a trial.

Methods


Method new()

initialize a controller of the trial

Usage

Controllers$new(trial, listener)

Arguments

trial

a Trials object.

listener

a Listeners object.


Method get_listener()

return listener

Usage

Controllers$get_listener()


Method get_trial()

return trial

Usage

Controllers$get_trial()


Method mute()

mute all messages (not including warnings)

Usage

Controllers$mute()

Arguments

silent

logical.


Method reset()

reset the trial and listener registered to the controller before running additional replicate of simulation.

Usage

Controllers$reset()


Method get_output()

return a data frame of all current outputs saved by calling save.

Usage

Controllers$get_output(cols = NULL, simplify = TRUE)

Arguments

cols

columns to be returned from Controller$output. If NULL, all columns are returned.

simplify

logical. Return value rather than a data frame of one column when length(col) == 1 and simplify == TRUE.


Method run()

run a trial

Usage

Controllers$run(n = 1, plot_event = TRUE, silent = FALSE, dry_run = FALSE)

Arguments

n

number of replicates of simulation. n = 1 by default. Simulation results can be accessed by Controller$get_output().

plot_event

create event plot

silent

logical. TRUE if muting all messages during a trial. Note that warning messages are still displayed.

dry_run

TRUE if action function provided by users is ignored and a built-in 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 set dry_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 to FALSE for formal simulations. However, for an adaptive design where arm(s) could possibly be added or removed, setting dry_run to TRUE is usually not helpful because adaption should be actually applied to estimate milestone time.


Method clone()

The objects of this class are cloneable with this method.

Usage

Controllers$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

##