I have fit a SARIMAX (1, 0, 0) model to a timeseries dataset consisting of 1 endogenous timeseries ("Y") and 1 exogenous timeseries ("X"). My exogenous timeseries in the model was defined with sm.add_constant. Stationarity and invertibility were enforced in the Statsmodels SARIMAX model. trend = 'n'
The model parameters were:
- const = -0.0218685769848199
- X = 1.02191782244191
- ar.L1 = 0.780715685830694
- sigma2 = 4.942018879444325E-06
I generated the predictions (including out of sample forecasts) using predicted_mean.
For the last (oldest) observed record in the timeseries:
- the model's predicted (and last fitted) value is 0.9948866129977041
- the Y value is 1.00547070891269
- the X value is 0.994948094292246
- the residual (.resid) is 0.010584096
For the first prediction:
- the model's predicted value is 0.990566738090985
- the X value is 0.990720870937109
- (There is no Y value, and also no residual)
In trying to manually recreate the forecasts in Excel, I was only able to match the Statsmodels forecast when I don't include the ARIMA-modelled residuals in my calculation. I was able to match the provided residual.
Here's the model I followed:
ϵ^t−1 = yt−1 − (β0 + β1xt−1) = 0.010584096 (matches the Statsmodels residual for the last (oldest) observed record)
ϵt = ϕ(ϵt−1) = 0.00826316972
Now we can compute yt which should be:
yt = β0 + β1xt + ϵt
= -0.0218685769848199 + (1.02191782244191 * 0.990720870937109) + 0.00826316972
= 0.99882990780828 (which doesn't match the Statsmodels prediction value of 0.990566738090985)
However if I use the following model for yt (which excludes ϵt), it matches the Statsmodels prediction:
yt = β0 + β1xt
= -0.0218685769848199 + (1.02191782244191 * 0.990720870937109)
= 0.99056673809098 (which matches the Statsmodels prediction value of 0.990566738090985)
Does anyone know why the ϵt is not included in the prediction?
Thank you.