% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RcppExports.R
\name{getADCI}
\alias{getADCI}
\title{Confidence Interval After Adaptation}
\usage{
getADCI(
  L = NA_integer_,
  zL = NA_real_,
  IMax = NA_real_,
  kMax = NA_integer_,
  informationRates = NA_real_,
  efficacyStopping = NA_integer_,
  criticalValues = NA_real_,
  alpha = 0.25,
  typeAlphaSpending = "sfOF",
  parameterAlphaSpending = NA_real_,
  spendingTime = NA_real_,
  MullerSchafer = FALSE,
  Lc = NA_integer_,
  zLc = NA_real_,
  INew = NA_real_,
  informationRatesNew = NA_real_,
  efficacyStoppingNew = NA_integer_,
  typeAlphaSpendingNew = "sfOF",
  parameterAlphaSpendingNew = NA_real_,
  spendingTimeNew = NA_real_
)
}
\arguments{
\item{L}{The interim adaptation look of the primary trial.}

\item{zL}{The z-test statistic at the interim adaptation look of
the primary trial.}

\item{IMax}{The maximum information of the primary trial.}

\item{kMax}{The maximum number of stages of the primary trial.}

\item{informationRates}{The information rates of the primary trial.}

\item{efficacyStopping}{Indicators of whether efficacy stopping is
allowed at each stage of the primary trial. Defaults to true
if left unspecified.}

\item{criticalValues}{The upper boundaries on the z-test statistic scale
for efficacy stopping for the primary trial.}

\item{alpha}{The significance level of the primary trial.
Defaults to 0.025.}

\item{typeAlphaSpending}{The type of alpha spending for the primary
trial. One of the following:
\code{"OF"} for O'Brien-Fleming boundaries,
\code{"P"} for Pocock boundaries,
\code{"WT"} for Wang & Tsiatis boundaries,
\code{"sfOF"} for O'Brien-Fleming type spending function,
\code{"sfP"} for Pocock type spending function,
\code{"sfKD"} for Kim & DeMets spending function,
\code{"sfHSD"} for Hwang, Shi & DeCani spending function, and
\code{"none"} for no early efficacy stopping.
Defaults to \code{"sfOF"}.}

\item{parameterAlphaSpending}{The parameter value of alpha spending
for the primary trial. Corresponds to \eqn{\Delta} for \code{"WT"},
\eqn{\rho} for \code{"sfKD"}, and \eqn{\gamma} for \code{"sfHSD"}.}

\item{spendingTime}{The error spending time of the primary trial.
Defaults to missing, in which case, it is the same as
\code{informationRates}.}

\item{MullerSchafer}{Whether to use the Muller and Schafer (2001) method
for trial adaptation.}

\item{Lc}{The termination look of the integrated trial.}

\item{zLc}{The z-test statistic at the termination look of the
integrated trial.}

\item{INew}{The maximum information of the secondary trial.}

\item{informationRatesNew}{The spacing of looks of the secondary trial
up to look \code{L2}.}

\item{efficacyStoppingNew}{The indicators of whether efficacy stopping is
allowed at each look of the secondary trial up to look \code{L2}.
Defaults to true if left unspecified.}

\item{typeAlphaSpendingNew}{The type of alpha spending for the secondary
trial. One of the following:
\code{"OF"} for O'Brien-Fleming boundaries,
\code{"P"} for Pocock boundaries,
\code{"WT"} for Wang & Tsiatis boundaries,
\code{"sfOF"} for O'Brien-Fleming type spending function,
\code{"sfP"} for Pocock type spending function,
\code{"sfKD"} for Kim & DeMets spending function,
\code{"sfHSD"} for Hwang, Shi & DeCani spending function, and
\code{"none"} for no early efficacy stopping.
Defaults to \code{"sfOF"}.}

\item{parameterAlphaSpendingNew}{The parameter value of alpha spending
for the secondary trial. Corresponds to \eqn{\Delta} for \code{"WT"},
\eqn{\rho} for \code{"sfKD"}, and \eqn{\gamma} for \code{"sfHSD"}.}

\item{spendingTimeNew}{The error spending time of the secondary trial
up to look \code{L2}. Defaults to missing, in which case, it is
the same as \code{informationRatesNew}.}
}
\value{
A data frame with the following variables:
\itemize{
\item \code{pvalue}: p-value for rejecting the null hypothesis.
\item \code{thetahat}: Median unbiased point estimate of the parameter.
\item \code{cilevel}: Confidence interval level.
\item \code{lower}: Lower bound of confidence interval.
\item \code{upper}: Upper bound of confidence interval.
}
}
\description{
Obtains the p-value, median unbiased point estimate, and
confidence interval after the end of an adaptive trial.
}
\details{
If \code{typeAlphaSpendingNew} is \code{"OF"}, \code{"P"}, \code{"WT"}, or
\code{"none"}, then \code{informationRatesNew}, \code{efficacyStoppingNew},
and \code{spendingTimeNew} must be of full length \code{kNew}, and
\code{informationRatesNew} and \code{spendingTimeNew} must end with 1.
}
\examples{
# two-arm randomized clinical trial with a normally distributed endpoint
# 90\% power to detect mean difference of 15 with a standard deviation of 50
# Design the Stage I Trial with 3 looks and Lan-DeMets O'Brien-Fleming type
# spending function
delta <- 15
sigma <- 50

(des1 <- getDesignMeanDiff(
  beta = 0.1, meanDiff = delta, stDev = sigma,
  kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF"
))

s1 <- des1$byStageResults$informationRates
b1 <- des1$byStageResults$efficacyBounds
n <- des1$overallResults$numberOfSubjects

# Monitoring the Stage I Trial
L <- 1
nL <- des1$byStageResults$numberOfSubjects[L]
deltahat <- 8
sigmahat <- 55
sedeltahat <- sigmahat * sqrt( 4 / nL)
zL <- deltahat / sedeltahat

# Making an Adaptive Change: Stage I to Stage II
# revised clinically meaningful difference downward to 10 power the study
# retain the standard deviation at the design stage
# Muller & Schafer (2001) method to design the secondary trial
# with 2 looks and Lan-DeMets Pocock type spending function
# re-estimate sample size to reach 90\% conditional power
deltaNew <- 10

(des2 <- adaptDesign(
  betaNew = 0.1, L = L, zL = zL, theta = deltaNew,
  IMax = n / (4 * sigma^2), kMax = 3, informationRates = s1,
  alpha = 0.025, typeAlphaSpending = "sfOF",
  MullerSchafer = TRUE, kNew = 2, typeAlphaSpendingNew = "sfP"
))

INew <- des2$secondaryTrial$maxInformation
(nNew <- ceiling(INew * 4 * sigma^2))
(nTotal <- nL + nNew)

# Monitoring the Integrated Trial
s2 <- des2$secondaryTrial$informationRates

Lc <- 2
deltahatc <- 9.5
sigmahatc <- 52.759
L2 <- Lc - L
nL2 <-  nNew * s2[L2]
nc <- nL + nL2
sedeltahatc <- sigmahatc * sqrt(4 / nc)
zLc <- deltahatc / sedeltahatc
zL2 <- (zLc * sqrt(nc) - zL * sqrt(nL)) / sqrt(nL2)

getADCI(
  L = L, zL = zL, IMax = n / (4 * sigmahatc^2), kMax = 3,
  informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF",
  MullerSchafer = TRUE, Lc = Lc, zLc = zLc,
  INew = nNew / (4 * sigmahatc^2), informationRatesNew = s2,
  typeAlphaSpendingNew = "sfP")

}
\references{
Ping Gao, Lingyun Liu and Cyrus Mehta.
Exact inference for adaptive group sequential designs.
Stat Med. 2013;32(23):3991-4005.
}
\seealso{
\code{\link{adaptDesign}}
}
\author{
Kaifeng Lu, \email{kaifenglu@gmail.com}
}
