% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/post_summary_cont_2arm.R
\name{post_summary_cont_2arm}
\alias{post_summary_cont_2arm}
\title{Posterior Summary for Two-Arm Comparative Trial with Continuous Endpoint}
\usage{
post_summary_cont_2arm(
  ybar_t,
  ybar,
  if.prior,
  nf.prior,
  prior.t = nf.prior,
  n.t,
  n,
  sigma.t,
  sigma,
  delta,
  cutoff,
  method = c("SAM", "rMAP", "NP"),
  alternative = c("greater", "less"),
  margin = 0,
  weight_rMAP = 0.5,
  method.w = "LRT",
  prior.odds = 1
)
}
\arguments{
\item{ybar_t}{Observed sample mean in the treatment arm.}

\item{ybar}{Observed sample mean in the control arm.}

\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}{Sample size for the treatment arm.}

\item{n}{Sample size for the control arm.}

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

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

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

\item{cutoff}{Posterior probability cutoff used for decision making.
The null hypothesis is rejected if the posterior tail probability
exceeds \code{cutoff}.}

\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.}
}
\value{
A list containing the posterior probability in the requested
direction, posterior mean and variance of \eqn{\tau}, decision indicator,
borrowing weight used for the control arm prior, and the corresponding
trial data and method information.
}
\description{
The \code{post_summary_cont_2arm} function is designed to compute the
posterior summary for the treatment effect in a two-arm comparative trial
with a continuous endpoint under one of three borrowing strategies:
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 means in the treatment and
control arms, respectively. Inference is based on the posterior distribution
of \eqn{\tau} given the observed sample means from the two arms.


The posterior for the treatment arm is obtained by updating
\code{prior.t} using the observed sample mean \code{ybar_t}. The posterior
for the control arm depends on the selected borrowing strategy:

\itemize{
\item \code{SAM}: the control arm prior is a mixture of \code{if.prior}
and \code{nf.prior}, with adaptive mixture weight determined by the
SAM borrowing rule.
\item \code{rMAP}: the control arm prior is a fixed mixture of
\code{if.prior} and \code{nf.prior}, with fixed weight
\code{weight_rMAP}.
\item \code{NP}: the control arm prior is \code{nf.prior} only.
}

When \code{alternative = "greater"}, inference is based on
\eqn{P(\theta_t - \theta > margin \mid \bar{Y}_t, \bar{Y})}. When
\code{alternative = "less"}, inference is based on
\eqn{P(\theta_t - \theta < -margin \mid \bar{Y}_t, \bar{Y})}.

The posterior mean and posterior variance of \eqn{\tau} are defined as
are defined as
\deqn{E(\tau \mid \bar{Y}_t, \bar{Y}) = E(\theta_t \mid \bar{Y}_t) - E(\theta \mid \bar{Y}),}
and
\deqn{\mathrm{Var}(\tau \mid \bar{Y}_t, \bar{Y}) = \mathrm{Var}(\theta_t \mid \bar{Y}_t) + \mathrm{Var}(\theta \mid \bar{Y}),}
where independence between the treatment and control arm posteriors is
assumed conditional on the current and historical data.
}
\seealso{
\code{\link{SAM_weight}}, \code{\link{SAM_prior}}
}
