viterbi: Viterbi algorithm

Description Usage Arguments Value References Examples

View source: R/viterbi.R

Description

For a given model, reconstructs the most probable states sequence, using the Viterbi algorithm.

Usage

1
viterbi(m, hierarchical = FALSE)

Arguments

m

An object momentuHMM or momentuHierHMM

hierarchical

Logical indicating whether or not to return a list of Viterbi-decoded states for each level of a hierarchical HMM. Ignored unless m is a momentuHierHMM object.

Value

The sequence of most probable states. If hierarchical is TRUE, then a list of the most probable states for each level of the hierarchy is returned.

References

Zucchini, W. and MacDonald, I.L. 2009. Hidden Markov Models for Time Series: An Introduction Using R. Chapman & Hall (London).

Examples

1
2
3
4
5
# m is a momentuHMM object (as returned by fitHMM), automatically loaded with the package
m <- example$m

# reconstruction of states sequence
states <- viterbi(m)

momentuHMM documentation built on Sept. 5, 2021, 5:17 p.m.