Dynamic multipliers for an ARDL model

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Fifis
Posts: 23
Joined: Thu Jan 06, 2022 11:48 pm

Dynamic multipliers for an ARDL model

Postby Fifis » Tue May 24, 2022 6:16 am

Dear all,

I would like to know if it is possible to somehow generate or visualise the dynamic multipliers after an ARDL model has been estimated. I have searched the manual and the menus, but found nothing. There are IRF, FEVD and historical decompositions for VAR/VECM, but I was not successful in finding any remotely similar decomposition in the ARDL framework.

Any stable ARDL model can be iteratively rewritten to get rid of the lags of Y on the right-hand side, obtaining an equivalent equation defined in terms of exogenous regressors and their lags only.

In theory, if A(L)Y[t] = B(L)X[t] + U[t], then, the final form is Y[t] = A(L)^(-1)B(L)X[t] + A(L)^(-1)U[t], where the transfer function A(L)^(-1)B(L) contains the dynamic multipliers (infinitely many of them). Of course straightforward inversion of A(L) might involve complex roots, and I do not see how the polynomials could be multiplied in a simple manner, so I usually compute the dynamic multipliers by simple iterated substitution for a large-enough horizon. Here is how I had to do it in R to get something:

Code: Select all

genDM <- function(endog.lag, # A vector of AR coefficients on Y[t-1], Y[t-1] etc.
                  exog.lag, # A list of vectors of DL coefficients on X[t], X[t-1] etc.
                  h = 50, xnames = NULL) {
  # The presence of a constant term does not change the responses of other variables
  if (is.vector(exog.lag, mode = "numeric")) exog.lag <- list(exog.lag)
  k <- length(exog.lag[[1]]) # How many exogenous regressors
  p <- length(endog.lag) # AR order
  q <- length(exog.lag) - 1 # Distributed lag order: the contemporaneous value is always there, i.e. q shows how many extras are there
  if (q > 0) {
    if (!all(diff(sapply(exog.lag, length)) == 0)) stop("The list of coefficients on exogenous lags must contain elements of equal lengths.")
  }
  if (is.null(xnames)) xnames <- paste0("X", 1:k)
  if (length(xnames) != k) stop("The list of variable names must have the same length as the number of coefficients.")
  for (i in 1:(q+1)) names(exog.lag[[i]]) <- xnames
 
  cat("Iteratively computing the dynamic multipliers for an ARDL(", p, ", ", q, ") model:\n" , sep = "")
  cat("Y[t] = ", paste0("c", 1:p, "*Y[t-", 1:p, "]", collapse = " + "), " + ", paste0("b", 0:q, "*X[t-", 0:q, "]", collapse = " + "), " + U\n" , sep = "")
  cat("The output contains the RHS coefficients of the final form:\nY[t] = sum[i=0 to +Inf] {a[i]*X[t-i] + b[i]*U[t-i]}\n")
  max.order <- max(p, q)
 
  hh <- h + max.order + 1 # For trimming afterwards
  # Data frame structure: dep. var., X, error term
  d <- matrix(0, nrow = hh, ncol = length(exog.lag[[1]]) + 2)
  rownames(d) <- paste0("t+", rev((1:hh)-1))
  # d[, 1] is the dependent variable, d[, ncol(d)] is the error term
  # d[, -c(y, e)] is all the middle columns corresponding to regressors
  # Indices instead of names are used because many data sets have variables names like "Y", "U", "Error" etc.
  y <- 1
  e <- ncol(d)
  dl.matrix <- do.call(rbind, exog.lag)
  d[hh, e] <- 1 # Starting at the end (time 't')
  d[hh - 1:p, y]        <- endog.lag
  d[hh - 0:q, -c(y, e)] <- dl.matrix
  # At each step, substituting only one term
  # y[t] = rho1*y[t-1] + {...} + U[t]
  # y[t-1] = rho1*y[t-2] + [...] + U[t-1]
  # Therefore, y[t] = rho1*(rho1*y[t-2] + [...] + U[t-1]) + {...} + U[t]
  for (i in 1:h) {
    rho <- d[hh-i, y]
    d[hh-i, e] <- rho
    d[hh-i-(1:p), y] <- d[hh-i-(1:p), y] + endog.lag*rho # Coefficients on the further lags of Y
    d[hh-i-(0:q), -c(y, e)] <- d[hh-i-(0:q), -c(y, e)] + dl.matrix*rho
    d[hh-i, y] <- 0
  }
  pers <- sum(abs(d[1:(max.order+1), y]))
  if (pers > sqrt(.Machine$double.eps)) warning("There is too much remaining persistence.\nEither increase the horizon (h) or check the model (it seems to be unstable).")
  cat("=====\nComputations terminated with ", pers, " persistence remaining after horizon ", h, ".\n", sep = "")
  colnames(d) <- c("DroppedY", xnames, "Error")
  return(d[nrow(d):(max.order+1), -y])
}


Then, this function will compute the dynamic multipliers for an ARDL model of any length. E.g. for Y[t] = 0.7*Y[t-1] - 0.8*Y[t-2] + (0.8, 0.7, -0.3)'X[t] + (-0.2, 0.15, -0.2)'X[t-1] + U:

Code: Select all

a <- genDM(endog.lag = c(0.7, -0.2),
            exog.lag = list(c(0.8, 0.7, -0.3),
                            c(-0.2, 0.15, -0.2)))
                     
> Iteratively computing the dynamic multipliers for an ARDL(2, 1) model:
> Y[t] = c1*Y[t-1] + c2*Y[t-2] + b0*X[t-0] + b1*X[t-1] + U
> The output contains the RHS coefficients of the final form:
> Y[t] = sum[i=0 to +Inf] {a[i]*X[t-i] + b[i]*U[t-i]}
> =====
> Computations terminated with 1.207625e-18 persistence remaining after horizon 50.


Now the direct contributions of the explanatory variables at any horizon are clearly visible via the dynamic multipliers:

Code: Select all

round(head(a), 3)
>         X1     X2     X3  Error
> t+0  0.800  0.700 -0.300  1.000
> t+1  0.360  0.640 -0.410  0.700
> t+2  0.092  0.308 -0.227  0.290
> t+3 -0.008  0.088 -0.077  0.063
> t+4 -0.024  0.000 -0.008 -0.014
> t+5 -0.015 -0.018  0.009 -0.022


And the long-run effects are exactly equal to the total multipliers = sums of dynamic multipliers:

Code: Select all

round(colSums(a), 3)
>    X1    X2    X3 Error
>   1.2   1.7  -1.0   2.0


Can I achieve a similar decomposition (or at least a visualisation similar to the IRF for VAR/VECM) in EViews 12 (build 2022-04-22)? Sorry if the function is too long, I am just so used to writing functions after R and Python filtering many inputs, it is hard to instantly come up with an equivalent EViews approach that would yield the same result, so this is why I am asking for help.

Many thanks in advance!

Yours sincerely,
Andreï V. Kostyrka

EViews Mirza
Posts: 80
Joined: Sat Apr 22, 2017 8:23 pm

Re: Dynamic multipliers for an ARDL model

Postby EViews Mirza » Tue May 24, 2022 9:17 am

Dear Andrei,

At the moment, in EV12 and earlier, there is no way of generating dynamic multipliers for ARDL regressors, unless you write your own code to do so. However, we will introduce the ability to visualize dynamic multipliers for ARDL regressors with the release of EV13. Note that the beta version of EV13 will be released soon and you'll be able to preview the feature then.

Kind regards,
Mirza


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 9 guests