Code for the manuscript "Effects of allocation method and time trends on identification of the best arm in multi-arm trials" by authors Lindsay R Berry, Elizabeth Lorenzi, Nicholas S Berry, Amy M Crawford, Peter Jacko, Kert Viele.
This repository includes R code to reproduce the simulations and recreate the results figures within this manuscript. The original simulations were run on a computing system with several hundred threads. Modifications should be made if running this code on a personal computer by running only a subset of scenarios or reducing the number of simulation iterations. This code is intellectual property of Berry Consultants.
- utilities.R: A general set of utility functions used within the simulation code.
- simulation_functions.R: A set of functions to simulate multi-arm clinical trials with different allocation methods. Defines the runonetrial and runmanytrialsinparallel functions.
- run_simulations_parallel.R: Code to run selected simulation scenarios from the simulation_scenario_grid.csv file.
- simulation_scenario_grid.csv: CSV file including the grid of 700 simulations scenario combinations simulated within the manuscript.
- processing_get_sucess_thresholds.R: Code for processing simulation results to calculate success threshold that control type I error.
- processing_compute_OCs.R: Code to process simulation results to compute operating characteristics across designs and scenarios.
- processing_create_figures.R: Code to create output figures based on operating characteristics.
- Ensure that the following packages are installed in R: dplyr, gsDesign, rstanarm, VGAM, gsl, parallel, foreach, doParallel, doRNG, colorspace, ggplot2.
- Within the command line interface (e.g., Terminal/Command Prompt), navigate to the working directory that includes simulation code. Run the following command: nohup Rscript run_simulations_parallel.R $"X" $"Y" $"Z" > log.out & This code will run the file run_simulations_parallel.R with the input arguments of X, Y, and Z. The arguments X and Y are placeholders for the simulations scenarios to run from the list within the simulation_scenarios_grid.csv file. For example, X=Y=1 will run the first scenario and X=1/Y=700 will run all scenarios. The argument Z is a placeholder for the random number generator seed. To recreate manuscript results, set Z="20220524". Simulation output will be saved into the "SimOutput" folder by default.
Once simulations are complete, the following steps can be taken to process the results:
- Run the processing_get_success_thresholds.R file to calculate the success threshold for each design that control type I error under the “Flat” time trend scenario.
- Run the processing_compute_OCs.R file to compute summaries of the operating characteristics of each design.
- Run the processing_create_figures.R file to create the figures included within the manuscript and supplement. Output will be saved in the “Figures” folder by default.