1

I have been trying to fit a Markov Switching Regime model using epoch timestamps as my x-axis and I keep receiving this error:

ValueError: On entry to DLASCL parameter number 5 had an illegal value

This error occurs after I fit the model when I try to call the .summary()

Also, during the model fit I get the following convergence warning:

 ConvergenceWarning: Maximum Likelihood optimization failed to converge. Check mle_retvals 
"Check mle_retvals", ConvergenceWarning)

I really have no clue what is the issue as I have no missing values and all my data is normally distributed. I am using data from a pandas dataframe but I am converting them to numpy arrays before I fit as well. I also tried converting my unix timestamps to datetime objects, time objects, and nothing worked.

What is statsmodels expecting here as an input?

guy
  • 1,021
  • 2
  • 16
  • 40
  • 1
    The illegal value is usually a nan or inf. My guess is that something is not available because of the failed convergence. I have no idea what that might be. Tracking this down and opening a statsmodels issue would be helpful because failed convergence should not result in invalid values being used in the linear algebra libraries. – Josef Apr 21 '17 at 00:53
  • For the optimization failure, one possibility is to try different optimization methods to see whether some converge, e.g. starting with Nelder-Mead `method='nm'` is usually the most robust method. In the case of MarkovSwitching, increasing `em_iter` might also be helpful for bad cases. – Josef Apr 21 '17 at 00:57
  • Thanks I'll try different convergence methods to get one to stick. I also don't have any NaN or Inf values so that error is very strange indeed. I also imported the exact same dataset into R and it worked perfectly with the R markov switching model package. – guy Apr 21 '17 at 01:18
  • Given that the model is new in statsmodels it will take time and feedback to figure out how it behaves and how to improve it in "not nice" cases, or even to figure out what recommendations would help in specific cases. – Josef Apr 21 '17 at 03:33

0 Answers0