Package 'BayesDIP'

Title: Bayesian Decreasingly Informative Priors for Early Termination Phase II Trials
Description: Provide early termination phase II trial designs with a decreasingly informative prior (DIP) or a regular Bayesian prior chosen by the user. The program can determine the minimum planned sample size necessary to achieve the user-specified admissible designs. The program can also perform power and expected sample size calculations for the tests in early termination Phase II trials. See Wang C and Sabo RT (2022) <doi:10.18203/2349-3259.ijct20221110>; Sabo RT (2014) <doi:10.1080/10543406.2014.888441>.
Authors: Chen Wang [cre, aut], Roy Sabo [aut]
Maintainer: Chen Wang <[email protected]>
License: GPL (>= 2)
Version: 0.1.1
Built: 2025-02-16 04:00:47 UTC
Source: https://github.com/chenw10/bayesdip

Help Index


One sample Bernoulli model

Description

For a given planned sample size, the efficacy and futility boundaries, return the power, the type I error, the expected sample size and its standard deviation, the probability of reaching the efficacy and futility boundaries.

Usage

OneSampleBernoulli(
  prior,
  N = 100,
  p0,
  p1,
  d = 0,
  ps = 0.95,
  pf = 0.05,
  alternative = c("less", "greater"),
  seed = 202209,
  sim = 5000
)

Arguments

prior

A list of length 3 containing the distributional information of the prior. The first element is a number specifying the type of prior. Options are

  1. DIP ;

  2. Beta(a,b), where a = shape, b = scale

The second and third elements of the list are the parameters a and b, respectively.

N

The planned sample size.

p0

The null response rate, which could be taken as the standard or historical rate.

p1

The response rate of the new treatment.

d

The target improvement (minimal clinically meaningful difference).

ps

The efficacy boundary (upper boundary).

pf

The futility boundary (lower boundary).

alternative

less (lower values imply greater efficacy) or greater (larger values imply greater efficacy).

seed

The seed for simulations.

sim

The number of simulations.

Value

A list of the arguments with method and computed elements

Examples

# with traditional Bayesian prior Beta(1,1)
OneSampleBernoulli(list(2,1,1), N = 100, p0 = 0.3, p1 = 0.5, d = 0.05,
                   ps = 0.98, pf = 0.05, alternative = "greater",
                   seed = 202210, sim = 10)
# with DIP
OneSampleBernoulli(list(1,0,0), N = 100, p0 = 0.3, p1 = 0.5, d = 0.05,
                   ps = 0.98, pf = 0.05, alternative = "greater",
                   seed = 202210, sim = 10)

One sample Bernoulli model - Trial Design

Description

Calculate the minimum planned sample size under an admissible design. The users decide the power and type-I-error, and pick the efficacy and futility boundaries. If there are no admissible design based on controlled type-I-error, then default to output the designs with the lowest type-I-error and at least the user-defined (e.g. 80%) power.

Usage

OneSampleBernoulli.Design(
  prior,
  nmin = 10,
  nmax = 100,
  p0,
  p1,
  d = 0,
  ps,
  pf,
  power = 0.8,
  t1error = 0.05,
  alternative = c("less", "greater"),
  seed = 202209,
  sim = 1000
)

Arguments

prior

A list of length 3 containing the distributional information of the prior. The first element is a number specifying the type of prior. Options are

  1. DIP ;

  2. Beta(a,b), where a = shape, b = scale

The second and third elements of the list are the parameters a and b, respectively.

nmin

The start searching sample size

nmax

The stop searching sample size

p0

The null response rate, which could be taken as the standard or historical rate.

p1

The response rate of the new treatment.

d

The target improvement (minimal clinically meaningful difference).

ps

The efficacy boundary (upper boundary).

pf

The futility boundary (lower boundary).

power

The power to achieve.

t1error

The controlled type-I-error.

alternative

less (lower values imply greater efficacy) or greater (larger values imply greater efficacy).

seed

The seed for simulations.

sim

The number of simulations.

Value

A list of the arguments with method and computed elements.

Examples

# with traditional Bayesian prior Beta(1,1)
OneSampleBernoulli.Design(list(2,1,1), nmin = 10, nmax=100, p0 = 0.3, p1 = 0.5, d = 0,
                   ps = 0.98, pf = 0.02, power = 0.80, t1error=0.05, alternative = "greater",
                   seed = 202210, sim = 10)
# with DIP
OneSampleBernoulli.Design(list(1,0,0), nmin = 10, nmax=100, p0 = 0.3, p1 = 0.5, d = 0,
                   ps = 0.98, pf = 0.02, power = 0.80, t1error=0.05, alternative = "greater",
                   seed = 202210, sim = 10)

One sample Normal model with one-parameter unknown, given variance

Description

For a given planned sample size, the efficacy and futility boundaries, return the power, the type I error, the expected sample size and its standard deviation, the probability of reaching the efficacy and futility boundaries.

Usage

OneSampleNormal1(
  prior,
  N = 100,
  mu0,
  mu1,
  var,
  d = 0,
  ps = 0.95,
  pf = 0.05,
  alternative = c("less", "greater"),
  seed = 202209,
  sim = 5000
)

Arguments

prior

A list of length 2 containing the distributional information of the prior. The first element is a number specifying the type of prior. Options are

  1. DIP ;

  2. Normal(mu0,var/n0), where mu0 = prior mean, var = the known variance

The second elements of the list is the parameter n0.

N

The planned sample size.

mu0

The null mean value, which could be taken as the standard or current mean.

mu1

The mean value of the new treatment.

var

The variance

d

The target improvement (minimal clinically meaningful difference).

ps

The efficacy boundary (upper boundary).

pf

The futility boundary (lower boundary).

alternative

less (lower values imply greater efficacy) or greater (larger values imply greater efficacy).

seed

The seed for simulations.

sim

The number of simulations.

Value

A list of the arguments with method and computed elements.

Examples

# with traditional Bayesian prior Beta(1,1)
OneSampleNormal1(list(2,6), N = 100, mu0 = 100, mu1 = 95, var=15, d = 0.05,
                  ps = 0.95, pf = 0.05, alternative = "less",
                  seed = 202210, sim = 10)
OneSampleNormal1(list(1,0), N = 100, mu0 = 100, mu1 = 95, var=15, d = 0.05,
                  ps = 0.95, pf = 0.05, alternative = "less",
                  seed = 202210, sim = 10)

One sample Normal model with one-parameter unknown, given variance

Description

#' Calculate the minimum planned sample size under an admissible design. The users decide the power and type-I-error, and pick the efficacy and futility boundaries. If there are no admissible design based on controlled type-I-error, then default to output the designs with the lowest type-I-error and at least the user-defined (e.g. 80%) power.

Usage

OneSampleNormal1.Design(
  prior,
  nmin = 10,
  nmax = 100,
  mu0,
  mu1,
  var,
  d = 0,
  ps,
  pf,
  power = 0.8,
  t1error = 0.05,
  alternative = c("less", "greater"),
  seed = 202209,
  sim = 1000
)

Arguments

prior

A list of length 2 containing the distributional information of the prior. The first element is a number specifying the type of prior. Options are

  1. DIP ;

  2. Normal(mu0,var/n0), where mu0 = prior mean, var = the known variance

The second elements of the list is the parameter n0.

nmin

The start searching sample size

nmax

The stop searching sample size

mu0

The null mean value, which could be taken as the standard or current mean.

mu1

The mean value of the new treatment.

var

The variance

d

The target improvement (minimal clinically meaningful difference).

ps

The efficacy boundary (upper boundary).

pf

The futility boundary (lower boundary).

power

The power to achieve.

t1error

The controlled type-I-error.

alternative

less (lower values imply greater efficacy) or greater (larger values imply greater efficacy).

seed

The seed for simulations.

sim

The number of simulations.

Value

A list of the arguments with method and computed elements.

Examples

# with traditional Bayesian prior Beta(1,1)
OneSampleNormal1.Design(list(2,6), nmin = 10, nmax = 100, mu0 = 100, mu1 = 95, var=15, d = 0.05,
                  ps = 0.95, pf = 0.05, power = 0.8, t1error = 0.05, alternative = "less",
                  seed = 202210, sim = 10)
# with DIP
OneSampleNormal1.Design(list(1,0), nmin = 10, nmax = 100, mu0 = 100, mu1 = 95, var=15, d = 0.05,
                  ps = 0.95, pf = 0.05, power = 0.8, t1error = 0.05, alternative = "less",
                  seed = 202210, sim = 10)

One sample Normal model with two-parameter unknown - both mean and variance unknown

Description

For a given planned sample size, the efficacy and futility boundaries, return the power, the type I error, the expected sample size and its standard deviation, the probability of reaching the efficacy and futility boundaries.

Usage

OneSampleNormal2(
  prior,
  N = 100,
  mu0,
  mu1,
  var0,
  var,
  d = 0,
  ps = 0.95,
  pf = 0.05,
  alternative = c("less", "greater"),
  seed = 202209,
  sim = 5000
)

Arguments

prior

A list of length 3 containing the distributional information of the prior. The first element is a number specifying the type of prior. Options are

  1. DIP ;

  2. Normal(mu0,var/k) and var ~ Inverse-Gamma(v/2, v*var0/2)

    where mu0 = prior mean, k = sample size of prior observations (Normal prior),

    v = sample size of prior observations (Gamma prior), var0 = prior sample variance

The second and third elements of the list are the parameters k and v, respectively.

N

The planned sample size.

mu0

The null mean value, which could be taken as the standard or current mean.

mu1

The mean value of the new treatment.

var0

The prior sample variance

var

The variance

d

The target improvement (minimal clinically meaningful difference).

ps

The efficacy boundary (upper boundary).

pf

The futility boundary (lower boundary).

alternative

less (lower values imply greater efficacy) or greater (larger values imply greater efficacy).

seed

The seed for simulations.

sim

The number of simulations.

Value

A list of the arguments with method and computed elements.

Examples

# with traditional Bayesian prior Beta(1,1)
OneSampleNormal2(list(2,2,1), N = 100, mu0 = 100, mu1 = 95, var0=225, var=225, d = 0,
                        ps = 0.95, pf = 0.05, alternative = "less",
                        seed = 202210, sim = 10)
# with DIP
OneSampleNormal2(list(1,0,0), N = 100, mu0 = 100, mu1 = 95, var0=225, var=225, d = 0,
                        ps = 0.95, pf = 0.05, alternative = "less",
                        seed = 202210, sim = 10)

One sample Normal model with two-parameter unknown - both mean and variance unknown

Description

Calculate the minimum planned sample size under an admissible design. The users decide the power and type-I-error, and pick the efficacy and futility boundaries. If there are no admissible design based on controlled type-I-error, then default to output the designs with the lowest type-I-error and at least the user-defined (e.g. 80%) power.

Usage

OneSampleNormal2.Design(
  prior,
  nmin = 10,
  nmax = 100,
  mu0,
  mu1,
  var0,
  var,
  d = 0,
  ps,
  pf,
  power = 0.8,
  t1error = 0.05,
  alternative = c("less", "greater"),
  seed = 202209,
  sim = 1000
)

Arguments

prior

A list of length 3 containing the distributional information of the prior. The first element is a number specifying the type of prior. Options are

  1. DIP ;

  2. Normal(mu0,var/k) and var ~ Inverse-Gamma(v/2, v*var0/2)

    where mu0 = prior mean, k = sample size of prior observations (Normal prior),

    v = sample size of prior observations (Gamma prior), var0 = prior sample variance

The second and third elements of the list are the parameters k and v, respectively.

nmin

The start searching sample size

nmax

The stop searching sample size

mu0

The null mean value, which could be taken as the standard or current mean.

mu1

The mean value of the new treatment.

var0

The prior sample variance

var

The variance

d

The target improvement (minimal clinically meaningful difference).

ps

The efficacy boundary (upper boundary).

pf

The futility boundary (lower boundary).

power

The power to achieve.

t1error

The controlled type-I-error.

alternative

less (lower values imply greater efficacy) or greater (larger values imply greater efficacy).

seed

The seed for simulations.

sim

The number of simulations.

Value

A list of the arguments with method and computed elements.

Examples

# with traditional Bayesian prior Beta(1,1)
OneSampleNormal2.Design(list(2,2,1), nmin = 10, nmax = 100, mu0 = 100, mu1 = 95,
                        var0=225, var=225, d = 0, ps = 0.95, pf = 0.05,
                        power = 0.8, t1error = 0.05, alternative = "less",
                        seed = 202210, sim = 10)
# with DIP
OneSampleNormal2.Design(list(1,0,0), nmin = 10, nmax = 100, mu0 = 100, mu1 = 95,
                        var0=225, var=225, d = 0, ps = 0.95, pf = 0.05,
                        power = 0.8, t1error = 0.05, alternative = "less",
                        seed = 202210, sim = 10)

One sample Poisson model

Description

For a given planned sample size, the efficacy and futility boundaries, return the power, the type I error, the expected sample size and its standard deviation, the probability of reaching the efficacy and futility boundaries.

Usage

OneSamplePoisson(
  prior,
  N = 100,
  m0,
  m1,
  d = 0,
  ps = 0.95,
  pf = 0.05,
  alternative = c("less", "greater"),
  seed = 202209,
  sim = 5000
)

Arguments

prior

A list of length 3 containing the distributional information of the prior. The first element is a number specifying the type of prior. Options are

  1. DIP ;

  2. Gamma(a,b), where a = shape, b = rate

The second and third elements of the list are the parameters a and b, respectively.

N

The planned sample size.

m0

The null event rate, which could be taken as the standard or current event rate.

m1

The event rate of the new treatment.

d

The target improvement (minimal clinically meaningful difference).

ps

The efficacy boundary (upper boundary).

pf

The futility boundary (lower boundary).

alternative

less (lower values imply greater efficacy) or greater (larger values imply greater efficacy).

seed

The seed for simulations.

sim

The number of simulations.

Value

A list of the arguments with method and computed elements

Examples

# with traditional Bayesian prior Gamma(0.5,0.001)
OneSamplePoisson(list(2,0.5,0.001), N = 100, m0 = 0.5, m1 = 0.4, d = 0.05,
                 ps = 0.95, pf = 0.05, alternative = "less",
                 seed = 202210, sim = 10)
# with DIP
OneSamplePoisson(list(1,0,0), N = 100, m0 = 0.5, m1 = 0.4, d = 0.05,
                 ps = 0.95, pf = 0.05, alternative = "less",
                 seed = 202210, sim = 10)

One sample Poisson model - Trial Design

Description

Calculate the minimum planned sample size under an admissible design. The users decide the power and type-I-error, and pick the efficacy and futility boundaries. If there are no admissible design based on controlled type-I-error, then default to output the designs with the lowest type-I-error and at least the user-defined (e.g. 80%) power.

Usage

OneSamplePoisson.Design(
  prior,
  nmin = 10,
  nmax = 100,
  m0,
  m1,
  d = 0,
  ps,
  pf,
  power = 0.8,
  t1error = 0.05,
  alternative = c("less", "greater"),
  seed = 202209,
  sim = 1000
)

Arguments

prior

A list of length 3 containing the distributional information of the prior. The first element is a number specifying the type of prior. Options are

  1. DIP ;

  2. Gamma(a,b), where a = shape, b = rate

The second and third elements of the list are the parameters a and b, respectively.

nmin

The start searching sample size

nmax

The stop searching sample size

m0

The null event rate, which could be taken as the standard or current event rate.

m1

The event rate of the new treatment.

d

The target improvement (minimal clinically meaningful difference).

ps

The efficacy boundary (upper boundary).

pf

The futility boundary (lower boundary).

power

The expected power to achieve.

t1error

The controlled type-I-error.

alternative

less (lower values imply greater efficacy) or greater (larger values imply greater efficacy).

seed

The seed for simulations.

sim

The number of simulations.

Value

A list of the arguments with method and computed elements

Examples

# with traditional Bayesian prior Gamma(0.5,0.001)
OneSamplePoisson.Design(list(2,0.5,0.001), nmin = 10, nmax=100, m0 = 5, m1 = 4, d = 0,
                   ps = 0.95, pf = 0.05, power = 0.80, t1error=0.05, alternative = "less",
                   seed = 202210, sim = 10)
# with DIP
OneSamplePoisson.Design(list(1,0,0), nmin = 10, nmax=100, m0 = 5, m1 = 4, d = 0,
                   ps = 0.95, pf = 0.05, power = 0.80, t1error=0.05, alternative = "less",
                   seed = 202210, sim = 10)

Two sample Bernoulli model

Description

For a given planned sample size, the efficacy and futility boundaries, return the power, the type I error, the expected sample size and its standard deviation, the probability of reaching the efficacy and futility boundaries. Equal allocation between two treatment groups.

Usage

TwoSampleBernoulli(
  prior,
  N = 200,
  p1,
  p2,
  d = 0,
  ps = 0.95,
  pf = 0.05,
  alternative = c("less", "greater"),
  seed = 202209,
  sim = 5000
)

Arguments

prior

A list of length 3 containing the distributional information of the prior. The first element is a number specifying the type of prior. Options are

  1. DIP ;

  2. Beta(a,b), where a = shape, b = scale

The second and third elements of the list are the parameters a and b, respectively.

N

The total planned sample size for two treatment groups.

p1

The response rate of the new treatment.

p2

The response rate of the compared treatment.

d

The target improvement (minimal clinically meaningful difference).

ps

The efficacy boundary (upper boundary).

pf

The futility boundary (lower boundary).

alternative

less (lower values imply greater efficacy) or greater (larger values imply greater efficacy).

seed

The seed for simulations.

sim

The number of simulations.

Value

A list of the arguments with method and computed elements

Examples

# with traditional Bayesian prior Beta(1,1)
TwoSampleBernoulli(list(2,1,1), N = 200, p1 = 0.5, p2 = 0.3, d = 0,
                   ps = 0.90, pf = 0.05, alternative = "greater",
                   seed = 202210, sim = 5)
# with DIP
TwoSampleBernoulli(list(1,0,0), N = 200, p1 = 0.5, p2 = 0.3, d = 0,
                   ps = 0.90, pf = 0.05, alternative = "greater",
                   seed = 202210, sim = 5)

Two sample Bernoulli model - Trial Design

Description

Calculate the minimum planned sample size under an admissible design. The users decide the power and type-I-error, and pick the efficacy and futility boundaries. If there are no admissible design based on controlled type-I-error, then default to output the designs with the lowest type-I-error and at least the user-defined (e.g. 80%) power.

Usage

TwoSampleBernoulli.Design(
  prior,
  nmin = 10,
  nmax = 200,
  p1,
  p2,
  d = 0,
  ps = 0.95,
  pf = 0.05,
  power = 0.8,
  t1error = 0.05,
  alternative = c("less", "greater"),
  seed = 202209,
  sim = 500
)

Arguments

prior

A list of length 3 containing the distributional information of the prior. The first element is a number specifying the type of prior. Options are

  1. DIP ;

  2. Beta(a,b), where a = shape, b = scale

The second and third elements of the list are the parameters a and b, respectively.

nmin

The start searching total sample size for two treatment groups.

nmax

The stop searching total sample size for two treatment groups.

p1

The response rate of the new treatment.

p2

The response rate of the compared treatment.

d

The target improvement (minimal clinically meaningful difference).

ps

The efficacy boundary (upper boundary).

pf

The futility boundary (lower boundary).

power

The power to achieve.

t1error

The controlled type-I-error.

alternative

less (lower values imply greater efficacy) or greater (larger values imply greater efficacy).

seed

The seed for simulations.

sim

The number of simulations.

Value

A list of the arguments with method and computed elements

Examples

# with traditional Bayesian prior Beta(1,1)
TwoSampleBernoulli.Design(list(2,1,1), nmin = 100, nmax = 120, p1 = 0.5, p2 = 0.3, d = 0,
                   ps = 0.90, pf = 0.05, power = 0.8, t1error = 0.05, alternative = "greater",
                   seed = 202210, sim = 10)
# with DIP
TwoSampleBernoulli.Design(list(1,0,0), nmin = 100, nmax = 120, p1 = 0.5, p2 = 0.3, d = 0,
                   ps = 0.90, pf = 0.05, power = 0.8, t1error = 0.05, alternative = "greater",
                   seed = 202210, sim = 10)