Viterbi algorithm for state decoding in HMMs
viterbi.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
transition probability matrix; either
a matrix of dimension
c(nStates, nStates),an array of dimension
c(nStates, nStates, nTracks)iftrackIDis provided, oran array of dimension
c(nStates, nStates, nObs)for time-varying transition probabilities, in which caseviterbi_gis called internally
- 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::MakeADFunorqremlwithforwardin 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_g(),
viterbi_p()