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

How do I run a seasonal ARIMA model?

Open alexkokorin2 opened this issue 7 years ago • 3 comments

I know my (p,d,q)(P,D,Q)_M (seven) coefficients, where should I put them? This library has only 6 coefficients as far as I could see.

This library has a nice sample code in README: https://github.com/Workday/timeseries-forecast

alexkokorin2 avatar May 24 '18 21:05 alexkokorin2

Is M the mean or the seasonal frequencyThanks for the link to that library. It looks like a good one.

Right now the seasonal frequency is computed automatically. The TimeSeries class contains information about the period of time between observations and the Arima interface is where to set the seasonal cycle of the model. For example, the most common use case in the domain I work in is to have a time period of one month for the TimeSeries observations and a seasonal cycle of one year. The seasonal frequency is computed here

As I review this code, I think it might be better to give users the option to set the seasonal frequency explicitly. I think I definitely want to add an Arima builder as well.

signaflo avatar May 24 '18 22:05 signaflo

Seasonal frequency.

alexkokorin2 avatar May 25 '18 08:05 alexkokorin2

When I run this code for input: https://pastebin.com/Y1fKKf0d I get extremely flat output (basically 300 of 15 and 420 of 16). Isn't it really strange?

TimeSeries timeSeries = TimeSeries.from(Doubles.toArray(timeseries));
        ArimaOrder modelOrder = ArimaOrder.order(0, 1, 1, 0, 1, 1); // Note that intercept fitting will automatically be turned off
        Arima model = Arima.model(timeSeries, modelOrder);
        // Read forecast values

        Forecast forecast = model.forecast(forecastSize); // To specify the alpha significance level, add it as a second argument.

alexkokorin2 avatar May 25 '18 16:05 alexkokorin2