ahern | R Documentation |
Function to implement exact single-stage phase II design a-la AHern
ahern(p0, p1, alpha = 0.05, beta = 0.2, sample_sizes = 1:2000)
p0 |
response probability used in the definition of the null hypothesis |
p1 |
desirable response probability at which the trial is powered |
alpha |
type I error (default 0.05) |
beta |
type II error (default 0.2) |
sample_sizes |
checked sample sizes, should be enough for most situations |
A'Hern, Sample size tables for exact single-stage phase II designs, Statist. Med. 2001; 20:859–866
# simple example
ahern(p0 = 0.05, p1 = 0.1)
# A'Hern's number validation
probs <- seq(0.05, 0.95, by = 0.05)
analyses <- expand.grid(p0 = probs, p1 = probs,
alpha = c(0.05, 0.01), beta = c(0.2, 0.1))
select <- with(analyses, p1 > p0)
analyses <- analyses[select, ]
ord <- with(analyses, order(p0, p1, -alpha, -beta))
analyses <- analyses[ord, ]
rownames(analyses) <- NULL
res <- apply(analyses, 1, function(x)
ahern(p0 = x[1], p1 = x[2], alpha = x[3], beta = x[4]))
res <- do.call(rbind, res)
rownames(res) <- NULL
res$pp <- with(res, paste(cutoffs, sample_size, sep = '/'))
res$sample_size <- NULL
res$cutoffs <- NULL
res_spl <- split(res, res$p0)
## sink('ahern_validation.txt')
## res_spl
## sink()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.