diff --git a/DESCRIPTION b/DESCRIPTION index 66a77bc..13cb2e5 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,3 +19,6 @@ Maintainer: Venkatraman E. Seshan License: GPL (>= 2) NeedsCompilation: yes VignetteBuilder: knitr +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.2.3 +Encoding: UTF-8 diff --git a/R/ph2simon.R b/R/ph2simon.R index 82dba4e..8884a0b 100755 --- a/R/ph2simon.R +++ b/R/ph2simon.R @@ -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 @@ -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 @@ -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) diff --git a/man/ph2simon.Rd b/man/ph2simon.Rd old mode 100755 new mode 100644 index a7c02ce..6d89a5f --- a/man/ph2simon.Rd +++ b/man/ph2simon.Rd @@ -1,62 +1,67 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ph2simon.R \name{ph2simon} -\title{Simon's 2-stage Phase II design} \alias{ph2simon} \alias{print.ph2simon} \alias{plot.ph2simon} -\keyword{design} -\description{ - Calculates Optimal and Minimax 2-stage Phase II designs given by - Richard Simon -} +\title{Simon's 2-stage Phase II design} \usage{ -ph2simon(pu, pa, ep1, ep2, nmax=100) -\method{print}{ph2simon}(x, \dots) -\method{plot}{ph2simon}(x, \dots) +ph2simon(pu, pa, ep1, ep2, nmax = 100) + +\method{print}{ph2simon}(x, ...) + +\method{plot}{ph2simon}(x, ...) } \arguments{ - \item{pu}{unacceptable response rate} - \item{pa}{response rate that is desirable} - \item{ep1}{threshold for the probability of declaring drug desirable - under p0} - \item{ep2}{threshold for the probability of rejecting the drug under - p1} - \item{nmax}{maximum total sample size (default 100; can be at most - 500)} - \item{x}{object returned by ph2simon} - \item{...}{arguments to be passed onto plot and print commands called - within} +\item{pu}{unacceptable response rate} + +\item{pa}{response rate that is desirable} + +\item{ep1}{threshold for the probability of declaring drug desirable under +p0} + +\item{ep2}{threshold for the probability of rejecting the drug under p1} + +\item{nmax}{maximum total sample size (default 100; can be at most 500)} + +\item{x}{object returned by ph2simon} + +\item{...}{arguments to be passed onto plot and print commands called within} } \value{ - 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)} +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. +Trial is stopped early if <= r1 responses are seen in the first stage and +treatment is considered desirable only when >r responses seen. - The "print" method formats and returns the minimax and optimal - designs. The "plot" plots the expected sample size agains the maximum - sample size as in Jung et al., 2001 +Plots the expected sample size against the maximum sample size as in +Jung et al., 2001 } - -\seealso{ - \code{\link{twostage.inference}}, \code{\link{oc.twostage.bdry}} +\description{ +Calculates Optimal and Minimax 2-stage Phase II designs given by Richard +Simon } - \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) -} -\references{ - Simon R. (1989). Optimal Two-Stage Designs for Phase II Clinical - Trials. \emph{Controlled Clinical Trials} 10, 1-10. +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) + +ex <- ph2simon(0.2, 0.4, 0.1, 0.1) +plot(ex) - 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. } +\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. +} +\seealso{ +\link{twostage.inference} \link{oc.twostage.bdry} +} +\concept{ph2simon} \keyword{design}