7.4 Dynamic Forecasting

7.4.1 ADL

Basically ADL is doing and Autoregressive (AR) model and then we add another variable (this could be anything) which is lagged. Notice that we can model with the order of lagged variables to be included in the model.

As the model is based on AR models, we must have stationarity in the data, just as in normal AR models.

Hence we have the following equation:

\[\begin{equation} ADL_{\left(p,q\right)} \tag{7.6} \end{equation}\]

Where

  • p = the order of AR (lags of the y variable)

  • q = the number of lags for the added variable

Procedure:

  1. Create the AR model

  2. Find the other relevant variable. Transform it to a timeseries using, ts()

  3. Include the lags in the model using lag(<ts.object>,<number of lags>)

Example of how it may look:

# GDPGR_ADL22 <- dynlm(GDPGrowth_ts ~ #The dependant variable
#                        L(GDPGrowth_ts) #The AR(1),The dependant variable lagged
#                      + L(GDPGrowth_ts, 2)  #The AR(2),The dependant variable lagged
#                      + L(TSpread_ts)  #Another TS lagged
#                      + L(TSpread_ts, 2) #Another TS lagged two periods
#                      ,start = c(1962, 1), end = c(2012, 4))

L() = lag(), if number of lags are not

#TB3MS <- xts(USMacroSWQ$TB3MS, USMacroSWQ$Date)["1960::2012"]

Automatic process

Notice that this can be done with the following procedure

  1. Run auto_ardl(), where you apply the stationary Y and data = table ordered according to cholesky ordering(7.4.2.3). Set max_order = to something relevant.
  2. Run adl <- model$best_model
  3. Retrieve the p and q with adl$order
  4. One can run the summary to see the model. But the most interesting part is the assessment of how many lagged periods from both variables to include.

7.4.2 Vector autoregressive (VAR)

In the approach in ADL we only work with one other variable. Although with VAR models, we are able to include multiple independent variables. This can be written as:

\[\begin{equation} VAR(p) \tag{7.7} \end{equation}\]

Where:

  • p = p lags of the variable, one can apply VARselection(), this will yield p lags, notice, that it will be the same for all variables.

See an example in section 7.6.2.2

7.4.2.1 Selection criteria

One may use AIC, BIC or make out of sample assessment to select the best model, hence identifying what lags to be included in the model.

7.4.2.2 Process

Note, it is only within our curriculum with one variable.

  1. cbind a table consisting of stationary y series and the x variables (Cholesky applies, but is not very important when having two variables, see more in section 7.4.2.3). Store it as an ts() object.
  2. Run VARselect(z,lag.max = 14,type="const")[["selection"]]
    • Note, selection is just retrieving an object that is encapsuled
  3. Run VAR(z,p=<insert>,type="const") Apply p with the value that was found in step 2
  4. One can do the summary()
  5. Check residuals for serial correlationserial.test(var1,lags.pt=14,type="PT.asymptotic").
  6. Obtain impulse response function, using plot(irf(var1,boot = TRUE, ci=0.95))
    • Notice, that it is calculated based on the Cholesky ordering

7.4.2.3 Analyzing response to shocks in other variables - Cholesky Ordering

You want to order the variables so the most exogenious variable as first, then less exogenious until you have the last, which is the most endogenious

If one is only having two variables (including IDV and DV), then the ordering is not that important

First, let us clarify the following terms

Exogenious vs. endogenious

Terms:

  • Exogenious: if a variable is extremely exogenious, it is not explain or determined by other variables
  • Endogenious: if a variable is extremely endogenoius, it is explianed or determined by one or more variables.

This can be used to rank variables based on how much they are affected by other variables, with the most exogenious variable first (This is called Cholesky ordering), hence we rank based on the following principle:

lets say, that we have four variables, we want to order according to Cholesky ordering

  1. Most exogenious
  2. Less exogenious than 1 more than 3. Hence, more endogenious than 1. but less than 3.
  3. Less exogenious than 2 more than 4. Hence, more endogenious than 2. but less than 4.
  4. Most endogenious

Importance!

This is important, as it matters in the end how the forecast is done. see slides from lecture 10 page 12.

How is this corrected????

  1. Make the df, with the, see example when loading data in 7.6.2.1
  2. Call the df ‘z’
  3. Order the variables in accordance with the Cholesky ordering.