# Understanding vec2var conversion in R

I'm using Bernhard Pfaff's packages {urca} and {vars} to analyze 3 time series. Each is I(1) and cointegrated with $r =2$ cointegrating relationships.

The vec2var() command should make the conversion from the ca.jo object (my VECM) to its VAR representation in levels. But I do not understand the output from vec2var(), nor how to perform VAR analyses on this output (i.e., send the data to the VAR() function to get a varest object).

That is, after converting from VECM to VAR what do I send to the VAR() function (which performs the standard VAR estimates)? Should it be:

var.form$A%*%var.form$datamat[ , c(6:11)] + var.form$deterministic%*%var.form$datamat[ , c(4:5)]


where dimensions in the code above are because I have $K=3$ variables, $p=2$ lags, a constant term and a deterministic trend.

But the formulation from vec2var() [on which I've based the above R code] is something like \begin{equation} Y_t = A_1 Y_{t-1} + A_2 Y_{t-2} + \Phi D_t + \mu + \epsilon_t \end{equation} That is, a basic VAR(2) with a deterministic time trend and constant.

But this is what I'm confused about: The VAR form of the long-run VECM (equation 4.8a, in Pfaff's Analysis of Integrated and Co-Integrated Time Series with R. useR!, and elsewhere e.g. Lütkepohl eq'n 7.1.1) is:

\begin{equation} \Delta y_t = \Gamma_1 \cdot \Delta y_{t-1} + \Gamma_2 \cdot \Delta y_{t-2} + \Pi \cdot y_{t-2} + \Phi \cdot D_t + \mu + \epsilon_t \end{equation}

To get the proper VAR level representation do I have to take the data from vec2var() and manipulate it myself? (i.e. find the difference series and then multiply by the appropriate cointegration matrix)? If this is the case then which [in R code please!] coefficient matrices should multiply which vectors?

I feel like there's a disconnect from the theory and mathematical formalism and these R packages... but more likely I'm missing something pretty basic.

Here's the basic R code set up:

library(urca)
library(vars)

vecm <- ca.jo(mydata, ecdet = "trend", type = "trace",  spec = "longrun")
var.form <- vec2var(vecm, r= 2)
# The output data I get can be seen from names(var.form), but the key parts are:

var.form$y # my original data var.form$datamat    # original data organized with the three variables (starting at t = 2), the constant term, trend term and then six columns with two lagged levels at t=1 and t=0.

# the coefficients for the regressors on the endogenous variables (A) and deterministic components are:
var.form$A # lagged variable coefficients (levels only, I think) var.form$deterministic     # constant and time trend coefficients

• What you call "The VAR form of the long-run VECM" may not be what you say it is. To me it looks like another (equivalent) representation of the VECM model. There are two common representations of VECM: (1) where the error correction term is lagged by 1; (2) where the error correction term is lagged by and by p, where p is the number of lags of the first difference terms in the VECM. And the VAR you want to get from the VECM should look like any other VAR, thus no need to be confused. – Richard Hardy Nov 1 '14 at 18:21
• Tony, I, too, stick to a problem very similar to your problem. VEC -> VAR transformation is important. Using VAR even in the case of cointegrated VAR (via a VECM->VAR transformation) is very advantagous for ">2"-variable systems in which one blasts interaction/confounding effects. – Erdogan CEVHER Mar 28 '17 at 21:02
• Tony, look at here The example here, especially towards the bottom of the page, may provide you essential hints via its matrix representations. A very rare and complete example, indeed. The matrix structures for 5 different cases of Juselius are really cumbersome. Once I get a systematic way to present them, I will give them here as well. MARTIN 2012 "Econometric Modelling with Time Series" is the BEST reference to explain the 5 cases (see page 705 and earlier). Matrix structures changes acc. to these 5 cases in urca/var apps. – Erdogan CEVHER Mar 29 '17 at 19:21
• Look at ca.jomoni and here where you can find the connection with "the theory and mathematical formalism" and "R functions" more properly. – Erdogan CEVHER Mar 31 '17 at 9:43

The vec2var() function will provide an object of class vec2var. You cannot convert it further to the class varest for standard VAR, but there are still many methods that will work on it, check it with:

methods(class = "vec2var")


Will return:

 fevd fitted irf logLik Phi plot predict print Psi residuals

So you can run irf(), fevd() and so on, to "perform VAR analyses on this output" as you want. For exampe, if you want to run the IRF, do:

plot(irf(vec2var(x)))


The only thing you cannot get easily are standard errors for the coefficients of the (constrained) VAR representation.