alkaline-ml / pmdarima

A statistical library designed to fill the void in Python's time series analysis capabilities, including the equivalent of R's auto.arima function.
https://www.alkaline-ml.com/pmdarima
MIT License
1.59k stars 234 forks source link

Weird residual values when differencing (d) > 0 #175

Closed notdsr closed 5 years ago

notdsr commented 5 years ago

After running auto.arima model, when I am trying to get the residual values the value it gives for the 1st data point when differencing parameter (d) >0 is wrong. I have attached the screenshot for the reference. Since in my case d is equal to 1 so in the plot we can see that predicted values are 1 period of lag. My current model is SARIMAX(1, 1, 1)x(1, 0, 0, 52). Post-processing is req

bug1 bug2

uired to get the right values.

tgsmith61591 commented 5 years ago

Unfortunately that's going to be a known side effect of differencing, since the entire algorithm is fit over n - d samples.

Best advice I can give is start your residual plot from d.

notdsr commented 5 years ago

Got it! But that's not the case in R, there is some post-processing is being done to get the right values.

tgsmith61591 commented 5 years ago

As close as we try to be to R's forecast package, it's not 1:1. You could probably back into that value, but it may be a pain. If you end up figuring it out, PRs are always welcome!

tgsmith61591 commented 5 years ago

Closing this. But welcome a PR if you figure out a way to back into it...