Viterbi algorithm for state decoding in homogeneous HMMs
viterbi.RdThe Viterbi algorithm allows one to decode the most probable state sequence of an HMM.
Arguments
- delta
initial distribution of length N, or matrix of dimension c(k,N) for k independent tracks, if
trackIDis provided- Gamma
transition probability matrix of dimension c(N,N) or array of transition probability matrices of dimension c(N,N,k) if
trackIDis provided- allprobs
matrix of state-dependent probabilities/ density values of dimension c(n, N)
- trackID
optional vector of k track IDs, if multiple tracks need to be decoded separately
- mod
optional model object containing initial distribution
delta, transition probability matrixGamma, matrix of state-dependent probabilitiesallprobs, and potentially atrackIDvariableIf you are using automatic differentiation either with
RTMB::MakeADFunorqremland includeforwardin your likelihood function, the objects needed for state decoding are automatically reported after model fitting. Hence, you can pass the model object obtained from runningRTMB::report()or fromqremldirectly to this function.
See also
Other decoding functions:
stateprobs(),
stateprobs_g(),
stateprobs_p(),
viterbi_g(),
viterbi_p()