spark-timeseries icon indicating copy to clipboard operation
spark-timeseries copied to clipboard

Hope to have a seasonal ARIMA model

Open tninja opened this issue 7 years ago • 1 comments

Current arima model is a non-seasonal one. In our use cases we need to handle seasonal data. Hope to have a seasonal arima model for it.

tninja avatar Aug 11 '16 14:08 tninja

tninja, I can write a seasonal arima implementation, but there are some caveats. I will probably have to write it from scratch in Java, so someone may need to translate to Scala. I'm not sure I can fit my ideas into the current implementation and I have also never written my own Scala programs before. I can start with conditional-sum-of-squares and then we'll see if we can do maximum likelihood. I've written a Kalman Filter (used for ML) in Java before, but felt it was way too slow to use in practice and so scrapped the idea.

If anyone is curious the idea is actually pretty simple and it's what R does to treat seasonality. You simply act as if it's a non-seasonal arima model and put zeros in the indices between the non-seasonal and the seasonal coefficients. The hard part is that you have to make sure to multiply the non-seasonal and the seasonal coefficients together in the correct places with the correct signs. Look up how the autoregressive polynomials work in seasonal arima models to understand why. So if for example you had an SAR(1, 1) model with the ar part = 0.5 and the sar part = 0.3, you would have a single 13 element array with 0.5 at the 0th (first) index, 0.3 at the 11th index, and - (0.5 * 0.3) = -0.15 at the 12th index. It will be more clear when you see it written.

Anyways, I will try to get around to this soon.

signaflo avatar Sep 09 '16 03:09 signaflo