% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/eval_scenario_cont_2arm.R
\name{eval_scenario_cont_2arm}
\alias{eval_scenario_cont_2arm}
\title{Evaluate One Scenario for a Two-Arm Comparative Trial with Continuous Endpoint}
\usage{
eval_scenario_cont_2arm(
  if.prior,
  nf.prior,
  prior.t = nf.prior,
  n.t,
  n,
  sigma.t,
  sigma,
  theta.t,
  theta,
  cutoff,
  delta,
  method = c("SAM", "rMAP", "NP"),
  alternative = c("greater", "less"),
  margin = 0,
  weight_rMAP = 0.5,
  method.w = "LRT",
  prior.odds = 1,
  rel.tol = 1e-06,
  n_sd_int = 8
)
}
\arguments{
\item{if.prior}{Informative prior constructed based on historical data for
the control arm, represented (approximately) as a normal mixture prior.}

\item{nf.prior}{Non-informative prior used as the robustifying component
for the control arm prior.}

\item{prior.t}{Prior used for the treatment arm. If missing, the default
value is set to be \code{nf.prior}.}

\item{n.t}{Number of subjects in the treatment arm.}

\item{n}{Number of subjects in the control arm.}

\item{sigma.t}{Known sampling standard deviation in the treatment arm.}

\item{sigma}{Known sampling standard deviation in the control arm.}

\item{theta.t}{True treatment arm mean.}

\item{theta}{True control arm mean.}

\item{cutoff}{Posterior probability cutoff used for decision making.
Rejection occurs if the posterior probability exceeds \code{cutoff}.}

\item{delta}{Clinically significant difference used for the SAM prior.
This argument is only used when \code{method = "SAM"}.}

\item{method}{Borrowing strategy for the control arm. Must be one of
\code{"SAM"}, \code{"rMAP"}, or \code{"NP"}.}

\item{alternative}{Direction of the posterior decision. Must be one of
\code{"greater"} (for superiority) or \code{"less"} (for inferiority).}

\item{margin}{Clinical margin. Must be a non-negative scalar. The default
value is \code{0}.}

\item{weight_rMAP}{Weight assigned to the informative prior component
(\eqn{0 \leq} \code{weight_rMAP} \eqn{\leq 1}) for the robust MAP prior.
This argument is only used when \code{method = "rMAP"}. The default value is
0.5.}

\item{method.w}{Methods used to determine the mixture weight for SAM priors.
The default method is "LRT" (Likelihood Ratio Test), the alternative option
is "PPR" (Posterior Probability Ratio). See \code{\link{SAM_weight}} for
more details.}

\item{prior.odds}{The prior probability of \eqn{H_0} being true compared to
the prior probability of \eqn{H_1} being true using PPR method. The default
value is 1. See \code{\link{SAM_weight}} for more details.}

\item{rel.tol}{Relative tolerance passed to numerical integration.}

\item{n_sd_int}{Half-width of the numerical integration region for each arm,
expressed as a multiple of the corresponding standard error.}
}
\value{
A one-row data frame with the following columns:
\describe{
  \item{theta}{True control arm mean.}
  \item{theta.t}{True treatment arm mean.}
  \item{delta_true}{True treatment effect, \eqn{\tau = \theta_t - \theta}.}
  \item{method}{Borrowing method used.}
  \item{alternative}{Direction of the posterior decision.}
  \item{cutoff}{Posterior probability cutoff used for decision making.}
  \item{margin}{Clinical margin used for inference.}
  \item{reject_prob}{Repeated-sampling rejection probability.}
  \item{bias}{Bias of the posterior mean estimator of \eqn{\theta}.}
  \item{rmse}{Root mean squared error of the posterior mean estimator of \eqn{\theta}.}
  \item{mean_weight}{Average borrowing weight under the specified method.}
}
}
\description{
The \code{eval_scenario_cont_2arm} function is designed to evaluate
repeated-sampling operating characteristics for a two-arm comparative trial
with a continuous endpoint under one borrowing strategy: self-adapting
mixture prior (SAM), robust MAP prior with fixed weight (rMAP), or
non-informative prior (NP).
}
\details{
The treatment effect is defined as \eqn{\tau = \theta_t - \theta},
where \eqn{\theta_t} and \eqn{\theta} denote the true means in the
treatment and control arms, respectively.

For a given true scenario \eqn{(\theta_t, \theta)}, this function computes
the repeated-sampling rejection probability, bias, root mean squared error
(RMSE), and mean borrowing weight using one-dimensional numerical
integration.


The rejection probability is computed by reducing the repeated-sampling
decision rule to a one-dimensional integral over the control-arm sample mean.

Bias and RMSE are evaluated for the posterior mean estimator of the control
arm mean \eqn{\theta}. Both are computed from one-dimensional first and
second moments of the control-arm posterior mean. The mean borrowing weight
is computed by one-dimensional integration over the control-arm sample mean.

Under null scenarios, \code{reject_prob} corresponds to type I error. Under
alternative scenarios, it corresponds to power.
}
