% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bfboinet_rp2.R
\name{get.oc.backboinet_rp2}
\alias{get.oc.backboinet_rp2}
\title{bfboinet_rp2}
\usage{
get.oc.backboinet_rp2(
  target_T = 0.3,
  toxprob,
  target_E = 0.25,
  effprob,
  n.dose,
  startdose,
  ncohort,
  cohortsize,
  pT.saf = 0.6 * target_T,
  pT.tox = 1.4 * target_T,
  pE.saf = 0.6 * target_E,
  alpha.T1 = 0.5,
  alpha.E1 = 0.5,
  tau.T,
  tau.E,
  te.corr = 0.2,
  gen.event.time = "weibull",
  accrual,
  gen.enroll.time = "uniform",
  n.elimination = 6,
  stopping.npts = 12,
  suspend = 0,
  stopping.prob.T = 0.95,
  stopping.prob.E = 0.9,
  Nesc = 36,
  boundMTD = FALSE,
  estpt.method,
  obd.method,
  w1 = 0.33,
  w2 = 1.09,
  plow.ast = pT.saf,
  pupp.ast = pT.tox,
  qlow.ast = pE.saf/2,
  qupp.ast = target_E,
  stage1.method,
  H0,
  H1,
  nIA.sample,
  nIA = length(nIA.sample),
  method = "power",
  t1e_optimal_pars,
  lambda1_optimal_pars,
  lambda2_optimal_pars,
  grid1_optimal_pars,
  gamma1_optimal_pars,
  gamma2_optimal_pars,
  grid2_optimal_pars,
  eta1_optimal_pars,
  eta2_optimal_pars,
  grid3_optimal_pars,
  ppsi01 = 0,
  ppsi00 = 40,
  ppsi11 = 60,
  ppsi10 = 100,
  n.sim = 1000,
  seed.sim = 100
)
}
\arguments{
\item{target_T}{Target toxicity probability. The default value is
\code{target_T=0.3}. When observing 1 DLT out of 3 patients and the target
DLT rate is between 0.25 and 0.279, the decision is to stay at the current
dose due to a widely accepted practice.}

\item{toxprob}{Vector of true toxicity probability.}

\item{target_E}{The minimum required efficacy probability. The default value
is \code{target_E=0.25}.}

\item{effprob}{Vector of true efficacy probability.}

\item{n.dose}{Number of dose for stage 1.}

\item{startdose}{Starting dose. The lowest dose is generally recommended.}

\item{ncohort}{Number of cohort for stage 1.}

\item{cohortsize}{Cohort size for stage 1.}

\item{pT.saf}{Highest toxicity probability that is deemed sub-therapeutic
such that dose-escalation should be pursued. The default value is
\code{pT.saf=target_T*0.6}.}

\item{pT.tox}{Lowest toxicity probability that is deemed overly toxic such
that dose de-escalation is needed. The default value is
\code{pT.tox=target_T*1.4}.}

\item{pE.saf}{Minimum probability deemed efficacious such that the dose
levels with less than delta1 are considered sub-therapeutic.
The default value is \code{pE.saf=target_E*0.6}.}

\item{alpha.T1}{Probability that toxicity event occurs in the late half of
toxicity assessment window. The default value is \code{alpha.T1=0.5}.}

\item{alpha.E1}{Probability that efficacy event occurs in the late half of
assessment window. The default value is \code{alpha.E1=0.5}.}

\item{tau.T}{Toxicity assessment windows (months).}

\item{tau.E}{Efficacy assessment windows (months).}

\item{te.corr}{Correlation between toxicity and efficacy probability,
specified as Gaussian copula parameter. The default value is
\code{te.corr=0.2}.}

\item{gen.event.time}{Method to generate the time to first toxicity and
efficacy outcome. Weibull distribution is used when
\code{gen.event.time ="weibull"}. Uniform distribution is used when
\code{gen.event.time="uniform"}.
The default value is \code{gen.event.time="weibull"}.}

\item{accrual}{Accrual rate (months) (patient accrual rate per month).}

\item{gen.enroll.time}{Method to generate enrollment time. Uniform
distribution is used when
\code{gen.enroll.time="uniform"}. Exponential distribution is used when
\code{gen.enroll.time="exponential"}. The default
value is \code{gen.enroll.time="uniform"}.}

\item{n.elimination}{to avoid allocating patients to severely toxic doses,
dose elimination criteria are applied before the dose allocation decision when
n treated at the current dose reaches \code{n.elimination},it is a minimum sample
size for dose elimination.The default value is \code{n.elimination=6}.}

\item{stopping.npts}{Early study termination criteria for the number of
patients in the dose-escalation and backfill cohorts. If the number of
patients at the current dose reaches this criteria and the same dose level
is recommended as the next dose level, the study is terminated.
The default value is \code{stopping.npts=12}.}

\item{suspend}{The suspension rule that holds off the decision on dose
allocation for the dose-escalation cohort until sufficient toxicity
information is available. For example, setting as 0.33 which means one-third
of the patients had not completed the toxicity evaluation at the current dose
level in the dose escalation cohort. The default value \code{suspend=0}
essentially turns off this type of suspending rule, that is all patients
should complete the toxicity evaluation at the current dose level in the dose
escalation cohort}

\item{stopping.prob.T}{Early study termination criteria for toxicity,
taking a value between 0 and 1. If the posterior probability that toxicity
outcome is less than the target toxicity probability (\code{target_T}) is
larger than this criteria, the dose levels are eliminated from the study.
The default value is \code{stopping.prob.T=0.95}.}

\item{stopping.prob.E}{Early study termination criteria for efficacy,
taking a value between 0 and 1. If the posterior probability that efficacy
outcome is less than the minimum efficacy probability (\code{target_E}) is
larger than this criteria, the dose levels are eliminated from the study.
The default value is \code{stopping.prob.E=0.90}.}

\item{Nesc}{the total number of patients () in the dose-escalation cohort (Stage 1) reaches
the maximum total number of patients in the dose-escalation cohort (\code{Nesc}).
The default value is \code{Nesc=36}.}

\item{boundMTD}{set \code{boundMTD=TRUE} to impose the condition: the isotonic
estimate of toxicity probability for the selected MTD must be less than de-escalation
boundary. The default value is \code{boundMTD=FALSE}.}

\item{estpt.method}{Method to estimate the efficacy probability. Fractional
polynomial logistic regression is used when \code{estpt.method="fp.logistic"}.
Model averaging of multiple unimodal isotopic regression is used when
\code{estpt.method="multi.iso"}. Observed efficacy probability is used when
\code{estpt.method="obs.prob"}.}

\item{obd.method}{Method to select the optimal biological dose. Utility
defined by weighted function is used when \code{obd.method="utility.weighted"}.
Utility defined by truncated linear function is used when
\code{obd.method="utility.truncated.linear"}. Utility defined by scoring is
used when \code{obd.method="utility.scoring"}. Highest estimated efficacy
probability is used when \code{obd.method="max.effprob"}.}

\item{w1}{Weight for toxicity-efficacy trade-off in utility defined by
weighted function. This must be specified when using
\code{obd.method="utility.weighted"}. The default value is \code{w1=0.33}.}

\item{w2}{Weight for penalty imposed on toxic doses in utility defined by
weighted function. This must be specified when using
\code{obd.method="utility.weighted"}. The default value is \code{w2=1.09}.}

\item{plow.ast}{Lower threshold of toxicity linear truncated function. This
must be specified when using \code{obd.method="utility.truncated.linear"}.
The default value is \code{plow.ast=pT.saf}.}

\item{pupp.ast}{Upper threshold of toxicity linear truncated function. This
must be specified when using \code{obd.method="utility.truncated.linear"}.
The default value is \code{pupp.ast=pT.tox}.}

\item{qlow.ast}{Lower threshold of efficacy linear truncated function. This
must be specified when using \code{obd.method="utility.truncated.linear"}.
The default value is \code{qlow.ast=pE.saf/2}.}

\item{qupp.ast}{Upper threshold of efficacy linear truncated function. This
must be specified when using \code{obd.method="utility.truncated.linear"}.
The default value is \code{qupp.ast=target_E}.}

\item{stage1.method}{Method to patient assignment for backfilling patients.
Pick-the-winner is used when \code{stage1.method="PW"}. Equal randomization is
used when \code{stage1.method="ER"}.}

\item{H0}{Stage 2: A numeric value for the response rate under the null hypothesis
(toxicity - OR, no toxicity - OR, toxicity - no OR, no toxicity - No OR).}

\item{H1}{Stage 2: A numeric value for the response rate under the alternative hypothesis.}

\item{nIA.sample}{Stage 2: A numeric vector representing the additional patients enrolled at each interim analysis.
The value at index 'i' indicates the number of patients at interim analysis 'i'.
For example, for four interim analyses with total sample sizes of 10, 15, 20, and 30,
the vector would be represented as 'n = c(10, 15, 20, 30)'.}

\item{nIA}{Stage 2: A numeric value for the number of interim analysis. The default value is \code{nIA=length(nIA.sample)}.}

\item{method}{Stage 2: A character string specifying the method to use for calculating cutoff values for the efficacy stopping.
Options are "power" (default) or "OF" for "O'Brien-Fleming".}

\item{t1e_optimal_pars}{Stage 2: Desired Type - I error rate. If specified it will only return results with type I error rate less the specified value.}

\item{lambda1_optimal_pars}{Stage 2: Starting value for 'lambda' values to search.}

\item{lambda2_optimal_pars}{Stage 2: Ending value for 'lambda' values to search.}

\item{grid1_optimal_pars}{Stage 2: Number of 'lambda' values to consider between lambda1 and lambda2. A fine grid by 0.01 is recommended.}

\item{gamma1_optimal_pars}{Stage 2: Starting value for 'gamma' values to search.}

\item{gamma2_optimal_pars}{Stage 2: Ending value for 'gamma' values to search.}

\item{grid2_optimal_pars}{Stage 2: Number of 'gamma' values to consider between gamma1 and gamma2. A fine grid by 0.01 is recommended.}

\item{eta1_optimal_pars}{Stage 2: Starting value for 'eta' values to search.}

\item{eta2_optimal_pars}{Stage 2: Ending value for 'eta' values to search.}

\item{grid3_optimal_pars}{Stage 2: Number of eta values to consider between eta1 and eta2. A fine grid by 0.01 is recommended.}

\item{ppsi01}{Score for toxicity=yes and efficacy=no in utility defined by
scoring.The default value is \code{psi01=0}.}

\item{ppsi00}{Score for toxicity=no and efficacy=no in utility defined by
scoring. The default value is \code{psi00=40}.}

\item{ppsi11}{Score for toxicity=yes and efficacy=yes in utility defined by
scoring. The default value is \code{psi11=60}.}

\item{ppsi10}{Score for toxicity=no and efficacy=yes in utility defined by
scoring. The default value is \code{psi10=100}.}

\item{n.sim}{Number of simulated trial. The default value is
\code{n.sim=1000}.}

\item{seed.sim}{Seed for random number generator. The default value is
\code{seed.sim=100}.}
}
\value{
The \code{get.oc.backboinet_rp2} returns a list containing the following components:
\item{toxprob}{True toxicity probability.}
\item{effprob}{True efficacy probability.}
\item{phi}{Target toxicity probability.}
\item{delta}{Target efficacy probability.}
\item{lambda1}{Lower toxicity boundary in dose escalation/de-escalation.}
\item{lambda2}{Upper toxicity boundary in dose escalation/de-escalation.}
\item{eta1}{Lower efficacy boundary in dose escalation/de-escalation.}
\item{tau.T}{Toxicity assessment windows (months).}
\item{tau.E}{Efficacy assessment windows (months).}
\item{suspend}{The suspension rule that holds off the decision on dose
allocation for the dose-escalation cohort until sufficient toxicity
information is available.}
\item{accrual}{Accrual rate (months) (patient accrual rate per month).}
\item{n.patient.all}{Average number of patients who were treated at each dose
level at stage 1 and stage 2.}
\item{nptsdosepct.all}{The percentage of patients who were treated at each dose
level at stage 1 and stage 2.}
\item{n.tox.patient.all}{Average number of patients who experienced toxicity at each dose
level at stage 1 and stage 2.}
\item{n.eff.patient.all}{Average number of patients who experienced efficacy at each dose
level at stage 1 and stage 2.}
\item{n.patient.stage2}{Average number of patients who were treated at each dose
level at stage 2.}
\item{n.bpatient}{Average number of back filled patients who were treated
at each dose level at stage 1.}
\item{prop.select}{Percentage of times that each dose level was selected as
optimal biological dose at stage 1 and stage 2.}
\item{MTD.select}{Percentage of times that each dose level was selected as
 maximum tolerated dose at stage 1 and stage 2.}
\item{claim.select}{Percentage of times that each dose level was claimed efficacy
at stage 1 and stage 2.}
\item{prop.stop}{Percentage of times that the study was terminated at stage 1.}
\item{duration}{Expected study duration (months) at stage 1 and stage 2.}
\item{duration1}{Expected study duration (months) at stage 1.}
\item{duration2}{Expected study duration (months) at stage 2.}
\item{totaln}{Total patients at stage 1 and stage 2.}
\item{data.obs.n}{Record the number of patients in each dose level within the
simulations during the trial at stage 1 and stage 2.}
\item{data.obs.n.stage2}{Record the number of patients in each dose level within the
simulations during the trial at stage 2.}
\item{data.obs.n.stage1}{Record the number of patients in each dose level within the
simulations during the trial at stage 1.}
\item{obd}{Record the optimal dose in each simulation during the trial at stage 1 and stage 2.}
\item{claim}{Record the optimal dose with efficacy in each simulation during the trial at stage 1 and stage 2.}
\item{PCS}{The percentage of trials that the optimal dose was correctly
selected at stage 1 and stage 2.}
\item{PCC}{The percentage of patients that efficacy were correctly allocated to the
optimal dose at stage 1 and stage 2.}
\item{PTS}{The percentage of toxic doses selection at stage 1 and stage 2.}
\item{PTA}{The percentage of patients who were allocated to toxic doses at stage 1 and stage 2.}
\item{boundary_tab.all.out}{Futility and efficacy stopping boundaries at stage 2.}
\item{lambda}{Lambda values for cut-off probabilitys at stage 2.}
\item{gamma}{Gamma values for cut-off probability at stage 2.}
\item{eta}{Eta values for cut-off probability at stage 2.}
}
\description{
Obtain the operating characteristics of a seamless two-stage phase
I/II trial design with backfill and joint monitoring for dose optimization
within fixed scenarios
}
\details{
The \code{bfboinet_rp2} is a function which generates the operating
characteristics of the seamless two-stage Phase I/II trial design integrating
dose optimization with efficacy evaluation by a simulation study.
Users can specify a variety of study settings to simulate studies. The
operating characteristics of the design are summarized by the percentage of
times that each dose level was selected as optimal biological dose and the
average number of patients who were treated at each dose level. The
percentage of times that the study was terminated and the expected study
duration are also provided.
}
\examples{

target_T=0.3
target_E=0.25
pttt=c(0.02, 0.05, 0.07, 0.10, 0.15)
pee=c(0.05, 0.08, 0.15, 0.30, 0.45)
#####Stage 2####;
H0=c(0.10, 0.15, 0.30, 0.45)
H1=c(0.05, 0.45, 0.15, 0.35)
nIA.sample=c(24,30,36,42,48)
nIA=length(nIA.sample)
t1e_optimal_pars=0.1
lambda1_optimal_pars=0
lambda2_optimal_pars=1
grid1_optimal_pars=101
gamma1_optimal_pars=0
gamma2_optimal_pars=1
grid2_optimal_pars=101
eta1_optimal_pars=0
eta2_optimal_pars=3
grid3_optimal_pars=301
\dontrun{
get.oc.backboinet_rp2(target_T=target_T, toxprob=pttt,target_E=target_E,effprob=pee,n.dose=5,
startdose=1,ncohort=40,cohortsize=3,pT.saf=0.6 * target_T,pT.tox = 1.4 * target_T,
pE.saf = 0.6 * target_E,alpha.T1=0.5,alpha.E1=0.5,tau.T=1,tau.E=1,te.corr=0.2,
gen.event.time="weibull",accrual=3,gen.enroll.time="uniform",n.elimination=6,
stopping.npts=12,suspend=0,stopping.prob.T=0.95,stopping.prob.E=0.90,Nesc=36,
boundMTD = FALSE,estpt.method="obs.prob", obd.method="utility.scoring",
w1= 0.33, w2=1.09,plow.ast=pT.saf, pupp.ast=pT.tox, qlow.ast=pE.saf/2, qupp.ast=target_E,
stage1.method="ER",H0=H0,H1=H1,nIA.sample=nIA.sample,nIA=length(nIA.sample),
t1e_optimal_pars=t1e_optimal_pars,lambda1_optimal_pars=lambda1_optimal_pars,
lambda2_optimal_pars=lambda2_optimal_pars,grid1_optimal_pars=grid1_optimal_pars,
gamma1_optimal_pars=gamma1_optimal_pars,gamma2_optimal_pars=gamma2_optimal_pars,
grid2_optimal_pars=grid2_optimal_pars,eta1_optimal_pars=eta1_optimal_pars,
eta2_optimal_pars=eta2_optimal_pars,grid3_optimal_pars=grid3_optimal_pars,
ppsi01=0,ppsi00=40,ppsi11=60, ppsi10=100,n.sim=1,seed.sim=100)
}

}
\references{
A seamless two-stage phase I/II trial design with backfill
and joint efficacy and toxicity monitoring as described in (Takeda et al (2026) <doi:10.1002/pst.70092>.
}
