How to forecast macro fundamentals

We will build a SARIMAX model for monthly data on an industrial production time series for the 1988-2017 period. As illustrated in the first section on analytical tools, the data has been log-transformed, and we are using seasonal (lag-12) differences. We estimate the model for a range of both ordinary and conventional AR and MA parameters using a rolling window of 10 years of training data, and evaluate the RMSE of the 1-step-ahead forecast, as shown in the following simplified code (see GitHub for details):

for p1 in range(4):                # AR order
for q1 in range(4): # MA order
for p2 in range(3): # seasonal AR order
for q2 in range(3): # seasonal MA order
y_pred = []
for i, T in enumerate(range(train_size, len(data))):
train_set = data.iloc[T - train_size:T]
model = tsa.SARIMAX(endog=train_set, # model specification
order=(p1, 0, q1),
seasonal_order=(p2, 0, q2, 12)).fit()

preds.iloc[i, 1] = model.forecast(steps=1)[0] # 1-step ahead forecast

mse = mean_squared_error(preds.y_true, preds.y_pred)
test_results[(p1, q1, p2, q2)] = [np.sqrt(mse),
preds.y_true.sub(preds.y_pred).std(),
np.mean(aic)]

We also collect the AIC and BIC criteria that show a very high rank correlation coefficient of 0.94, with BIC favoring models with slightly fewer parameters than AIC. The best five models by RMSE are:

                 RMSE         AIC         BIC
p1 q1 p2 q2
2 3 1 0 0.009323 -772.247023 -752.734581
3 2 1 0 0.009467 -768.844028 -749.331586
2 2 1 0 0.009540 -770.904835 -754.179884
3 0 0 0.009773 -760.248885 -743.523935
2 0 0 0.009986 -758.775827 -744.838368

We re-estimate a SARIMA(2, 0 ,3) x (1, 0, 0) model, as follows:

best_model = tsa.SARIMAX(endog=industrial_production_log_diff, order=(2, 0, 3),
seasonal_order=(1, 0, 0, 12)).fit()
print(best_model.summary())

We obtain the following summary:

The coefficients are significant, and the Q statistic rejects the hypothesis of further autocorrelation. The correlogram similarly indicates that we have successfully eliminated the series' autocorrelation:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.93.59.171