1
$\begingroup$

The code given below estimates a VEC model with 2 cointegrating vectors. It is a reproducible code, so just copy and paste into your R console (or script editor).

> library ("urca")

Created articial data

> nobs = 200           #  number of observations
> e = rmvnorm(n=nobs,sigma=diag(c(.5,.5,.5)))    
> e1.ar1 = arima.sim(model=list(ar=.75),nobs,innov=e[,1])
> e2.ar1 = arima.sim(model=list(ar=.75),nobs,innov=e[,2])
> e3.ar1 = arima.sim(model=list(ar=.75),nobs,innov=e[,3])
> y1 = cumsum(e[,1]) + e1.ar1
> y2 = cumsum(e[,1]) + e2.ar1
> y3 = cumsum(e[,1]) + e3.ar1

> data = cbind(y1,y2,y3)

Run Johansen cointegration test

   > jcointt = ca.jo(data,ecdet="const",type="trace",K=2,spec="transitory")
   > summary(jcointt)

Got the following output

###################### 
# Johansen-Procedure # 
###################### 

Test type: trace statistic , without linear trend and constant in cointegration 

Eigenvalues (lambda):
[1]  1.687740e-01  1.236672e-01  1.585399e-02 -1.127570e-17

Values of teststatistic and critical values of test:

          test 10pct  5pct  1pct
r <= 2 |  3.16  7.52  9.24 12.97
r <= 1 | 29.30 17.85 19.96 24.60
r = 0  | 65.90 32.00 34.91 41.07

Eigenvectors, normalised to first column:
(These are the cointegration relations)

              y1.l1      y2.l1      y3.l1   constant
y1.l1     1.0000000  1.0000000  1.0000000  1.0000000
y2.l1    -1.6101627  0.2364580 -1.2230052 -0.3278262
y3.l1     0.5528387 -1.2114606  0.4912319 -1.2940967
constant  0.0194457  0.3828253 17.8007975 -5.7790394

Weights W:
(This is the loading matrix)

           y1.l1       y2.l1        y3.l1      constant
y1.d -0.02527895 -0.20388227 -0.010868003 -3.312924e-16
y2.d  0.14717590 -0.08609772 -0.006322288 -3.215611e-17
y3.d -0.04415827  0.04065915 -0.009347712 -1.830715e-18

It appears there are two cointegrating relations in the data. So estimated the VECM as follows:

> vecm <- cajorls(jcointt,r=2)
> summary(vecm$rlm)
> print(vecm)

Here comes the restricted VECM

$rlm

Call:
lm(formula = substitute(form1), data = data.mat)

Coefficients:
        y1.d       y2.d       y3.d     
ect1    -0.229161   0.061078  -0.003499
ect2    -0.007506  -0.257336   0.080716
y1.dl1  -0.151601  -0.170430   0.003316
y2.dl1   0.103196   0.159032   0.041342
y3.dl1   0.079732   0.025258  -0.054296


$beta
               ect1       ect2
y1.l1     1.0000000  0.0000000
y2.l1     0.0000000  1.0000000
y3.l1    -0.9855438 -0.9554206
constant  0.3362949  0.1967809

Now, I want to put exclusion restrictions on the above cointegrating vector ($beta$). What function I should use in urca, and how I should construct the restrictions matrix if I want to test that the coefficient on variable y3.l1 is 0 in the first equation. Thanks.

EDITED

I read that the function blrtest can be used to do likelihood ratio test for restrictions on beta. Following the examples from the R vignette I did this:

> rstrictcoint = blrtest(jcointt, H,r=2)

H is the restrictions matrix that has to be constructed by myself, though, this is where I am stuck currently - I could not figure out the dimension and elements of this matrix. How I should construct it to test if the above coefficient is 0. I can do this procedure in Eviews, but want to learn it in R.

$\endgroup$
  • $\begingroup$ Why don't you read the package documentation? $\endgroup$ – hejseb May 8 '16 at 19:02
  • $\begingroup$ @hejseb, I read it a few times, but still don't understand why a particular h-matrix, that's the restrictions matrix is constructed. The book by the urca package developer is somehow a dry read, in the sense, it does not say much on the restrictions matrix, while it gives a lot more explanation on other aspects of using it. Will you try explaining by continuing from where I stopped? $\endgroup$ – mr.rox May 8 '16 at 19:34
  • $\begingroup$ @hejseb I edited the original post and gave a bit more detail on where I am stuck now. Thanks. $\endgroup$ – mr.rox May 8 '16 at 20:02

Your Answer

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

Browse other questions tagged or ask your own question.