CausalMixGPD

Predict arm-specific and contrast-scale quantities from a causal fit

predict.causalmixgpd_causal_fit() is the causal counterpart to predict.mixgpd_fit. It coordinates the treated and control arm predictions so that both sides use the same covariate rows and the same PS adjustment.

Usage

# S3 method for class 'causalmixgpd_causal_fit'
predict(
  object,
  newdata = NULL,
  y = NULL,
  ps = NULL,
  id = NULL,
  type = c("mean", "quantile", "density", "survival", "prob", "sample"),
  p = NULL,
  index = NULL,
  nsim = NULL,
  interval = "credible",
  probs = c(0.025, 0.5, 0.975),
  store_draws = TRUE,
  nsim_mean = 200L,
  ncores = 1L,
  show_progress = TRUE,
  ...
)

Arguments

Value

For "mean" and "quantile", a causal prediction object whose $fit component reports treated-minus-control posterior summaries. For "density", "survival", and "prob", the $fit component contains side-by-side treated and control summaries evaluated on the supplied y grid. For "sample", the returned object contains paired treated, control, and treatment-effect posterior predictive samples. Sample outputs also include long-form data frames $fit_df, $trt_fit_df, and $con_fit_df for direct extraction.

Details

For each prediction row \x\, the function evaluates arm-specific posterior predictive quantities based on \F_1(y \mid x)\ and \F_0(y \mid x)\. Mean and quantile outputs are returned on the treatment-effect scale, while density, survival, and probability outputs retain both arm-specific curves. For outcome kernels with a finite analytical mean, the mean path uses analytical per-draw means; restricted means remain simulation-based.

If a PS model is stored in the fit, the same estimated score is supplied to both arms unless the user overrides it with ps. This is the main prediction entry point used internally by ate, qte, cate, and cqte.

See also

predict.mixgpd_fit, ate, qte, cate, cqte.

Examples

if (FALSE) { # \dontrun{
cb <- build_causal_bundle(y = y, X = X, A = A, backend = "sb", kernel = "normal")
fit <- run_mcmc_causal(cb)
predict(fit, newdata = X[1:10, ], type = "quantile", index = c(0.25, 0.5, 0.75))
predict(fit, newdata = X[1:10, ], type = "mean", interval = "hpd")  # HPD intervals
predict(fit, newdata = X[1:10, ], type = "mean", interval = NULL)   # No intervals
} # }