Get Started

Dynamic regression

1. Dynamic regression

So far we have used forecasting models that use only the history of the time series, but do not use any other information. But often there is additional information available that will help us make better predictions. For example, if we are forecasting monthly sales, then we could use the advertising expenditure for the month to improve our forecasts. Or perhaps, information about competitor activities. Dynamic regression is one way of combining this external information with the history of the time series in a single model.

2. Dynamic regression

The model looks like a standard linear regression model. It has the variable to be forecast on the left hand side and several predictor variables on the right hand side. These provide the external information that we wish to use when forecasting. The difference with ordinary regression is in the error term.

3. Dynamic regression

In dynamic regression, the error term is an ARIMA process,

4. Dynamic regression

whereas in ordinary regression, the error term is white noise. This ARIMA process is where the historical information about the time series is incorporated.

5. US personal consumption and income

Let's look at an example. These two time series show quarterly changes in US consumption and quarterly changes in US personal income. We might want to forecast consumption, and use income as a predictor variable. If there is a drop in income, we might expect that consumption would drop as well, and vice versa.

6. US personal consumption and income

This plot shows the relationship between the two variables. Clearly there is a positive relationship between them as we expected. It's not a particularly strong relationship, but it does provide some useful information that will help give us better forecasts of consumption.

7. Dynamic regression model for US personal consumption

Fitting a dynamic regression model is not much more difficult than fitting an ARIMA model. You still use the auto-dot-arima function. It just needs one more argument. The xreg argument contains a matrix of predictor variables that you want to include in the model. In this case, there is only one predictor variable, the change in income. When you include an xreg argument, auto-dot-arima will fit a dynamic regression model, rather than a regular ARIMA model. In this case, it has fitted a linear regression to the income variable, and then chosen an ARIMA(1,0,2) model for the errors. As usual, the ARIMA coefficients are not particularly interpretable, but the regression coefficient is interpretable. Here, we see that consumption change increases by 0-point-25 percentage points when income changes by 1 percentage point. In dynamic regression models, the regression part takes account of the predictor variable, while the ARIMA model takes care of the short-term time series dynamics.

8. Residuals from dynamic regression model

As with all forecasting models, we should check that the residuals look like white noise. The Ljung-Box test here has a p-value above 0-point-05, which means these residuals do look like white noise.

9. Forecasts from dynamic regression model

To forecast with a dynamic regression model, we need to provide future values of the predictors. Either we can forecast these in a separate model, or we can do scenario forecasting where we look at the effect of different values of the predictor on the forecasts. The future values of the predictors need to be passed to the forecast function using the xreg argument, just as the past values were included in the auto-dot-arima function. Here we have assumed the future income changes will be 0-point-8 percentage points per quarter for the next 8 quarters.

10. Let's practice!

Now it's your turn to try using dynamic regression on a different time series.