Learn R Programming

seqHMM (version 2.1.0)

permute_states: Permute the states of NHMM using Hungarian algorithm

Description

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.

Usage

permute_states(estimates, reference)

Value

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].

Arguments

estimates

A list \(\gamma\) coefficients as in model$gammas, where model is an nhmm object.

reference

Another list of \(\gamma\) coefficients for which to match the estimates.

Details

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.