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

ARIMA is unstable on incomplete seasons

Open JBudinGanacos opened this issue 2 years ago • 1 comments

I am making ARIMA predictions with yearly seasonality and data. with 24 months of history, the prediction is as good as cn be expected with s little data, but if I use 25 months of history, the prediction is very unstable (slightly modifying one measure can result in a massive trend change).

Example input : 10 | 11 | 12 | 8 | 6 | 4 | 5 | 6 | 6 | 5 | 4 | 3 | 2 | 2.5 | 3 | 2 | 1 | 0.5 | 0.1 | 0 | 1 | 0.2 | 1 | 0 | 0.3 | 0.4 | 0.2 with the following ARIMA parameters : p = 0 d = 1 q = 1 aP = 0 aD = 1 aQ = 1, the previsions are increasing (athough the history is clearly decreasing). Changing the second value (the 11) into a 13 or a 9 makes the predictions seem correct.

When I perform the same prediction with only the 24 first value, the prediction is not as sensitive, and changing one input value only marginally affects the prediction.

See screenshot : Capture

I suspect this is due to this line in ArimaModel.java : this.differencedSeries = observations.difference(1, order.d()).difference(seasonalFrequency, order.D());

JBudinGanacos avatar May 12 '23 12:05 JBudinGanacos

When I replace the 2nd value (11) by 13, this is what I get, which seems a lot more appropriate.

Capture

JBudinGanacos avatar May 12 '23 12:05 JBudinGanacos