% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/opt.design.R
\name{opt.design}
\alias{opt.design}
\title{Zhong's 2- or 3-stage Phase II design}
\usage{
opt.design(
  alpha1,
  alpha2,
  beta,
  pc,
  pe,
  stage = 2,
  stop.eff = FALSE,
  frac_n1 = NULL,
  frac_n2 = NULL,
  sf.param = NULL,
  show = FALSE,
  nmax = 100,
  n.choice = 1,
  ...
)
}
\arguments{
\item{alpha1}{Left-side overall type I error.}

\item{alpha2}{right-side overall type I error.}

\item{beta}{Type II error.}

\item{pc}{A numeric vector of response rates. It should have length 1 or 2.}

\item{pe}{Alternative hypothesis response rate.}

\item{stage}{Either 2 or 3. Defaults to 2.}

\item{stop.eff}{Logical; if \code{TRUE}, the trial may stop early for
efficacy at an interim analysis.}

\item{frac_n1}{Proportion range for \code{n1}. For a two-stage design, the
default is \code{c(0.3, 0.6)}. For a three-stage design, the default is
\code{c(0.2, 0.3)}.}

\item{frac_n2}{Proportion range for \code{n2}. Used only for three-stage
designs. Defaults to \code{c(0.2, 0.4)}.}

\item{sf.param}{A single real value specifying the gamma parameter for the
Hwang-Shih-DeCani spending function. The allowable range is [-40, 40].
Larger values spend more error early and leave less for later stages. For
two-stage designs, the default is \code{NULL} (no alpha-spending). For
three-stage designs, the default is 4.}

\item{show}{Logical; if \code{TRUE}, the current total sample size is printed
during the search.}

\item{nmax}{Maximum sample size. Defaults to 100.}

\item{n.choice}{Stopping criterion for the search over feasible designs. The
search stops once the number of designs exceeds \code{n.choice}.}

\item{...}{Unused arguments.}
}
\value{
An object of class \code{"opt.design"}, returned as a list
  containing:
  \item{bdry}{The rejection boundaries.}
  \item{error}{The true type I and type II errors.}
  \item{n}{The sample size at each stage.}
  \item{complete}{The complete list of feasible designs.}
  \item{alpha1}{The input left-side type I error.}
  \item{alpha2}{The input right-side type I error.}
  \item{beta}{The input type II error.}
  \item{pc}{The input response-rate vector.}
  \item{pe}{The input alternative response rate.}
  \item{sf.param}{The input alpha-spending parameter.}
  \item{stage}{The number of stages in the selected design.}
}
\description{
Calculate the optimal 2- or 3-stage design proposed by Bob
  Zhong.
}
\details{
In the two-stage design, \code{n1} patients are treated in the
  first stage. At the end of stage 1, the trial either continues to stage 2
  or stops early for inefficacy, depending on the number of observed
  responses. If the trial continues, an additional \code{n2} patients are
  treated. The three-stage design extends the two-stage design by adding one
  interim stage between stages 1 and 2. The left-side rejection region is
  defined by \code{response <= r_i} for \code{i = 1, 2, 3}, and the
  right-side rejection region is defined by \code{response > s}. An
  alpha-spending method is available for both two- and three-stage designs.
  \code{opt.design} uses the Hwang-Shih-DeCani spending function; you can
  change the definition of \code{HSD} to use a different spending function.
}
\examples{
 alpha1 <- 0.15
 alpha2 <- 0.10
 beta <- 0.15
 pc <- 0.25
 pe <- pc + 0.20
 # calculate optimal two-stage design without using alpha-spending
 opt.design(alpha1, alpha2, beta, pc, pe, stage=2)
 
 # calculate optimal two-stage design with Pocock-like spending function 
 opt.design(alpha1, alpha2, beta, pc, pe, stage = 2, sf.param = 1)
 
 # calculate optimal three-stage design with an O'Brien-Fleming-like spending function
 opt.design(alpha1, alpha2, beta, pc, pe, stage = 3, sf.param = -4)
}
\references{
Zhong. (2012) Single-arm Phase IIA clinical trials with go/no-go decisions. \emph{Contemporary Clinical Trials}, \bold{33}, 1272--1279.
}
\author{
Wenchuan Guo <wguo1017@gmail.com>, Jianan Hui <jiananhuistat@gmail.com>
}
