permuteMCMC | R Documentation |
Relabel MCMC output from finite mixture models using the permutations found by some algorithm
permuteMCMC(x, perms, what = "cols")
x |
an array of MCMC samples, where the first index has to be equal
to the number of posterior samples, |
perms |
a |
what |
one of "rows", "cols," "both", or "matrix." Determines what dimensions are permuted. For two-dimensional arrays with unequal dimensions (i.e., rectangular matrices), the columns are always permuted. |
Given a permutation that resolves the label-switching, this
function applies the mapping to another object. If the object to
permute is a three-dimensional array of dimension
S
\*N
\*K
, the function will treat S
as the
number of posterior draws and will permute either the columns or the
rows of the sub-array which is of dimensions N
*K
. If
x
is a matrix, the function assumes that nrow(x) == S
and will permute the columns. When the what
argument is set to "matrix,"
it is assumed that the entered array is of dimension S
\*K
\*L
\*L
, and permutes the whole L
\*L
matrix across the K
classes for each posterior draw.
returns x
permuted according to perms
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.