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):



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

Variance-covariance matrix

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):

Variance-covariance matrix

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:

Structural form VAR


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:


By recursive substitution of the VAR(1) process:

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

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.


Take a look at the package vars in R.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.