Sometimes time-series data derive from an underlying system which can exist in multiple distinct states. Hidden Markov Models (HMMs) are a popular approach in this situation. In a particular state, the data fluctuate with variance characteristic of that state. An N x N transition probability matrix describes the additional dynamics associated with flipping between the N states. The value of N and nature of the unobserved states may or may not be obvious depending on the problem.
Yields on long-term British government debt for the period 1727-2013 are available from the UK debt management office (annual mean yields on perpetual bonds or “consols”). Bond yields change in response to market perceptions of risk. Historically, volatile periods tend to be associated with large attritional wars, such as Seven Years War (1754-1763), Napoleonic wars (1803-1815), World War One (1914-1918) etc.
It is tempting to fit a HMM to the (differenced) gilt yield data. N is found by minimising the Bayesian Information Criterion (BIC). It turns out that N=3 is optimal for the differenced time-series (code and graph below).
The modern era of high inflation requires a third underlying state “I” which lasted from 1968-1999.
Code
The R code below returns N=3.
library(RHmm)
file.in <- “https://joewheatley.net/wp-content/uploads/2014/09/consol.csv”
gilt <- read.csv(file.in)
returns <- diff(gilt$yield)
bics <- sapply(2:10, function(nn) HMMFit(returns, dis=”NORMAL”, nStates=nn)$BIC)
which.min(bics)+1