toer.fujikawa_x: Calculate the Type 1 Error Rate for a Fujikawa et al.'s...

View source: R/toer.R

toer.fujikawa_xR Documentation

Calculate the Type 1 Error Rate for a Fujikawa et al.'s Basket Trial Design

Description

This wrapper functions returns the type-1 error rate (TOER) for Fujikawa et al.'s basket trial design. The TOER is calculated using backends from two different R packages:

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

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

Usage

## S3 method for class 'fujikawa_x'
toer(
  design,
  n,
  p1 = NULL,
  lambda,
  epsilon = epsilon,
  tau = tau,
  logbase = logbase,
  design_params = list(epsilon = epsilon, tau = tau, logbase = logbase),
  iter = 1000,
  data = NULL,
  weight_fun = weights_jsd,
  weight_params = design_params,
  globalweight_fun = NULL,
  globalweight_params = list(),
  results = c("fwer", "group"),
  ...
)

Arguments

design

An object of class fujikawa_x.

n

The sample size per basket.

p1

Probabilities used for the simulation. If NULL then all probabilities are set to p0.

lambda

The posterior probability threshold.

epsilon

Tuning parameter that determines the amount of borrowing. See setup_fujikawa).

tau

Tuning parameter that determines how similar the baskets have to be that information is shared. See setup_fujikawa).

logbase

Tuning parameter. The base of the logarithm that is used to calculate the Jensen-Shannon divergence.

design_params

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

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.

results

Whether only the family wise error rate (option fwer) or also the rejection probabilities per group (option group) should be returned.

...

Further arguments.

Value

A numeric value.

Examples

design <- setup_fujikawa_x(k = 3, p0 = 0.2)
toer(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95,
     design_params = list(epsilon = 2, tau = 0), iter = 100)

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