Learn R Programming

basksim (version 2.0.2)

geom_borrow.fujikawa: Plot a Fujikawa basket trial's posterior distribution after borrowing

Description

Plot a Fujikawa basket trial's posterior distribution after borrowing

Usage

# S3 method for fujikawa
geom_borrow(design, n, r, epsilon, tau, logbase, ...)

Value

A list of ggplot layers of type `geom_function`.

Arguments

design

An object created with one of the setup functions.

n

The sample sizes of the baskets. A vector must be used for varying sample sizes.

r

Vector of responses.

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.

...

Further arguments to be passed to `geom_function`.

Examples

Run this code
# Example for a basket trial with Fujikawa's Design
design <- setup_fujikawa(k = 3, p0 = 0.2)
n <- 20
r <- c(4, 5, 2)
epsilon <- 2
tau <- 0.5
# One facet per basket
library(ggplot2)
ggplot() +
    geom_borrow(design, n, r, epsilon, tau, logbase = exp(1)) +
    facet_wrap(vars(basket))
# Colour different baskets
ggplot() +
    geom_borrow(design, n, r, epsilon, tau,
                logbase = exp(1), aes(colour = basket))

Run the code above in your browser using DataLab