plot_weights: Plot Weights of a Basket Trial Design

View source: R/plot.R

plot_weightsR Documentation

Plot Weights of a Basket Trial Design

Description

Generic function for plotting the weights of a basket trial design. Currently only implemented for designs of class fujikawa_x.

Usage

plot_weights(design, ...)

Arguments

design

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

...

Further arguments.

Value

A ggplot object, a plot of the weights.

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.