1

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?

Egodym
  • 453
  • 1
  • 8
  • 23
  • I am not entirely sure that mar_model is contained in the "orginial" module. You might need to pull from github. – Philipp Braun Aug 08 '16 at 22:35
  • Did you care to read the disclaimer on the website you linked? Let me paste it here, for your convenience: "Note: this code is now obsolete - it has been superseded by a new version which can be found here." The code is obsolete, ergo, the package `statsmodels.tsa` has been replaced by something else, ergo, the `ImportError`... – Kartik Aug 08 '16 at 22:50
  • Thanks, I didn't notice it. However, if I now run `from statsmodels.tsa.regime_switching.tests.test_markov_autoregression import rgnp` I get again an error message `ImportError: No module named 'statsmodels.tsa.regime_switching'` – Egodym Aug 08 '16 at 22:56

1 Answers1

1

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.

cfulton
  • 2,855
  • 2
  • 14
  • 13