plot_weights.fujikawa_x: Plot Weight Functions of Fujikawa et al.'s Basket Trial...

View source: R/plot.R

plot_weights.fujikawa_xR Documentation

Plot Weight Functions of Fujikawa et al.'s Basket Trial Design

Description

This function is a wrapper of baskexact::plot_weights(). It visualizes the weight functions defined for Fujikawa et al.'s design.

Usage

## S3 method for class 'fujikawa_x'
plot_weights(
  design,
  n,
  r1,
  weight_fun = weights_jsd,
  weight_params = list(),
  ...
)

Arguments

design

An object created with one of the setup_ functions from the basksim package or the baskwrap package.

n

The sample size per basket.

r1

Number of responses in one basket

weight_fun

Which function should be used to calculate the pairwise weights.

weight_params

A list of tuning parameters specific to weight_fun.

...

Further arguments.

Value

A ggplot object, showing the range of responses in the "other" basket on the x-axis and the corresponding weight on the y-axis.

Examples

design <- setup_fujikawa_x(k = 3, p0 = 0.2, backend = "exact")
# Default weight function is weights_jsd, which is identical
# to the Jensen-Shannon weights
plot_weights(design = design, n = 20, r1 = 11,
             weight_params = list(tau = 0, epsilon = c(0.25, 0.5, 1, 2),
                                  logbase = 2))
# Explicitly compare Jensen-Shannon and Hellinger weights
plot_weights(design = design, n = 20, r1 = 11,
             weight_fun = baskexact::weights_fujikawa,
             weight_params = list(tau = 0, epsilon = c(0.25, 0.5, 1, 2),
                                  logbase = 2))
plot_weights(design = design, n = 20, r1 = 11, weight_fun = weights_hld,
             weight_params = list(tau = 0, epsilon = c(0.25, 0.5, 1, 2),
                                  logbase = 2))

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