knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
We attempt to provide a big picture view of what is involved in a clinical trial simulation with individual time-to-event data generated for each patient. Primary interest is in group sequential trials, usually with a single endpoint. However extensions could be made.
At the time of simulation planning an analysis plan for the trial is needed. For a group sequential design, a data table to store results is generated. Generally, the dimensions and variables planned for storage would be planned up front. As a simple example, if there is a group sequential design with 3 analyses planned, 15 data items for each analysis and 10,000 simulations planned, a data table with 30,000 rows and 15 columns has been used to store summary results. As each trial simulation proceeds, a row is updated with results for each analysis.
For each simulated trial, an initial table is generated with information at a patient level. If trials are generated sequentially, the space needed for this data table could be re-used, never requiring allocation of more space. Each row contains data for a single patient. As an example, we could simulate a trial with 500 patients and 10 data items per patients. The data items would be in columns, the patients in rows.
Simulated trial data need to be manipulated to do any individual analysis (interim or final) for a clinical trial. The following operations are needed:
Group sequential design simulation flow:
knitr::include_graphics("./figures/workflow.png")
g <- DiagrammeR::grViz(" digraph boxes_and_diamonds { # a 'graph' statement graph [ordering = 'in'] # several 'node' statements node [fontsize = '14', fontname = 'Arial'] node [shape = box, style = filled, fillcolor = '#d9d2e9'] 'Save analysis\n summary'; 'Cut data\n for analysis'; 'Analyze data'; node [shape = diamond, style = filled, fillcolor = '#fff2cc'] 'Final analysis?' node [shape = diamond, style = filled, fillcolor = '#fff2cc'] 'Finished with\n all trials?' node [shape = box, style = filled, fillcolor = '#e6b8af', label = 'Summarize across\n trials'] summarize node [shape = box, style = filled, fillcolor = '#d9ead3', label = 'Scenario'] scenario node [shape = box, style = filled, fillcolor = '#cfe2f3', label = 'Generate enrollment\n times'] enrollment node [shape = box, style = filled, fillcolor = '#cfe2f3', label = 'Generate strata'] strata node [shape = box, style = filled, fillcolor = '#cfe2f3', label = 'Randomize patients'] randomize node [shape = box, style = filled, fillcolor = '#cfe2f3', label = 'Generate outcomes'] outcomes node [shape = box, style = filled, fillcolor = '#cfe2f3', label = 'Generate next\n trial'] next scenario -> enrollment -> strata -> randomize -> outcomes outcomes -> 'Cut data\n for analysis' -> 'Analyze data'->'Save analysis\n summary' 'Save analysis\n summary' -> 'Final analysis?' 'Final analysis?' -> 'Cut data\n for analysis' [label = 'No', fontname = 'Arial'] 'Final analysis?' -> 'Finished with\n all trials?' [label = 'Yes', fontname = 'Arial'] 'Finished with\n all trials?' -> summarize [label = 'Yes', fontname = 'Arial'] 'Finished with\n all trials?' -> next [label = 'No', fontname = 'Arial'] } ") rsvg::rsvg_png(charToRaw(DiagrammeRsvg::export_svg(g)), file = file.path(tempdir(), "workflow.png"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.