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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.