This function reorders the estimated states, which can be useful for a comparison to true parameters or the interpretation of states.
Arguments
- x
An object of class
fHMM_model.- state_order
Either
"mean", in which case the states are ordered according to the means of the state-dependent distributions,or a vector (or a matrix) which determines the new ordering:
If
x$data$controls$hierarchy = FALSE,state_ordermust be a vector of lengthx$data$controls$stateswith integer values from1tox$data$controls$states. If the old state numberxshould be the new state numbery, put the valuexat the positionyofstate_order. E.g. for a 2-state HMM, specifyingstate_order = c(2, 1)swaps the states.If
x$data$controls$hierarchy = TRUE,state_ordermust be a matrix of dimensionx$data$controls$states[1]xx$data$controls$states[2] + 1. The first column orders the coarse-scale states with the logic as described above. For each row, the elements from second to last position order the fine-scale states of the coarse-scale state specified by the first element. E.g. for an HHMM with 2 coarse-scale and 2 fine-scale states, specifyingstate_order = matrix(c(2, 1, 2, 1, 1, 2), 2, 3)swaps the coarse-scale states and the fine-scale states connected to coarse-scale state 2.
Value
An object of class fHMM_model, in which states are reordered.
