% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/causal.R
\name{ate_rmean}
\alias{ate_rmean}
\title{Restricted-mean ATE helper}
\usage{
ate_rmean(
  fit,
  newdata = NULL,
  cutoff,
  interval = "credible",
  level = 0.95,
  nsim_mean = 200L,
  show_progress = TRUE
)
}
\arguments{
\item{fit}{A \code{"causalmixgpd_causal_fit"} object from \code{run_mcmc_causal()}.}

\item{newdata}{Optional data.frame or matrix of covariates for prediction.
If \code{NULL}, uses the training covariates stored in \code{fit}.}

\item{cutoff}{Finite numeric cutoff for the restricted mean.}

\item{interval}{Character or NULL; type of credible interval:
\itemize{
\item \code{NULL}: no interval
\item \code{"credible"} (default): equal-tailed quantile intervals
\item \code{"hpd"}: highest posterior density intervals
}}

\item{level}{Numeric credible level for intervals (default 0.95 for 95 percent CI).}

\item{nsim_mean}{Number of posterior predictive draws used by simulation-based
mean targets. Ignored for analytical ordinary means.}

\item{show_progress}{Logical; if TRUE, print step messages and render progress where supported.}
}
\value{
A \code{"causalmixgpd_ate"} object computed via \code{\link{ate}}
for unconditional fits or \code{\link{cate}} for conditional fits. The
returned object includes a top-level \code{$fit_df} data frame for direct
extraction.
}
\description{
\code{ate_rmean()} is a convenience wrapper for restricted-mean treatment
effects when the ordinary mean is unstable or undefined.
}
\details{
The restricted-mean estimand replaces \eqn{Y(a)} by
\eqn{\min\{Y(a), c\}}, so the contrast remains finite even when the fitted
GPD tail implies \eqn{\xi \ge 1}.
}
\examples{
\donttest{
N <- 25
X <- data.frame(x1 = stats::rnorm(N))
A <- stats::rbinom(N, 1, 0.5)
y <- abs(stats::rnorm(N)) + 0.1
mcmc_small <- list(niter = 100, nburnin = 50, thin = 1, nchains = 1, seed = 1)
cb <- build_causal_bundle(y = y, X = X, A = A, backend = "sb", kernel = "normal",
                         GPD = TRUE, components = 3,
                         mcmc_outcome = mcmc_small, mcmc_ps = mcmc_small)
fit <- run_mcmc_causal(cb)
ate_rm <- ate_rmean(fit, cutoff = 10, interval = "credible")
}
}
\seealso{
\code{\link{ate}}, \code{\link{cate}}, \code{\link{predict.mixgpd_fit}}.
}
