MyNixOS website logo
Description

Design Clinical Trials using Sequential Predictive Probability Monitoring.

Functions are available to calibrate designs over a range of posterior and predictive thresholds, to plot the various design options, and to obtain the operating characteristics of optimal accuracy and optimal efficiency designs.

Codecov testcoverage CRANstatus Lifecycle:stable R-CMD-check



ppseq

The {ppseq} package provides functions to design clinical trials using Bayesian sequential predictive probability monitoring. Functionality is available to design one-arm or two-arm trials by searching over a grid of combinations of posterior and predictive thresholds and identifying the optimal design according to two criteria: accuracy and efficiency. Interactive plotting allows easy comparison of the various design options and easy trial implementation through decision rule plots.

Installation

You can install the production version of ppseq from CRAN with:

install.packages("ppseq")

Or you can install the development version of ppseq from GitHub with:

remotes::install_github("zabore/ppseq")

Basic usage

library(ppseq)

The primary function to search over a grid of combinations of posterior and predictive thresholds for a certain trial design is calibrate_thresholds(). This function is computationally intensive to varying degrees depending on the number of looks and the number of threshold combinations, and is best run on a server and/or with parallelization.

set.seed(12345)

calthresh <-
  calibrate_thresholds(
    p_null = c(0.2, 0.2),
    p_alt = c(0.2, 0.5),
    n = cbind(seq(10, 50, 10), seq(10, 50, 10)),
    N = c(50, 50),
    pp_threshold = seq(0.9, 0.95, 0.01),
    ppp_threshold = seq(0.05, 0.2, 0.05),
    delta = 0
    )

The resulting design options can be compared interactively compared by passing the results to plot() with the option plotly = TRUE. Static versions of the plots are also available using the default option plotly = FALSE, which produces ggplot results. Plot output can optionally be filtered by desired range of type 1 error and minimum power. The default plots all design options. The results can also be viewed in tabular form by passing the results to print() with filtering options for the desired range of type 1 error and minimum power.

plot(calthresh)

The optimal accuracy and optimal efficiency designs can be obtained by passing the results to the optimize_design() function, with filtering applied for the desired range of type 1 error and minimum power.

optimize_design(calthresh, type1_range = c(0.025, 0.05), minimum_power = 0.8)

After selecting a design, we can obtain a set of decision rules to implement the trial, so that no calculations will be needed during the course of the trial. The calc_decision_rules() function will generate the decision rules to stop or continue at each interim look of the trial.

set.seed(123456)

opteffrules <- 
  calc_decision_rules(
    n = cbind(seq(10, 50, 10), seq(10, 50, 10)),
    N = c(50, 50),
    theta = 0.94,
    ppp = 0.2,
    p0 = NULL, 
    delta = 0
  )

The results can be displayed with interactive graphics by passing the results to plot() with the default option plotly = TRUE. Below are the static ggplot versions created with the option plotly = FALSE for demonstration purposes. Tabular results can be obtained by passing the results to print().

plot(opteffrules, plotly = FALSE)

See the vignettes for the one-sample and two-sample cases for additional details about available features and options.

Metadata

Version

0.2.4

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