How it works...

The mathematics of HMMs are rather complex, but on a conceptual level, we could factorize the likelihood between terms, involving the observed variables and the unobserved ones. The usual way of estimating these models is by using the Expectation-Maximization algorithm. It works by iteratively taking expectations for the unobserved effects, and maximizing the log-likelihood.

Get R Statistics Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.