get_clean_posterior.Rd
This function filters and processes posterior samples from RJMCMC outputs based on a specified mixture size. It generates clean posterior summaries and the trajectory of the posterior distribution.
get_clean_posterior(outputs, mix_size, n_chain)
A list containing two components:
summary_post
: A data frame summarizing the posterior samples with columns:
p
(mixing proportions), mu
(means), sigma
(standard deviations),
order
(ranked means), sample
(sample index), and chain
(chain index).
post_traj_sum
: A data frame summarizing the posterior trajectory, including mean
and uncertainty intervals (mean_qi
).
The function filters jump
matrices for samples matching the specified mix_size
(number of components).
It constructs a clean summary of posterior parameters and calculates the posterior trajectory
using a sequence of x-values (e.g., for visualization of the mixture distribution).
Steps:
Filter Samples:
Selects jump
matrices with mix_size
columns.
Extracts parameters: mixing proportions (p
), means (mu
), and standard deviations (sigma
).
Generate Posterior Trajectory:
Uses the filtered posterior parameters to calculate the PDF of the mixture distribution over a range of x-values.
Aggregates the trajectories across samples using mean_qi()
to summarize uncertainty.