0

I am trying to manually replicate forecasts obtained by SARIMAX(0,1,1)(1,0,1,12) statsmodels v0.12.2 predict method.

You can find the dataset here.
You can find the code to get forecasts based on model and equation here

Following is the result summary from statsmodels: enter image description here

Considering the equation below for the SARIMAX(0,1,1)(1,0,1,12) to manually replicate the forecasts.

$ {SARIMAX(0,1,1)(1,0,1)_{12}} \\ y_i = {\Phi}_1*y_{i-12} + {\theta}_1*\epsilon_{i-1} + {\Theta}_1*\epsilon_{i-12}+ {\theta}_1*{\Theta}_1*\epsilon_{i-13} $

Above mentioned code does the following:

  1. Fits SARIMAX model on data and gets predictions for the next 4 quarters
  2. Fetch the model parameters ma.L1, ar.S.L12, ma.S.L12 to build equation
  3. Difference the revenue data and get residuals from result.resid
  4. Run forecasts using the equation
  5. Compare the results

enter image description here enter image description here

As you can the see the above plot, there is a slight difference in predictions from model vs the predictions from equation. Not sure what I am missing here!

PS: I have seen other articles similar to this but I couldn't sort this out. Any help would be greatly appreciated.

Mohammad
  • 1
  • 1
  • The issue comes from the MA terms, and is described at https://stats.stackexchange.com/questions/430186/how-statsmodels-predict-ma-process/430274#430274. Your approach here will work exactly when the sample size is larger, but in your case there is still a small impact from the "initialization" or "prior". – cfulton Jul 02 '21 at 15:04
  • Yes, the impact is quite less. I will update this post when I perform this test on a larger sample size. Thanks for your inputs @cfulton. – Mohammad Jul 05 '21 at 02:14

0 Answers0