# See the help for sim.hmm() for how to generate y.sim.
try <- hmm(y.sim,K=2,verb=TRUE)
vvv.1 <- viterbi(y.sim,try)
vvv.2 <- viterbi(y.sim,tpm=P,ispd=c(0.25,0.75),Rho=R) # P and R as in the
# help for sim.hmm().
# The order of the states has gotten swapped; 3-vvv.1[[1]] is much
# more similar to vvv.2[[1]] than is vvv.1[[1]].
Run the code above in your browser using DataLab