Hidden Markov Models for Time Series: An Introduction Using R, Second Edition illustrates the great flexibility of hidden Markov models (HMMs) as general-purpose models for time series data. The book provides a broad understanding of the models and their uses.

After presenting the basic model formulation, the book covers estimation, forecasting, decoding, prediction, model selection, and Bayesian inference for HMMs. Through examples and applications, the authors describe how to extend and generalize the basic model so that it can be applied in a rich variety of situations.

The book demonstrates how HMMs can be applied to a wide range of types of time series: continuous-valued, circular, multivariate, binary, bounded and unbounded counts, and categorical observations. It also discusses how to employ the freely available computing environment R to carry out the computations.


  1. Presents an accessible overview of HMMs
  2. Explores a variety of applications in ecology, finance, epidemiology, climatology, and sociology
  3. Includes numerous theoretical and programming exercises
  4. Provides most of the analysed data sets online

New to the second edition

  1. A total of five chapters on extensions, including HMMs for longitudinal data, hidden semi-Markov models and models with continuous-valued state process
  2. New case studies on animal movement, rainfall occurrence and capture-recapture data

part 1|130 pages

Model structure, properties and methods

chapter 1|26 pages

Preliminaries: mixtures and Markov chains

chapter 4|15 pages

Estimation by the EM algorithm

chapter 5|15 pages

Forecasting, decoding and state prediction

chapter 6|14 pages

Model selection and checking

chapter 8|8 pages

R packages

part 2|65 pages


chapter 10|10 pages

Covariates and other extra dependencies

chapter 11|9 pages

Continuous-valued state processes

chapter 13|10 pages

HMMs for Longitudinal Data

part 3|133 pages


chapter 14|1 pages

Introduction to applications

chapter 15|6 pages

Epileptic seizures

chapter 16|5 pages

Daily rainfall occurrence

chapter 17|13 pages

Eruptions of the Old Faithful geyser

chapter 18|17 pages

HMMs for animal movement

chapter 19|13 pages

Wind direction at Koeberg

chapter 20|15 pages

Models for financial series

chapter 21|11 pages

Births at Edendale Hospital