Search code examples
pythonpython-importstatsmodelshidden-markov-modelsmarkov-models

Markov Switching Model in Python Statsmodels


I would like to estimate a Markov Switching Model as done in the following: http://www.chadfulton.com/posts/mar_hamilton.html

However, when I try to import the function to fit the model, i.e.

from statsmodels.tsa.mar_model import MAR

I get the following error message:

ImportError: No module named 'statsmodels.tsa.mar_model'

What can I do to solve this error?


Solution

  • A new version of Statsmodels including the Markov switching code has not yet (at least as of 8/8/16) been released. If you are using an older version of Statsmodels (e.g. 0.6.1) then the code will not be available for you.

    A release candidate (0.8.0rc1) is available on PyPi, or you can download and install the cutting edge development version from Github (https://github.com/statsmodels/statsmodels/).

    It is possible that a final release of v0.8 will happen this month, but nothing is certain yet.