0
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ The issue comes from the MA terms, and is described at stats.stackexchange.com/questions/430186/…. 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". $\endgroup$
    – cfulton
    Commented Jul 2, 2021 at 15:04
  • $\begingroup$ 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. $\endgroup$
    – Mohammad
    Commented Jul 5, 2021 at 2:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.