How To Forecast Using Gretl? A Practical Example -Part Two

In the first part of this tutorial, we have learned how to check the stationarity of a time series data using multiple methods. Now, we are going to learn how to build multiple ARIMA models and decide which one to use for our forecast.

One we transform our series to be stationary, the second step is deciding on how many lags we want to include in our model. Keep in mind that in ARIMA models, we are using the own lags of USEPUINDXD and optionally moving average of our dependent variable as independent variables. As I mentioned in the first part of this tutorial, Correlograms help us to decide the number of lags to consider. Correlogram of the stationary series is as below:


 













Now, we should choose the number of Auto-Regressive (AR) lags based on ACF, and the number of Moving Average (MA) lags based on PACF. At the first glance, it seems that we can choose one AR lag and 5 MA lags. Also, as we applied the first difference to our series to make it stationary, "I" is going to be 1. AR (1) I (1) MA (5). In short, ARIMA (1,1,5)

Now, click on Model, then choose Univariate time series and then choose ARIMA. In the window that pops up, choose the parameters as we previously decided. If you choose USEPUINDXD as the dependent variable, you should choose I as 1. However, if you decide to choose d_USEPUINDXD instead, you automatically use the first-differenced series as the dependent variable so set I as 0. Both are exactly the same. When you are done, click on OK. Finally, it should look like this:







































Now, we got the details of our model. Keep in mind that phi_1 is your AR lag and theta_1-5's are your MA lags. It shows that the AR lag and 4 MA lags are statistically significant. I have also highlighted Akaike criterion, as it is going to be another decision parameter of ours in terms of finding the optimal model. Rule of thumb: The smaller AIC (Akaike Information Criteria), the better.

Now, we are ready to forecast. In the model window, click on Analysis and the Forecasts. It will ask you how many observations you want to add. As our series is daily, let's set it as 30 to make a daily forecast for 30 days. Click on OK. In the next window, you can leave all inputs as default and then click on OK again. The forecast graph is as below:
















It seems that our forecast is pretty smooth. It generally follows the upward-downward trends in USEPUINDXD, but it is unable to catch booms and slumps accurately. Even though our model seemed to do well in terms of parameters' statistical significance, I can not claim that this is a good forecast. Now, in order to compare it, let's build an ARIMA (1,1,1) model.





























Both variables are statistically significant, and AIC results are very similar to the previous model. Now let's see the forecast:

















Forecasts of both models are similar. Now we will check one final criterion, which is "Theil's U". Same with the AIC, the rule of thumb is: The smaller, the better. Also, it means that if Theil's U result is less than 1, our forecasts are better than the naive model. For both models that we have created, click on Analysis and then Display actual, fitted, residual. Scroll down to the end and there you see Theil's U result. An example is below:














So, finally: the AIC of our first model is 20132.78, and the second model is 20134.75. Similarly, Theil's U result of our first model is 0.59087, and the second model is 0.59303. Both criteria indicate that our second model is slightly better than the first model. At the same time, as both Theil's U results are less than 1, both models are to forecast USEPUINDXD better than the naive model.

Last but not least: Based on the forecast results, it seems that we need more estimators than the AR-MA lags of  USEPUINDXD for an accurate forecast. In my next tutorial, I continue with applying ARCH and GARCH methods to see whether they work better than ARIMA on forecasting USEPUINDXD. 

Sources:

http://gretl.sourceforge.net/
https://fred.stlouisfed.org/series/USEPUINDXD

 

 

No comments:

Post a Comment

How to Build an Econometric Forecasting Model in R? A Step-by-Step Guide-1

In this post, I am going to build an econometric regression model in R from scratch. As an example, I have decided to use the monthly unempl...