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:
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:
- Fits SARIMAX model on data and gets predictions for the next 4 quarters
- Fetch the model parameters ma.L1, ar.S.L12, ma.S.L12 to build equation
- Difference the revenue data and get residuals from result.resid
- Run forecasts using the equation
- Compare the results
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.