# SVAR, Cholesky decomposition and impulse-response function in R

I have two sets of data from the FRED database: real GDP (y) and GDP deflator (p) and I want to be able to use R in order to estimate a VAR(p) (p determined by AIC) process and generate the sets of impulse-response functions with the short-run assumptions (Sims, 1980) which utilizes the Cholesky decomposition.

Since this is a website for learning, this is a detailed explanation of the process so that this post could actually "teach" something to some of you. If you can help me and you already know how to do it, the first paragraph is actually what I am looking for.

Impulse-response analysis is the analysis of the dynamic response of an economic variable of interest (e.g. real GDP) to shocks in other economic variables such as demand shocks (e.g. inflation) or supply shocks ( e.g. technology). In order to do that, we may want to use a reduced form vector autoregressive process (RVAR):

$Y_{t} = B_{1}Y_{t-1} + B_{t-2} + ... + B_{t-p} + \varepsilon _{t}$

Where:

$Y_{t} = \begin{bmatrix} Y_{1,t}\\ ...\\ Y_{k,t}\\ \end{bmatrix}$

$B = \begin{bmatrix} b_{11} & ... & b_{1k}\\ ... & ... & ... \\ b_{k1} & ... & b_{kk} \end{bmatrix}$

$\varepsilon _{t} = \begin{bmatrix} \varepsilon _{1,t}\\ ...\\ \varepsilon _{k,t}\\ \end{bmatrix}$

The variance-covariance matrix of this process is as follows:

$E\varepsilon _{t}\varepsilon _{t}^{'} = \sum$

And it is a symmetric, positive definite matrix whose off-diagonal values are non zero, which means that the error terms are mutually correlated. Consequently, our attempt to trace the dynamic responses of our variable of interest will be hindered. One solution to this problem is the use of a structural vector autoregressive process (SVAR):

$A_{0}Y_{t} = A_{1}Y_{t-1} + A_{2}Y_{t-2} + ... + A_{p}Y_{t-p} + u_{t}$

Where A0 is the contemporaneous relations between the k variables.

We can multiply both sides of this equation by the inverse of the contemporaneous effect:

$Y_{t} = A_{0}^{-1}A_{1}Y_{t-1} + A_{0}^{-1}A_{2}Y_{t-2} + ... + A_{0}^{-1}A_{p}Y_{t-p} + A_{0}^{-1}u_{t}$

Where:

$\varepsilon _{t} = A_{0}^{-1}u_{t}$

$A_{j} = A_{0}B_{j}$

$E\varepsilon _{t}\varepsilon _{t}^{'} = I$

So here, we need to estimate A0 (which is assumed to be a lower triangular matrix) in order to fully describe the SVAR.

One popular method was proposed by Sims (1980) and involves short-run assumptions using the Cholesky decomposition of the variance-covariance matrix such that:

$\sum = PP^{'}$

Where:

$P = A_{0}^{-1}$

By recursive substitution of the VAR(1) process:

$Y_{t+j} = B_{1}^{j+1} + Pu_{t+j} + B_{1}Pu_{t+j-1} + ... + B_{1}^{j}Pu_{t}$

And finally, the impulse-response function of Y_t+j is:

$\psi _{j} = B_{1}^{j}P$

As you can see, I understand the process completely and I would like to be able to do it using R. So what I'm trying to do is: (i): Estimate the final VAR(p) process (p determined by AIC) (ii): Generate the impulse-response function

Thank you very much.

-