ahern: Function to implement exact single-stage phase II design a-la...

View source: R/phase2.R

ahernR Documentation

Function to implement exact single-stage phase II design a-la AHern

Description

Function to implement exact single-stage phase II design a-la AHern

Usage

ahern(p0, p1, alpha = 0.05, beta = 0.2, sample_sizes = 1:2000)

Arguments

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

References

A'Hern, Sample size tables for exact single-stage phase II designs, Statist. Med. 2001; 20:859–866

Examples

# 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()


lbraglia/lbss documentation built on Jan. 31, 2025, 10:18 p.m.