Viterbi algorithm for state decoding in inhomogeneous HMMs
viterbi_g.RdThe Viterbi algorithm decodes the most probable state sequence of an HMM.
Arguments
- delta
initial distribution; either
a vector of length
nStates, ora matrix of dimension
c(nTracks, nStates)iftrackIDis provided
- Gamma
array of transition probability matrices of dimension
c(nStates, nStates, nObs), where the first slice of each track is ignored as there is no transition into the start of a track. For a single track, an array of dimensionc(nStates, nStates, nObs-1)is also accepted.- allprobs
matrix of state-dependent probabilities or density values of dimension
c(nObs, nStates)- trackID
optional vector of length
nObscontainingnTracksunique IDs that separate tracks- mod
optional model object containing
delta,Gamma,allprobs, and optionallytrackID. When usingRTMB::MakeADFunorqremlwithforward_gin the likelihood, these are reported automatically after model fitting and the object returned byRTMB::report()orqremlcan be passed directly.
See also
Other decoding functions:
stateprobs(),
stateprobs_g(),
stateprobs_p(),
viterbi(),
viterbi_p()