This function finds the permutation (according to Hungarian algorithm) of estimated model coefficients \(\gamma\) which best matches some reference values. The main purpose is to permute the bootstrap samples of model coefficients to match as closely as possible to the maximum likelihood estimates obtained from the original data.
permute_states(estimates, reference)
Permuted version of estimates
, with added attribute permutation
which contains the permutations used to obtain for example the new
gamma_pi
as estimates$gamma_pi[perm, , drop = FALSE]
.
A list \(\gamma\) coefficients as in model$gammas
,
where model
is an nhmm
object.
Another list of \(\gamma\) coefficients for which to match
the estimates
.
The cost matrix in Hungarian algorithm is based on the sum of L2 norms of the differences of estimated and reference values of \(\pi\), \(A\) and \(B\).
This function is mostly meant for internal usage within the bootstrap
methods of seqHMM
.