R/random-effects-summary-posterior.R
random_effects_summary_posterior.RdExtracts posterior draws for derived random-effect summary quantities with their canonical prior densities. For allocation summaries, the helper keeps raw Dirichlet allocation weights internal and exposes interpretable scalar summaries such as mean-variance SD-component variance multipliers. Gated total-variance proportions are normalized over active components and omit draws on which every component is excluded because a variance share is undefined there.
Each summary is the parameter_mixed_posterior() of its catalog quantity:
its prior density is parameter_prior_density() (for gated allocations the
mixed measure with its inclusion-gate atoms), and its posterior atoms are
declared from its structure: none when the prior density has no point
mass; the inclusion-gate atoms of gated total-variance proportions (at 0
and 1) and allocation totals (at 0), and the point components of a mixture
scale prior whose indicator is monitored, with masses from the posterior
inclusion- and mixture-indicator draws. Point masses without such a source
leave the atom status undeclared, and posterior plots of such summaries stop
instead of inferring point masses from the draws.
random_effects_summary_posterior(
fit,
summary = c("var_mult", "var_prop", "sd_mult", "sd_total", "var_total", "sd_common",
"var_common"),
allocation = NULL,
component = NULL,
formula_parameter = NULL,
simplify_names = FALSE,
n_prior_points = 4096
)model fit created by JAGS_fit or a derived-draw view from
JAGS_with_draws(). Summaries use its supplied draws and local analysis metadata.
semantic quantity to extract: "var_mult", "var_prop",
"sd_mult", "sd_total", "var_total", "sd_common", or
"var_common". The default "var_mult" exists only for mean-variance
SD-component allocations: for a fit with total-variance allocations it
stops (request "var_prop" or a total instead).
optional allocation filter. It matches the stable
allocation name given to random_variance_allocation() (the
identifier the backend uses), not the public display_name.
optional allocation component label filter, matched against the component labels shown in the quantity names.
optional formula parameter filter.
whether returned quantities should use centrally
generated simplified display labels. Defaults to FALSE.
grid size (n_grid of parameter_prior_density()) of
the attached prior densities.
A named list of posterior vectors with class mixed_posteriors and
marginal_posterior. The list can be passed to plot_posterior, and the
individual vectors carry their prior_density, support, and declared
atoms as draw metadata (see posterior_metadata()).