% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/internal.R
\name{.predict_mixgpd}
\alias{.predict_mixgpd}
\title{Internal prediction engine: evaluate per posterior draw, then summarize.}
\usage{
.predict_mixgpd(
  object,
  x = NULL,
  y = NULL,
  ps = NULL,
  id = NULL,
  type = c("density", "survival", "quantile", "sample", "mean", "rmean", "median", "fit"),
  p = NULL,
  index = NULL,
  nsim = NULL,
  level = 0.95,
  interval = "credible",
  probs = c(0.025, 0.5, 0.975),
  store_draws = TRUE,
  nsim_mean = 200L,
  cutoff = NULL,
  ndraws_pred = NULL,
  chunk_size = NULL,
  show_progress = TRUE,
  ncores = 1L,
  sample_draw_idx = NULL
)
}
\description{
Project rules:
\itemize{
\item density/survival: either provide both (x,y) or neither (defaults to training X and training y).
\item quantile/sample/mean: y must be NULL; x may be provided (new X) or NULL (defaults to training X).
\item CRP predictions use posterior weights derived from z for each draw.
\item Stores per-draw results in object$cache$predict (environment) for reuse in treatment effects.
}
}
\details{
This is the main internal workhorse behind \code{predict.mixgpd_fit()} and the
causal effect helpers. It evaluates the requested predictive functional
separately for each retained posterior draw, using either explicit SB weights
or CRP weights reconstructed from latent cluster labels, and only then
collapses the draw-level results into posterior summaries.

The helper also manages caching of per-draw predictive quantities because
treatment-effect functions repeatedly reuse the same arm-specific predictive
draws. That cache avoids recomputation while keeping the public prediction
interface simple.
}
\keyword{internal}
