viterbi {RHmm} | R Documentation |
This function calculates the optimal hidden states sequence using Viterbi's algorithm
viterbi(HMM, obs)
HMM |
a HMMClass or a HMMFitClass object |
obs |
The vector, matrix, data frame, list of vectors or list of matrices of observations |
a viterbiClass object which is a list with:
States |
Sequence of hidden states in 1...nStates |
logViterbiScore |
logarithm of the Viterbi's Score |
logProbSeq |
logarithm of probability of having the sequence of states conditionally to having the observations |
Among hundreds of tutorials, you can have a look to use
Phil Blunsom (2004) Hidden Markov Models
http://www.cs.mu.oz.au/460/2004/materials/hmm-tutorial.pdf
HMMSet, HMMFit
data(geyser) obs <- geyser$duration #Fits an 2 states gaussian model for geyser duration ResFitGeyser <- HMMFit(obs) VitGeyser <- viterbi(ResFitGeyser, obs)