opt_design.fujikawa_x: Optimize Fujikawa et al.'s Basket Trial Design

View source: R/opt_design.R

opt_design.fujikawa_xR Documentation

Optimize Fujikawa et al.'s Basket Trial Design

Description

This wrapper function returns the optimal tuning parameters for Fujikawa et al.'s basket trial design. The design is optimized using backends from two different R packages:

  • If design$backend == "sim", the opt_design is calculated using basksim::opt_design.

  • If design$backend == "exact", the opt_design are calculated using baskexact::opt_design.

Usage

## S3 method for class 'fujikawa_x'
opt_design(
  design,
  n,
  alpha,
  design_params = list(),
  scenarios,
  prec_digits,
  iter = 1000,
  data = NULL,
  weight_fun = weights_jsd,
  weight_params = design_params,
  globalweight_fun = NULL,
  globalweight_params = list(),
  ...
)

Arguments

design

An object of class fujikawa_x.

n

The sample size per basket.

alpha

The one-sided significance level.

design_params

A list of params that is specific to the class of design.

scenarios

A matrix of scenarios.

prec_digits

Number of decimal places that are considered when adjusting lambda.

iter

The number of iterations in the simulation. Is ignored if data is specified.

data

A data matrix with k column with the number of responses for each basket. Has to be generated with get_data. If data is used, then iter is ignored.

weight_fun

Which functions should be used to calculated the pairwise weights? Default is weights_jsd.

weight_params

A list of tuning parameters specific to weight_fun. By default, it takes the function arguments epsilon, tau and logbase.

globalweight_fun

Which functions should be used to calculated the global weights? Currently, this is only supported for the exact backend.

globalweight_params

A list of tuning parameters specific to globalweight_fun.

...

Further arguments.

Value

A matrix with the expected number of correct decisions.

Examples


design <- setup_fujikawa_x(k = 3, p0 = 0.2)
# In an actual application, usually increase to at least iter = 1000.
opt_design(design = design,
           n = 20, alpha = 0.05,
           design_params = list(epsilon = c(1, 2), tau = c(0, 0.5)),
           scenarios = get_scenarios(design, 0.5),
           prec_digits = 3,
           iter = 100)


baskwrap documentation built on March 19, 2026, 5:09 p.m.