Build the workflow bundle used by the package fitters
bundle.Rdbundle() is the main workflow constructor. It converts raw inputs,
a formula/data pair, or an already prepared bundle into the canonical
object consumed by mcmc, dpmix,
dpmgpd, dpmix.causal, and
dpmgpd.causal.
Arguments
- y
Either a response vector or an existing bundle.
- X
Optional design matrix/data.frame.
- treat
Optional binary treatment indicator.
- data
Optional data.frame used with
formula.- formula
Optional formula.
- GPD
Logical; include GPD tail in build mode.
- ...
Additional arguments passed to
build_nimble_bundle()orbuild_causal_bundle().
Value
A "causalmixgpd_bundle" for one-arm models or a
"causalmixgpd_causal_bundle" for causal models. The bundle stores
code-generation inputs, monitor policy, and default MCMC settings, but it
does not run MCMC.
Details
For one-arm models the returned object represents a bulk Dirichlet process mixture, optionally augmented with a spliced generalized Pareto tail. For causal models the returned object contains two arm-specific outcome bundles plus an optional propensity score block.
The workflow is:
prepare a bundle with
bundle(),run posterior sampling with
mcmcor one of thedpmix*/dpmgpd*wrappers,inspect the fitted object with
summary.mixgpd_fit,params,predict.mixgpd_fit, or the causal estimand helpers.
Setting GPD = TRUE requests the spliced bulk-tail model with
conditional distribution
$$F(y \mid x) = F_{\mathrm{bulk}}(y \mid x)\mathbf{1}\{y \le u(x)\} +
\left[p_u(x) + \{1 - p_u(x)\}F_{\mathrm{GPD}}(y \mid x)\right]\mathbf{1}\{y > u(x)\},$$
where \(p_u(x)\) is the bulk probability below the threshold \(u(x)\).
See the manuscript vignette for the DPM hierarchy, SB/CRP representations, and the spliced bulk-tail construction used throughout the package.