Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ Maintainer: Venkatraman E. Seshan <seshanv@mskcc.org>
License: GPL (>= 2)
NeedsCompilation: yes
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Encoding: UTF-8
50 changes: 50 additions & 0 deletions R/ph2simon.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
#' Simon's 2-stage Phase II design
#'
#' Calculates Optimal and Minimax 2-stage Phase II designs given by Richard
#' Simon
#'
#' @param pu unacceptable response rate
#' @param pa response rate that is desirable
#' @param ep1 threshold for the probability of declaring drug desirable under
#' p0
#' @param ep2 threshold for the probability of rejecting the drug under p1
#' @param nmax maximum total sample size (default 100; can be at most 500)
#' @return `ph2simon()` returns a list with pu, pa, alpha, beta and nmax as above
#' and: \item{out}{matrix of best 2 stage designs for each value of total
#' sample size n. the 6 columns are: r1, n1, r, n, EN(p0), PET(p0)}
#'
#' Trial is stopped early if <= r1 responses are seen in the first stage and
#' treatment is considered desirable only when >r responses seen.
#'
#'
#' @seealso [twostage.inference] [oc.twostage.bdry]
#' @family ph2simon
#' @references Simon R. (1989). Optimal Two-Stage Designs for Phase II
#' Clinical Trials. \emph{Controlled Clinical Trials} 10, 1-10.
#'
#' Jung SH, Carey M and Kim KM. (2001). Graphical Search for Two-Stage Designs
#' for Phase II Clinical Trials. \emph{Controlled Clinical Trials} 22, 367-372.
#' @keywords design design
#' @examples
#'
#' ph2simon(0.2, 0.4, 0.1, 0.1)
#' ph2simon(0.2, 0.35, 0.05, 0.05)
#' ph2simon(0.2, 0.35, 0.05, 0.05, nmax=150)
#'
ph2simon <- function(pu, pa, ep1, ep2, nmax = 100) {
if(nmax > 1000) stop("nmax cannot exceed 1000")
nmax1 <- nmax + 1
Expand Down Expand Up @@ -46,6 +79,8 @@ ph2simon <- function(pu, pa, ep1, ep2, nmax = 100) {
ph2
}

#' @rdname ph2simon
#' @export
print.ph2simon <- function(x, ...) {
xout <- x$out
nmax <- x$nmax
Expand All @@ -62,6 +97,21 @@ print.ph2simon <- function(x, ...) {
if(xopt[1,4]>nmax-10) warning(paste(" Optimal sample size too close to nmax. \n Try increasing nmax (current value = ",nmax,")\n",sep=""))
}

#' Plots `ph2simon` object
#'
#' @param x object returned by ph2simon
#' @param ... arguments to be passed onto plot and print commands called within
#'
#' @return `plot.ph2simon()` returns a plot with the expected sample size against the maximum sample size as in
#' Jung et al., 2001
#' @family ph2simon
#' @rdname ph2simon
#' @export
#'
#' @examples
#' ex <- ph2simon(0.2, 0.4, 0.1, 0.1)
#' plot(ex)
#'
plot.ph2simon <- function(x, ...) {
xout <- x$out
n <- nrow(xout)
Expand Down
91 changes: 48 additions & 43 deletions man/ph2simon.Rd
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.