# See the help for sim.hmm() for how to generate y.num and y.let.
fit.num <- hmm(y.num,K=2,verb=TRUE)
v.1 <- viterbi(object=fit.num)
v.2 <- viterbi(y.num,tpm=P,Rho=R) # P and R as in the
# help for sim.hmm().
# The order of the states has gotten swapped; 3-v.1[[1]] is much
# more similar to v.2[[1]] than is v.1[[1]].
fit.let <- hmm(y.let,K=2,verb=TRUE)
v.3 <- viterbi(object=fit.let) # Works.
v.4 <- viterbi(y.let,tpm=P,Rho=R) # Throws an error (R has no row names.)
Run the code above in your browser using DataLab