Internal helper functions to extract posterior samples from JAGS
fits and reformat them for further processing (summary tables, diagnostics, plots).
These functions consolidate common logic that was duplicated across
runjags_estimates_table, .diagnostics_plot_data, and plotting functions.
Helper to remove all columns associated with a parameter
.extract_posterior_samples(fit, as_list = FALSE).remove_auxiliary_parameters(
model_samples,
prior_list,
remove_parameters = NULL
)
.remove_parameter_columns(model_samples, prior, par_name)
.filter_parameters(
prior_list,
remove_parameters = NULL,
remove_formulas = NULL,
keep_parameters = NULL,
keep_formulas = NULL,
remove_spike_0 = TRUE
)
.process_spike_and_slab(
model_samples,
prior_list,
par,
conditional = FALSE,
remove_inclusion = FALSE,
warnings = NULL
)
.apply_parameter_transformations(
model_samples,
transformations,
prior_list,
transform_factors = FALSE
)
.transform_factor_contrasts(
model_samples,
prior_list,
transform_factors = FALSE,
transformations = NULL
)
.rename_factor_levels(model_samples, prior_list)
matrix or mcmc.list of posterior samples
list with cleaned model_samples and updated prior_list
updated model_samples matrix
list with filtered model_samples and prior_list
list with updated model_samples, prior_list, and warnings
updated model_samples matrix
updated model_samples matrix
updated model_samples matrix with renamed columns
a JAGS model fit object
whether to return samples as mcmc.list (TRUE) or merged matrix (FALSE)
matrix of posterior samples
list of prior objects
character vector of parameter names to remove, or TRUE to remove all non-formula parameters. If "bias" is specified and the bias prior contains PET, PEESE, or weightfunction priors, the corresponding parameters (PET, PEESE, omega) are also added to the removal list.
prior object for the parameter
name of the parameter
character vector of formula names whose parameters should be removed
character vector of parameter names to keep (all others removed unless in keep_formulas). If "bias" is specified and the bias prior contains PET, PEESE, or weightfunction priors, the corresponding parameters (PET, PEESE, omega) are also added to the keep list.
character vector of formula names whose parameters should be kept (all others removed unless in keep_parameters)
whether to remove spike at 0 priors
parameter name
whether to compute conditional summary
whether to remove inclusion indicators
character vector for collecting warnings
list of transformations to apply
whether to transform orthonormal/meandif to differences