View source: R/run_simulation.R
run_simulation | R Documentation |
Run simulations to get performance characteristics with given parameters. Performance outcomes are averaged over 1000 simulation trials by default.
library(stats)
true_probs = matrix(data = c(0.95, 0.0, 0.05,
0.5, 0.4, 0.1,
0.2, 0.65, 0.15,
0.1, 0.4, 0.5,
0.05, 0.0, 0.95), nrow = 5, ncol = 3, byrow = TRUE)
dose_levels = c(60,80,100,120,140)
starting_dose = 100
PF = 0.2
PF_tolerance = 0.05
eta = 0.8
PT = 0.2
PT_tolerance = 0.05
zeta = 0.8
#cohort size is 3, max sample size is 24, using defaults
results = run_simulation(true_probs, dose_levels, starting_dose, PF, PF_tolerance, eta, PT, PT_tolerance, zeta)
true_probs |
A Dx3 matrix containing the true chances of treatment futility, efficacy, and toxicity, where D = # of dose levels |
dose_levels |
A length D vector containing dose levels to be included in the trial. Can be in index or true value form (e.g. could be either c(1,2,3,4,5) or c(40,60,80,100,120)). |
starting_dose |
Which dose to start at, must be a value within |
PF |
Target tolerable futility probability |
PF_tolerance |
Half-length of futility equivalence interval (epsilon_F) |
eta |
Upper futility threshold beyond which invokes the futility rule |
PT |
Target tolerable toxicity probability |
PT_tolerance |
Half-length of toxicity equivalence interval (epsilon_T) |
zeta |
Upper toxicity threshold beyond which invokes the safety rule |
cohort_size |
How many new patients to test in each round of the trial |
max_samp_size |
The maximum number of subjects for the entire trial (default = 24) |
num_sims |
How many trials to perform in simulation (default = 1000) |
filter |
Posterior sum threshold to determine dose availability for final selection (pf+pt <= filter) (default = 0.5) |
seed |
A random seed (default = 111) |
In order to run simulations, decision tables must be pre-specified (e.g. by using the make_decision_table()
function) and loaded into the working environment.
All decision tables must be named in the format "decision_table#", where # = dose sample size.
For simulations the cohort size must be a fixed value, although this may not necessarily be true in real-life trials.
Simulations are meant to give an idea of how variable trial results may be given the chosen parameters, and is not to be taken as a statistical guarantee of any sort. Results depend on the assumptions that
the "true" probabilities of futility and toxicity are valid, and
no unexpected cohort additions or dropouts occur throughout the trial.
These assumptions are difficult to adhere to in real-life scenarios, and so the actual performance characteristics may differ from those outputted by the simulation. In other words, take the simulation performance results with a grain of salt. However, the closer the real-life trial adheres to the ideal simulation conditions, and the more sure we are about the "true" chances of toxicity and futility, the closer the actual outcome will adhere to what is expected from simulation results! For example, if simulation results show that the correct dose is chosen in 73% of trials, then in one real-life trial there is a 73% chance that the trial outcomes will point to a truly acceptable dose.
A list containing:
prop_time_selected – Percent of trials where each dose was selected as the final dose recommendation
times_early_stopping – How many trials stopped before reaching maximum sample size
mean_patients_perdose – Mean number of patients allocated to each dose level
min_patients_perdose – Minimum number of patients allocated to each dose level
max_patients_perdose – Maximum number of patients allocated to each dose level
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.