sim_twostage_crm: Function to simulate a two-stage CRM

View source: R/sim_twostage_crm.R

sim_twostage_crmR Documentation

Function to simulate a two-stage CRM

Description

This is a general purpose simulator for the CRM as used by the function twostage_simulator. If desired, users can simulate a two-stage CRM (two rounds of toxicity assignment), rather than a one-stage CRM.

Usage

sim_twostage_crm(
  n_sim,
  titecrm_args,
  second_stage_start_after = Inf,
  first_stage_label = 1,
  sim_specific_start_id = NULL,
  sim_specific_prior = NULL,
  sim_specific_x0 = NULL,
  sim_specific_scale = NULL,
  seed = sample(.Machine$integer.max, 1)
)

Arguments

n_sim

How many simulated trials to conduct? (positive integer)

titecrm_args

This is a named list providing all of the arguments that the function titesim_ss expects. See titesim_ss documentation for more information on these required components. If the arguments prior, x0, and scale vary between simulations, then these arguments should be specified separately using sim_specific_prior, sim_specific_x0, and sim_specific_scale, respectively.

second_stage_start_after

If simulating a two-stage CRM, this positive integer indicates after how many patients should we switch to the second stage. If a one-stage CRM is desired, second_stage_start_after should equal n in titecrm_args.

first_stage_label

A numeric value to be appended to all patients who belonged to the first stage.

sim_specific_start_id

A positive integer vector containing the starting subject id for each simulated trial. If provided, it must be as long as n_sim.

sim_specific_prior

If provided, this is a positive numeric matrix with number of rows equal to n_sim and number of columns equal to the number of dose levels, i.e. length(titecrm_args$PI). Each row gives the trial-specific skeleton to use. If not provided, then a common skeleton is used, taken from the value of titecrm_args$prior.

sim_specific_x0

If provided, this is a non-negative integer vector with length equal to n_sim giving the starting dose level for each trial. If not provided, then a common starting dose is used, taken from the value of titecrm_args$x0.

sim_specific_scale

If provided, this is a positive numeric vector with length equal to n_sim giving the trial-specific value of the prior scale for beta in the power model p = skeleton ^ exp(beta). If not provided, then a common scale is used across simulations, taken from titecrm_args$scale.

seed

A positive integer seed for use prior to starting the simulations.

Value

The function returns the a named list containing:

all_results

A matrix giving the individual patient outcomes from all simulated trials.

first_stage_estMTD

A vector as long as the number of simulated trials giving an integer value corresponding to the estimated MTD from each trial as of the end of the first stage. A value of 0 indicates that all dose levels were estimated to be unsafe.

second_stage_estMTD

The same result as first_stage_estMTD but at the end of the second stage.

first_stage_enrollment

A vector as long as the number of simulated trials, giving the actual enrollment for that trial up to the end of the first stage.

second_stage_enrollment

A vector as long as the number of simulated trials, giving the actual enrollment for that trial up to the end of the second stage. So the second stage result will include the enrollment from the first stage (and equal it if that simulated trial stopped in the first stage).

seed

The seed that was used by the function.

References

\insertRef

boonstra2020seamlesssim

\insertRef

dfcrm2019seamlesssim


elizabethchase/seamlesssim documentation built on Aug. 10, 2022, 2:55 a.m.