% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bayesian_bootstrap.R
\name{bayesian_bootstrap_ate}
\alias{bayesian_bootstrap_ate}
\title{Bayesian bootstrap average treatment effect}
\usage{
bayesian_bootstrap_ate(object, alpha = 0.05)
}
\arguments{
\item{object}{Either a fitted \code{CausalShrinkageForest} (from
\code{\link{CausalShrinkageForest}} or \code{\link{CausalHorseForest}}
with \code{store_posterior_sample = TRUE}) or a
\code{CausalShrinkageForestPrediction} (from
\code{\link{predict.CausalShrinkageForest}}).}

\item{alpha}{One minus the credible level. Default \code{0.05}
(a 95 percent credible interval).}
}
\value{
A list with
\describe{
\item{pate_mean, pate_ci, pate_samples}{Posterior mean, credible
interval (named \code{lower} and \code{upper}), and full vector of
draws of the Bayesian-bootstrap PATE.}
\item{mate_mean, mate_ci, mate_samples}{Same quantities for the
equal-weight mixed ATE.}
\item{n, S}{Number of observations and posterior draws used.}
}
}
\description{
Post-hoc reweights the stored posterior CATE draws of a fitted causal
model to produce credible intervals for the \emph{population} ATE (PATE)
that incorporate uncertainty in the covariate distribution
\eqn{F_X}.
}
\details{
At each MCMC iteration \eqn{s} the conditional treatment effects
\eqn{\tau^{(s)}(x_i)} are reweighted with
\eqn{(w_1^{(s)}, \dots, w_n^{(s)}) \sim \mathrm{Dir}(1, \dots, 1)}
to give a draw
\deqn{\widehat{\mathrm{PATE}}^{(s)} = \sum_{i=1}^n w_i^{(s)}\, \tau^{(s)}(x_i).}
The collection \eqn{\{\widehat{\mathrm{PATE}}^{(s)}\}} approximates the
posterior of the PATE, integrating over \eqn{\tau(\cdot)} \emph{and}
\eqn{F_X}. The equal-weight mixed ATE (MATE),
\eqn{\widehat{\mathrm{MATE}}^{(s)} = n^{-1}\sum_i \tau^{(s)}(x_i)},
is returned alongside for comparison.

For reproducibility, call \code{set.seed()} before invoking the function
to fix the Dirichlet draws.
}
\examples{
# Small toy causal model (binary outcome, for speed)
set.seed(1)
n <- 40; p <- 3
X <- matrix(runif(n * p), ncol = p)
trt <- rbinom(n, 1, 0.5)
y <- X[, 1] + trt * (0.5 + X[, 2]) + rnorm(n)

fit <- CausalShrinkageForest(
  y = y,
  X_train_control = X, X_train_treat = X,
  treatment_indicator_train = trt,
  outcome_type = "continuous",
  number_of_trees_control = 5, number_of_trees_treat = 5,
  prior_type_control = "horseshoe", prior_type_treat = "horseshoe",
  local_hp_control = 0.1, global_hp_control = 0.1,
  local_hp_treat = 0.1, global_hp_treat = 0.1,
  N_post = 20, N_burn = 10,
  store_posterior_sample = TRUE,
  verbose = FALSE
)

bb <- bayesian_bootstrap_ate(fit, alpha = 0.05)
bb$pate_mean
bb$pate_ci

}
\seealso{
\code{\link{summary.CausalShrinkageForest}},
\code{\link{plot.CausalShrinkageForest}},
\code{\link{predict.CausalShrinkageForest}}
}
