MyNixOS website logo
Description

Analytical Calculation of Basket Trial Operating Characteristics.

Analytically calculates the operating characteristics of single-stage and two-stage basket trials with equal sample sizes using the power prior design by Baumann et al. (2024) <doi:10.48550/arXiv.2309.06988> and the design by Fujikawa et al. (2020) <doi:10.1002/bimj.201800404>.

baskexact

R-CMD-check Codecov testcoverage CRANstatus

Overview

baskexact analytically calculates the operating characteristics of a basket trial using the power prior design (
https://doi.org/10.48550/arXiv.2309.06988) and the design of Fujikawa et al. (https://doi.org/10.1002/bimj.201800404).

Installation

Install the currenct CRAN version of baskexact:

install.packages("baskexact")

Or install the development version from GitHub:

# install.packages("devtools")
devtools::install_github("https://github.com/lbau7/baskexact")

Usage

baskexact calculates the exact operating characteristics (type 1 error rate, power, expected number of correct decisions and expected sample size) of single-stage and two-stage basket trials with equal sample sizes using the power prior design and the design of Fujikawa et al.

At first, a design-object has to be created using either setupOneStageBasket for a single-stage trial or setupTwoStageBasket for a two-stage trial. For example:

library(baskexact) # the development version is used for the example
design <- setupOneStageBasket(k = 3, shape1 = 1, shape2 = 1, p0 = 0.2)

k is the number of baskets, shape1 and shape2 are the two shape parameters of the beta-prior of the response probabilities of each basket and p0 is the response probability under the null hypothesis. Note that currently only common prior parameters and a common null response probability are supported.

Use toer to calculate the type 1 error rate of a certain design:

toer(
  design = design,
  p1 = NULL,
  n = 15,
  lambda = 0.99,
  weight_fun = weights_cpp,
  weight_params = list(a = 2, b = 2),
  results = "group"
)

# $rejection_probabilities
# [1] 0.01401416 0.01401416 0.01401416
# 
# $fwer
# [1] 0.02676826

p1 refers to the true response probabilities under which the type 1 error rate is computed. Since p1 = NULL is specified, the type 1 error rates under a global null hypothesis are calculated. n specifies the sample size per basket. Currently only equal sample sizes are supported. lambda is the posterior probability cut-off to reject the null hypothesis. If the posterior probability that the response probability of the basket is larger than p0 is larger than lambda, then the null hypothesis is rejected. weight_fun specifies which method should be used to calculate the weights. With weights_cpp the weights are calculated based on a response rate differences between baskets. In weight_params a list of parameters that further define the weights is given. See Baumann et al. (2024) for details. results specifies whether only the family wise type 1 error rate (option fwer) or also the basketwise type 1 error rates (option group) are calculated.

To find the probability cut-off lambda such that a certain FWER is maintained, use adjust_lambda, for example to find lambda such that the FWER does not exceed 2.5% (note that all hypotheses are tested one-sided):

adjust_lambda(
  design = design,
  alpha = 0.025,
  p1 = NULL,
  n = 15,
  weight_fun = weights_cpp,
  weight_params = list(a = 2, b = 2),
  prec_digits = 4
)

# $lambda
# [1] 0.991
# 
# $toer
# [1] 0.0231528

With prec_digits it is specified how many decimal places of lambda are considered. Use toer with lambda = 0.9909 to check that 0.991 is indeed the smallest probability cut-off with four decimals with a FWER of at most 2.5%. Note that even when considering more decimal places the actual FWER will generally below the nominal level (quite substantially in some cases), since the outcome (number of responses) is discrete.

Use pow to calculate the power of the design:

pow(
  design = design,
  p1 = c(0.5, 0.5, 0.5),
  n = 15,
  lambda = 0.9942,
  weight_fun = weights_cpp,
  weight_params = list(a = 2, b = 2),
  results = "group"
)

# $rejection_probabilities
# [1] 0.909585 0.909585 0.909585
# 
# $ewp
# [1] 0.976372

pow has the same parameters as toer.

Metadata

Version

1.0.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows