14 Applications
An HMM is a modelling template, and applying it means answering four questions: what are the states, what generates the observations, what constraints does the transition matrix carry, and which inference problem is actually being solved. This chapter works through five domains with those four questions in view, and pays attention to where the standard assumptions strain.
The point is not a survey. It is that the same \(\mathcal{O}(K^2T)\) recursion answers questions in speech, genomics, finance, ecology and epidemiology, and that the modelling decisions — not the algorithms — are what differ.
By the end of this chapter you will be able to
- specify an HMM for a new problem by answering four questions: states, emissions, transition constraints, inference task;
- recognise where a standard assumption is knowingly violated, and judge whether that matters;
- exploit structural constraints on \(\boldsymbol{\Gamma}\) for both interpretation and speed;
- follow a workflow that ends in model checking rather than a fitted object.
14.1 Speech recognition
States. Sub-phonetic units. A phone is typically modelled by three states — onset, steady portion, offset — and context-dependent triphones multiply this substantially, so that \(K\) runs to tens of thousands even before a language model is composed in.
Observations. Short-time spectral features extracted from overlapping windows of about 25 ms at 10 ms intervals, classically mel-frequency cepstral coefficients in \(\mathbb{R}^{39}\). Emissions were Gaussian mixtures for decades; in modern systems a neural network supplies the state-conditional scores and the HMM contributes the temporal structure.
Transitions. Strictly left-to-right: \(\gamma_{ij} = 0\) unless \(j \in \{i, i+1\}\). A phone is entered, dwelt in, and left, never revisited. This is where the sparsity of Chapter 7 pays off — the recursion touches \(\mathcal{O}(K)\) rather than \(\mathcal{O}(K^2)\) entries per step.
Problem. Decoding, on an enormous scale. Beam search rather than exact Viterbi, for the reasons in Chapter 7.
Two model failures are worth naming, because they are instructive. Geometric dwell times are wrong for phones, which have characteristic durations — the hidden semi-Markov extension of Chapter 12 is the principled fix, and duration models bolted onto the decoder are the practical one. And conditionally independent emissions are badly wrong for speech, where successive frames overlap by construction; the assumption is retained because it is what makes decoding tractable, and the resulting likelihood is treated frankly as a score rather than a probability.
Rabiner (1989) and Levinson et al. (1983) are the classical references; Jurafsky and Martin (2025) covers the modern hybrid architectures.
14.2 Bioinformatics
14.2.1 Segmenting a genome
States. Compositional classes of a DNA sequence — the standard example being CpG islands, regions unusually rich in the dinucleotide CG, against background.
Observations. Nucleotides, \(\mathcal{Y} = \{\mathrm{A},\mathrm{C},\mathrm{G},\mathrm{T}\}\).
Emissions. State-dependent categorical distributions. Because the signal is a dinucleotide frequency, the useful model conditions on the previous base: \(\mathbb{P}(Y_t = y \mid S_t = i, Y_{t-1} = y')\), an autoregressive HMM in the sense of Chapter 12, giving each state a \(4 \times 4\) conditional table.
Transitions. Two states with strong self-transition; the diagonal entries set the expected island length directly, since a geometric dwell time with parameter \(1-\gamma_{ii}\) has mean \(1/(1-\gamma_{ii})\).
Problem. Decoding — which positions are island. Posterior decoding is often preferred to Viterbi here, because per-position confidence is more useful than a single global segmentation, and the caveat of Example 5.1 does not bite when the transition matrix has no structural zeros.
14.2.2 Profile HMMs
Profile HMMs model a family of related sequences rather than a single one, and their topology is the model. Each column of a multiple alignment gets a match state, plus an insert state for extra residues and a delete state for skipped ones. Transitions between these encode gap penalties, and the analogy is exact: log transition probabilities play the role of the affine gap costs in classical alignment, so a scoring scheme chosen by hand becomes a probability model that can be estimated.
The consequence is a proper statistical framework for homology detection. Aligning a query to the profile is Viterbi; scoring family membership is the forward algorithm; building the profile from unaligned sequences is Baum–Welch. Krogh et al. (1994) introduced the construction, Eddy (1998) made it practical, and Durbin et al. (1998) is the standard textbook.
14.3 Finance and econometrics
States. Market regimes — most commonly a low-volatility and a high-volatility regime, sometimes with a distinct crisis state.
Observations. Returns \(Y_t = \log(P_t/P_{t-1})\).
Emissions. \(Y_t \mid S_t = i \sim \mathcal{N}(\mu_i, \sigma_i^2)\), with \(\sigma_i\) differing sharply across states and \(\mu_i\) much less so.
Transitions. Highly persistent, with diagonal entries around \(0.95\)–\(0.99\) at daily frequency.
The model earns its place by reproducing stylised facts that a single Gaussian cannot. Marginally, a mixture of normals with different variances is leptokurtic, matching the fat tails of returns. Volatility clustering follows from regime persistence. And both emerge from a model with a handful of parameters and an interpretable state.
Problems. Filtering gives the current regime probability for risk management; smoothing gives a retrospective chronology of regimes; the predictive distribution feeds value-at-risk calculations that account for regime uncertainty rather than conditioning on a point estimate.
Hamilton’s Markov-switching autoregression (Hamilton 1989) extends this to the conditional mean, \[ Y_t = \mu_{S_t} + \sum_{r=1}^{p} \varphi_{r,S_t} \, Y_{t-r} + \varepsilon_t, \qquad \varepsilon_t \sim \mathcal{N}(0, \sigma^2_{S_t}), \] with states interpreted as expansion and recession. As noted in Chapter 12, exact filtering is available because the only latent variable remains discrete.
The honest caveat: regimes fitted this way are not economic regimes, they are variance regimes. A two-state fit on almost any return series finds a calm state and a turbulent one, and interpreting these as business-cycle phases requires evidence beyond the fit.
14.4 Animal movement and ecology
States. Behavioural modes — resting, foraging, travelling.
Observations. Bivariate, from successive GPS relocations: step length \(\ell_t > 0\) and turning angle \(\psi_t \in (-\pi, \pi]\).
Emissions. Gamma or Weibull for step length, von Mises or wrapped Cauchy for turning angle, taken as conditionally independent given the state. The states are then characterised by the joint pattern: short steps with undirected turns for resting, long steps with directed turns for travelling.
Transitions. Often covariate-dependent through a multinomial logit, with time of day, habitat type or reproductive status shifting the propensity to switch. This is the covariate-dependent construction of Chapter 4.
Problem. State decoding to produce a behavioural time series, and inference on the covariate coefficients, which is usually the scientific question — does habitat quality change foraging propensity?
The field also supplies the clearest use of the hierarchical machinery of Chapter 10, because studies routinely track many individuals with short and irregular records. A multilevel HMM with animal-level random effects on the transition parameters estimates both the population-level behavioural structure and individual variation around it, which is exactly what a study of a population wants. Langrock et al. (2012) set out the framework and Zucchini et al. (2016, ch. 16) work through examples in full.
14.5 Epidemiology and disease progression
States. Latent health states — disease stages, or infection status not directly observable.
Observations. Imperfect diagnostics: test results with known sensitivity and specificity, symptom scores, biomarkers.
Emissions. The emission matrix is the diagnostic’s error profile. For a binary test in a two-state model, \(b_i(y)\) has entries given by sensitivity and specificity, which are often known from validation studies and can therefore be fixed rather than estimated — a case where genuine external information pins down part of the model.
Transitions. Progression probabilities, frequently constrained. Irreversible disease gives an upper-triangular \(\boldsymbol{\Gamma}\); a treatment covariate shifts the progression rate, which is typically the estimand.
Problem. Estimating transition intensities in the presence of misclassification, and predicting state occupancy over time. Jackson et al. (2003) develop multistate models with classification error, which is the epidemiological name for this construction.
Two complications are structural. Observation times are irregular and often informative — patients attend when unwell — so the discrete-time chain must be replaced by a continuous-time one with transition matrix \(\exp(\mathbf{A}\Delta_t)\) for the elapsed time \(\Delta_t\) and generator \(\mathbf{A}\). And panel data means many short series, which again makes the multilevel structure of Chapter 10 the natural formulation rather than an optional refinement.
Check your understanding. A colleague fits a two-state Gaussian HMM to daily equity returns, finds a low-variance and a high-variance state, and writes that the model has identified expansion and recession regimes. What would you say?
That the model has identified a low-variance state and a high-variance state, which is what it was asked to do. Almost any return series yields that fit, because returns exhibit volatility clustering; the states are variance regimes, and calling them business-cycle phases is an interpretation the fit does not support.
To make the economic claim, you would need external evidence: do the smoothed state probabilities line up with dated recessions? Does the model beat a simple volatility model out of sample at something other than volatility? The general point is the one in Chapter 13 — a model that predicts well need not have interpretable internals, and the two claims require separate arguments.
14.6 A checklist
The five applications share a common workflow, and it is worth stating explicitly.
- Choose \(K\) for interpretability first, fit second. States that map onto something real are more valuable than states that improve a criterion. Use Chapter 8 and Chapter 11 to inform the choice, not to make it.
- Match the emission family to the data type. Positive quantities get positive-support families, angles get circular ones, counts get count families. A Gaussian on a strictly positive variable will manufacture states to handle the boundary.
- Constrain the transition matrix where the science does. Irreversibility, left-to-right structure and forbidden transitions are information; imposing them improves both estimation and speed.
- Fit from many starting values. Local maxima are the norm, not the exception (Chapter 6).
- Check the fit, not just the score. Pseudo-residuals, posterior predictive comparisons of features the model was not fitted to, and — where states are interpreted — whether the decoded sequence makes sense to someone who knows the domain.
- Report uncertainty in the states, not only the parameters. A decoded state sequence with no accompanying \(\gamma_t(i)\) overstates what is known.
14.7 Summary
- The same recursions serve speech, genomics, finance, ecology and epidemiology; what changes is the interpretation of the states, the emission family, and the constraints on \(\boldsymbol{\Gamma}\).
- Structural constraints are common and valuable: left-to-right in speech, profile topologies in sequence analysis, irreversibility in disease progression. They encode science and reduce cost.
- Some standard assumptions are known to be wrong in specific domains — geometric dwell times in speech, conditional independence of overlapping acoustic frames — and are retained because the alternative is intractable. Knowing which assumption is being abused is part of using the model well.
- Multilevel structure (Chapter 10) is the norm rather than the exception in ecology and epidemiology, where studies produce many short series rather than one long one.
14.8 Further reading
Rabiner (1989) and Jurafsky and Martin (2025) for speech; Durbin et al. (1998) and Eddy (1998) for biological sequence analysis. Hamilton (1989) and Frühwirth-Schnatter (2006, ch. 12) for regime switching in economics. Langrock et al. (2012) and Zucchini et al. (2016, chs. 15–16) for animal movement and ecological applications, which are the best-documented worked examples in the literature. Jackson et al. (2003) for multistate models with misclassification in epidemiology.