% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Bayesian_test.R
\name{Bayesian_test}
\alias{Bayesian_test}
\title{Bayesian Test from Carlotti and Parast (2026)}
\usage{
Bayesian_test(
  P_MCMC,
  alpha = 0.05,
  V_S_star,
  theta_true = NULL,
  V_Y_true = NULL
)
}
\arguments{
\item{P_MCMC}{A three-dimensional array of potential outcomes obtained via MCMC sampling with dimensions \code{[n_subjects, variables, n_samples]}. The variables should correspond to \eqn{(Y_1, S_1, Y_0, S_0)}.}

\item{alpha}{Numeric. Significance level for the credible interval (default is 0.05).}

\item{V_S_star}{Numeric. The value of \eqn{v_S} that satisfies the power constraint for the surrogate validation test.}

\item{theta_true}{Numeric (optional). The true value of \eqn{\eta}, used to calculate frequentist coverage during simulations.}

\item{V_Y_true}{Numeric (optional). The true value of \eqn{V_Y}, used to calculate the surrogate validation threshold \eqn{\eta} during simulations. If not provided, it will be estimated from the MCMC samples.}
}
\value{
A list containing:
\itemize{
  \item \code{V_Y_MCMC}: Posterior draws for \eqn{V_Y}.
  \item \code{V_S_MCMC}: Posterior draws for \eqn{V_S}.
  \item \code{theta_MCMC}: Posterior draws for \eqn{\theta = V_Y - V_S}.
  \item \code{CI}: The calculated credible interval for \eqn{\theta}.
  \item \code{threshold}: The \eqn{\eta} threshold value used in the test.
  \item \code{coverage}: Logical indicating if \code{theta_true} falls within the \code{CI} (if \code{theta_true} is provided).
  \item \code{power}: Logical indicating if the upper bound of \code{CI} is below \code{threshold}, which indicates that the test identifies the surrogate as valid.
}
}
\description{
This function performs a Bayesian test for surrogate evaluation based on the
imputation-based methodology of \insertCite{carlotti2026bayesian;textual}{BSET}. It calculates
credible intervals, the \eqn{\eta} threshold used, and determines if the
surrogate is valid.
This function is generally not intended to be called directly by the user
and is instead used internally within \code{BSET_no_X} and \code{BSET_X}.
}
\references{
\insertRef{carlotti2026bayesian}{BSET}
}
