% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/posterior-extraction.R
\name{posterior_extraction_helpers}
\alias{posterior_extraction_helpers}
\alias{.extract_posterior_samples}
\alias{.remove_auxiliary_parameters}
\alias{.remove_parameter_columns}
\alias{.filter_parameters}
\alias{.process_spike_and_slab}
\alias{.apply_parameter_transformations}
\alias{.transform_factor_contrasts}
\alias{.rename_factor_levels}
\title{Helper functions for extracting and formatting posterior distributions}
\usage{
.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)
}
\arguments{
\item{fit}{a JAGS model fit object}

\item{as_list}{whether to return samples as mcmc.list (TRUE) or merged matrix (FALSE)}

\item{model_samples}{matrix of posterior samples}

\item{prior_list}{list of prior objects}

\item{remove_parameters}{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.}

\item{prior}{prior object for the parameter}

\item{par_name}{name of the parameter}

\item{remove_formulas}{character vector of formula names whose parameters should be removed}

\item{keep_parameters}{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.}

\item{keep_formulas}{character vector of formula names whose parameters should be kept (all others removed unless in keep_parameters)}

\item{remove_spike_0}{whether to remove spike at 0 priors}

\item{par}{parameter name}

\item{conditional}{whether to compute conditional summary}

\item{remove_inclusion}{whether to remove inclusion indicators}

\item{warnings}{character vector for collecting warnings}

\item{transformations}{list of transformations to apply}

\item{transform_factors}{whether to transform orthonormal/meandif to differences}
}
\value{
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
}
\description{
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
\code{runjags_estimates_table}, \code{.diagnostics_plot_data}, and plotting functions.

Helper to remove all columns associated with a parameter
}
\keyword{internal}
