Vector Autoregression in R

statistics

#1

Hey guys,
I’ve been trying for a while to replicate the vector autoregression analysis that I used to do in Stata.
Is anyone aware of a template or a video that will teach me to write a VAR?
I tried looking at documentation but for some reason its hard for me to apply what I read.

I want to do the following:

  1. Identifying supply (inflation) and demand (gdp) shocks. A line graph showing supply shocks for all countries and same for demand shocks.
  2. Find correlations of supply and demand shocks across the countries. A matrix like table with countries on the columns, countries on the rows and their correlations value. one table for demand, one for supply.
  3. Get Impulse responses. Explanation of results.
  4. Get variance decomposition. Graphs.

#2

First, have you reviewed the R project task view for Econometrics, especially the section Time series data and models which discusses VAR models?

https://cran.r-project.org/web/views/Econometrics.html

Second, which VAR package are you using?


#3

Oops. Should have included:

Third, have you searched the R-SIG-Finance mailing list? Topics such as VAR modeling are frequently discussed there.


#4

I’m using the VARS package. I get the oddest results so I must be doing something wrong. That’s why I was hoping that someone has done this for a simple project where two variables are compared.

I will check out the financial links! Thanks!
Usually the finance application is WAYYY more complicated.


#5

OK, so I should never post anything at 6:00 AM.

It turns out the Time Series task view, not the Econometrics task view, has more details regarding VAR models (https://cran.r-project.org/web/views/TimeSeries.html). Scroll down to the section on Multivariate Time Series Models.

I have not read every vignette for every VAR package, but I’d be surprised if none contain an example of a two-variable problem.