Draws fresh posterior samples from an object returned by
compress_posterior() or its wrappers.
sample_posterior(object, n_draws = NULL, ...)A numeric matrix of draws (rows = draws, cols = parameters).
set.seed(1)
draws <- matrix(rnorm(2000 * 2), ncol = 2,
dimnames = list(NULL, c("a", "b")))
comp <- compress_posterior(draws, method = "mclust", n_components = 2)
#> ℹ mclust: trying all 14 covariance models c(EII, VII, EEI, VEI, EVI, VVI, EEE, VEE, EVE, VVE, EEV, VEV, EVV, VVV) and picking the best by BIC (n = 2000, d = 2).
#> ℹ mclust: selected model 'EII' with G = 2 (BIC = -11,675.5) out of 14 candidate models: EII, VII, EEI, VEI, EVI, VVI, EEE, VEE, EVE, VVE, EEV, VEV, EVV, VVV.
s <- sample_posterior(comp, n_draws = 500)
dim(s)
#> [1] 500 2