Starting with this post I laid out the motivation for my recently renewed interest in time-series analysis. To recap, my basic motivating question is, “what do I do if I’m modeling a process I suspect is seasonal (monthly landings in a commercial fishery for example) but I also have reason to suspect the nature of seasonality might be changing?”

To be a bit more specific here, I’m dealing with several years worth of data on total monthly catches by a group of fishermen. The data exhibit some seasonal signals with catches tending to be higher in the summer and early fall and lower in the late fall, winter, and early spring. I observe that a particular regulation went into effect in year and I suspect that regulation may have altered the seasonal pattern of landings. The complicating factor is that various regulations and environmental conditions have been influencing this process since the beginning of my data….so it is not immediately obvious whether I should expect this process to exhibit a discrete and notable change in seasonality at time or if I should expect the seasonal pattern in the data to exhibit many (possibly subtle) changes.

In my reading of the literature I determined I have two intellectual paradigms to choose from:

- Smooth transition/regime change models
- Markov Regime Switching Models, ala Hamilton 1989 and many others.
- Smooth transition regressions

- Change-point detection models including
- identification and dating of unknown structural breaks
- Bayesian change point models

The conceptual difference between items #1 and #2 hinges on whether you are

- dealing with a process that moves back and forth between a finite number of states (and the process behaves differently in each state)
- the canonical example here is a macro-economic time-series that may have a different mean and variance depending on whether we are in an expansionary or contractionary phase of the business cycle.

- dealing with a process that, once it departs from its past behavior at some point in the time-series, never returns to exhibit similar properties as before.
- an example I’ve seen used here is the demand for red meat and poultry among American consumers around the 1970s. Somewhere in this time the relationship between demand for these two products was fundamentally and permanently altered as consumers became more health conscious. The implication being that the time-series here can really be modeled as two completely different series: those observations before 1978 and those observations after 1978.

In the interest of keeping this a little bit concise and digestible I’m going to, for the moment, abstract away from the discussion about how one decides on the right modeling approach and just focus on how to implement these approaches (I’ll circle back to the issue of which approach is the right on in a future post….maybe Time-series VII or VIII).

I’m going to start with the Markov Regime Switching Model because its one I’ve worked with before and I’m at least a little familiar with it. My first goal – the one I will focus on in this post – is just to understand the basic mechanics and properties of Markov Regime Switching Models.

#################################################################

#################################################################

#################################################################

First, a picture…because I really like pictures. Goldfeld and Quandt (1973), Hamilton (1989) and a bunch of other really smart dudes observed that certain macro-economic time-series like the unemployment rate, federal funds rate, new housing starts, etc. seem to behave differently depending on whether the economy is in an expansionary or contractionary phase.

To illustrate what this might look like, it’s not hard to image a financial asset that is more volatile during market downturns and less volatile during bull markets. Let be the percent return on an asset.

If we were to generate data from the following process:

when we are in regime 0, and

when we are in regime 1

and we define periods 1-10, 16-30, and 40-60 to be in regime 1…we might produce something like this:

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

Ok, so now that we’ve seen what a Markov Regime Switching Process might look like, let’s run through the discount version of what a Markov Regime Switching Model is….I can’t really improve on the many tutorials already out there so I’ll try to keep this brief:

I’m cribbing heavily from one of Erik Kole’s examples because I find it very clear. Suppose we have data on financial returns of a particular asset (call this )and these returns are governed by different processes depending on whether we are in economic expansion or economic recession. This means the distribution of returns at time , , depends on the state of the economy at time (call this ).

Call this ‘state of the economy’ process the regime and let if we are in recession and if we are expansion.

The return is governed by the process,

if , and

if .

So is distributed normal with average returns and variance when we are in regime 0…and likewise for regime 1 with average returns and variance .

The kicker here is that we don’t directly observe the regime in time so we need a model that will allow us to make inferences on the unobserved regimes based on the data we do observe. The inference we want takes the form of two probabilities:

where and denotes the information available to us at time and is a parameter vector.

In this case we are assuming the unobserved state (regime) follows a Markov Process – meaning that all the information we need to predict next period’s value is contained in last period’s value. So now we introduce the regime-transition parameters. Let:

.

The probability model for the unobserved state can now be formed using Bayes’ Rule:

Here, it is worth highlighting a few things:

1.

That is, once inference has been made about the probability of being in each of the two regimes in time , we can use the transition probabilities that are part of the parameter vector to forecast the regime probabilities for next period.

2. .

The conditional density of Y given the current regime, past information, and parameter vector is normal with parameters depending on the regime…this is by assumption of the model.

We can do a couple things to represent this a little more compactly:

First, let

**P**=

and let,

finally, denote

Now the series of inference and forecast probabilities regarding the unobserved state (regime) that we need can be expressed as,

and

This probability model can be solved for the optimal values of using maximum likelihood by noting that the conditional likelihood function is:

,

and noting that the log likelihood function can be written,

.

A popular way to maximize this function for optimal parameter values is through the use of the Hamilton Filter. I’ll post some code for that tomorrow.

#################################################################

#################################################################

#################################################################