Title: | Mander and Thompson Designs |
---|---|
Description: | Implements Mander & Thompson's (2010) <doi:10.1016/j.cct.2010.07.008> methods for two-stage designs optimal under the alternative hypothesis for phase II [cancer] trials. Also provides an implementation of Simon's (1989) <doi:10.1016/0197-2456(89)90015-9> original methodology and allows exploration of the operating characteristics of sub-optimal designs. |
Authors: | John Kirkpatrick [aut, cre] |
Maintainer: | John Kirkpatrick <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.2 |
Built: | 2024-11-05 12:24:03 UTC |
Source: | https://github.com/openpharma/mtdesign |
Augment a grid of candidate designs with type 1 and type 2 error probabilities, expected sample sizes and probabilities of early termination
augmentGrid(d, parallel = TRUE, cores = NA, minChunkSize = 1e+05)
augmentGrid(d, parallel = TRUE, cores = NA, minChunkSize = 1e+05)
d |
a tibble created by 'createGrid' |
parallel |
use parallelisation if available |
cores |
the number of cores to use when parallelising. If <code>NA</code>, all available cores are requested |
minChunkSize |
The minimum size of the grid before paralellisation is attempted |
an augmented grid tibble
Regardless of the value of 'parallel', parallelisation is only used if the size of the grid is greater than <code>chunkSize</code>. If paralellisation is requested and needed, an exception is thrown if the parallel package is not available.
x <- createGrid(p0 = 0.1, p1 = 0.30, alpha = 0.1, beta = 0.1, nMin = 24, nMax = 32) %>% augmentGrid(parallel = FALSE)
x <- createGrid(p0 = 0.1, p1 = 0.30, alpha = 0.1, beta = 0.1, nMin = 24, nMax = 32) %>% augmentGrid(parallel = FALSE)
Create a grid of candidate designs
createGrid( p0, p1, alpha = 0.1, beta = NA, power = ifelse(is.na(beta), 0.9, 1 - beta), nMin = NA, nMax = NA, mander = TRUE )
createGrid( p0, p1, alpha = 0.1, beta = NA, power = ifelse(is.na(beta), 0.9, 1 - beta), nMin = NA, nMax = NA, mander = TRUE )
p0 |
the response rate under the null hypothesis |
p1 |
the response rate under the alternate hypothesis |
alpha |
the desired (one-sided) type 1 error rate |
beta |
the desired type 2 error rate |
power |
an alternative to |
nMin |
the lower bound for the search grid. If |
nMax |
the lower bound for the search grid. If |
mander |
is a Mander & Thompson or a Simon's design required? |
a tibble. See Usage notes for a list and description of columns.
# Standard use for a Simon's 2-stage design x <- createGrid(p0 = 0.1, p1 = 0.5, alpha = 0.1, beta = 0.1, mander = FALSE) # Custom search bounds for a Mander & Thompson design y <- createGrid(p0 = 0.1, p1 = 0.4, alpha = 0.1, beta = 0.1, nMin = 20, nMax = 30)
# Standard use for a Simon's 2-stage design x <- createGrid(p0 = 0.1, p1 = 0.5, alpha = 0.1, beta = 0.1, mander = FALSE) # Custom search bounds for a Mander & Thompson design y <- createGrid(p0 = 0.1, p1 = 0.4, alpha = 0.1, beta = 0.1, nMin = 20, nMax = 30)
obtainDesign
is essentially a wrapper for calls to
createGrid
and augmentGrid
followed by some
simple filtering of the candidate designs to identify the optimal and
minimax designs.
obtainDesign( grid = NULL, p0 = NA, p1 = NA, alpha = ifelse(is.null(grid), 0.05, NA), beta = ifelse(is.null(grid), 0.1, NA), fullGrid = FALSE, ... )
obtainDesign( grid = NULL, p0 = NA, p1 = NA, alpha = ifelse(is.null(grid), 0.05, NA), beta = ifelse(is.null(grid), 0.1, NA), fullGrid = FALSE, ... )
grid |
Optional. A tibble created by |
p0 |
the response rate under the null hypothesis |
p1 |
the response rate under the alternate hypothesis |
alpha |
the desired (one-sided) type 1 error rate |
beta |
the desired type 2 error rate |
fullGrid |
should the full grid of all possible designs be returned, or simply the optimal and minimax solutions? For a Mander and Thompson design, optimal and minimax designs are returned for both the null and alternate hypotheses. See Usage Notes below. |
... |
passed to 'createGrid' or 'augmentGrid'. In particular
|
a tibble created by createGrid
. If
fullGrid == FALSE
the table contains an additional column,
Criterion
indicating the type of design. Possible values for
Criterion
are "optimal" and "minimax" for Simon's designs and
"optimalNull", "optimalAlt", "minimaxNull" and "minimaxAlt" for Mander &
Thompson designs.
If grid
is not NULL
it is possible that none of the candidate
designs are acceptable (that is, satisfy both the significance level and
power requirements). If this is the case and fullGrid == FALSE
, then
an empty tibble is returned. If versbose == TRUE
a warning message is
also printed.
If fullGrid == TRUE
the full grid of all designs considered is
returned. This can then be further interrogated to find optimal designs
under constraints - for example with fixed stage sizes.
# Standard use (Simon's 2-stage design) createGrid(p0 = 0.05, p1 = 0.25, alpha = 0.05, beta = 0.2, mander = FALSE) %>% augmentGrid(parallel = FALSE) %>% obtainDesign() # Constrained stage sizes createGrid(p0 = 0.25, p1 = 0.45, alpha = 0.05, beta = 0.2) %>% dplyr::filter(nStage1 == 8) %>% augmentGrid(parallel = FALSE) %>% obtainDesign()
# Standard use (Simon's 2-stage design) createGrid(p0 = 0.05, p1 = 0.25, alpha = 0.05, beta = 0.2, mander = FALSE) %>% augmentGrid(parallel = FALSE) %>% obtainDesign() # Constrained stage sizes createGrid(p0 = 0.25, p1 = 0.45, alpha = 0.05, beta = 0.2) %>% dplyr::filter(nStage1 == 8) %>% augmentGrid(parallel = FALSE) %>% obtainDesign()
Plot the power curve(s) for the given design(s)
powerPlot(grid, probs = seq(0, 1, 0.01))
powerPlot(grid, probs = seq(0, 1, 0.01))
grid |
the tibble containing the designs to be plotted |
probs |
the response rates for which the rejection probabilities are to be plotted |
the ggplot object containing the power curve(s)
createGrid(p0 = 0.05, p1 = 0.25, alpha = 0.05, beta = 0.2, mander = FALSE) %>% augmentGrid(cores = 2) %>% obtainDesign() %>% powerPlot(probs = seq(0, 0.5, 0.025))
createGrid(p0 = 0.05, p1 = 0.25, alpha = 0.05, beta = 0.2, mander = FALSE) %>% augmentGrid(cores = 2) %>% obtainDesign() %>% powerPlot(probs = seq(0, 0.5, 0.025))
The formula used is the continuity corrected Normal approximation from Fleiss et al (2003).
searchBounds(p0, p1, alpha = 0.05, beta = 0.2, twoSided = TRUE)
searchBounds(p0, p1, alpha = 0.05, beta = 0.2, twoSided = TRUE)
p0 |
the response rate under the null hypothesis |
p1 |
the response rate under the alternate hypothesis |
alpha |
the desired (one-sided) type 1 error rate |
beta |
the desired type 2 error rate |
twoSided |
two- or one-sided significance level? |
a list with three elements: "n" - the single stage sample size from
Fleiss et al; "min" - the lower bound, 0.8*n; "max" - the upper bound, 2*n.
floor()
and ceiling()
are applied as appropriate.