simulate_one_trial {RLoptimal}R Documentation

Simulate One Trial Using an Obtained Optimal Adaptive Allocation Rule

Description

Simulate One Trial Using an Obtained Optimal Adaptive Allocation Rule

Usage

simulate_one_trial(
  allocation_rule,
  models,
  true_response,
  N_total,
  N_ini,
  N_block,
  Delta,
  outcome_type = c("continuous", "binary"),
  sd_normal = NULL,
  alpha = 0.025,
  selModel = c("AIC", "maxT", "aveAIC"),
  seed = NULL,
  eval_type = c("all", "pVal")
)

Arguments

allocation_rule

An object of class AllocationRule specifying an obtained optimal adaptive allocation rule.

models

An object of class Mods specifying assumed dose-response models. When outcome_type is "binary", models should be specified on the logit scale. This is used in the MCPMod method at the end of this trial.

true_response

A numeric vector specifying the true response values of the true model. When outcome_type is "binary", true_response should be specified on the logit scale.

N_total

A positive integer value. The total number of subjects.

N_ini

A positive integer vector in which each element is greater than or equal to 2. The number of subjects initially assigned to each dose.

N_block

A positive integer value. The number of subjects allocated adaptively in each round.

Delta

A positive numeric value. The clinically relevant target effect. When outcome_type is "binary", Delta should be specified on the logit scale. See TD for details.

outcome_type

A character value specifying the outcome type. Possible values are "continuous" (default), and "binary".

sd_normal

A positive numeric value. The standard deviation of the observation noise. When outcome_type is "continuous", sd_normal must be specified.

alpha

A positive numeric value. The significance level. Default is 0.025.

selModel

A character value specifying the model selection criterion for dose estimation. Possible values are "AIC" (default), "maxT", or "aveAIC". See MCPMod for details.

seed

An integer value. Random seed for data generation in this trial.

eval_type

A character value specifying the evaluation type. Possible values are "all" (default) and "pVal". "all" returns all metrics, which contain the minimum p value, the selected model name, the estimated target dose, and the MAE. "pVal" returns only the minimum p value without fitting models.

Value

A list which contains the minimum p value, the selected model name, the estimated target dose, the MAE, and the proportions of subjects allocated to each dose.

Examples

library(RLoptimal)

doses <- c(0, 2, 4, 6, 8)

models <- DoseFinding::Mods(
  doses = doses, maxEff = 1.65,
  linear = NULL, emax = 0.79, sigEmax = c(4, 5)
)

## Not run: 
allocation_rule <- learn_allocation_rule(
  models,
  N_total = 150, N_ini = rep(10, 5), N_block = 10, Delta = 1.3,
  outcome_type = "continuous", sd_normal = sqrt(4.5), 
  seed = 123, rl_config = rl_config_set(iter = 1000),
  alpha = 0.025
)

# Simulation-based adjustment of the significance level using `allocation_rule`
adjusted_alpha <- adjust_significance_level(
  allocation_rule, models,
  N_total = 150, N_ini = rep(10, 5), N_block = 10,
  outcome_type = "continuous", sd_normal = sqrt(4.5),
  alpha = 0.025, n_sim = 10000, seed = 123
)
## End(Not run)

eval_models <- DoseFinding::Mods(
  doses = doses, maxEff = 1.65,
  linear = NULL, emax = 0.79, sigEmax = c(4, 5), exponential = 1, quadratic = - 1/12
)
true_response_matrix <- DoseFinding::getResp(eval_models, doses = doses)
true_response_list <- as.list(data.frame(true_response_matrix, check.names = FALSE))

true_model_name <- "emax"

# Simulate one trial using the obtained `allocation_rule` When the true model is "emax"
## Not run: 
res_one <- simulate_one_trial(
  allocation_rule, models, 
  true_response = true_response_list[[true_model_name]],
  N_total = 150, N_ini = rep(10, 5), N_block = 10, 
  Delta = 1.3, outcome_type = "continuous", sd_normal = sqrt(4.5),
  alpha = adjusted_alpha, seed = simID, eval_type = "all"
)
## End(Not run)


[Package RLoptimal version 1.2.0 Index]