# R reproducible example, restrictions on cointegrating equations

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

nobs = 200
e = rmvnorm(n=nobs,sigma=diag(c(.5,.5,.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])
e4.ar1 = arima.sim(model=list(ar=.75),nobs,innov=e[,4])
y5 = cumsum(e[,5])
y1 = y5 + e1.ar1
y2 = y5 + e2.ar1
y3 = y5 + e3.ar1
y4 = y5 + e4.ar1
data = cbind(y1,y2,y3,y4,y5)

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

vecm <- cajorls(jcointt,r=4)
summary(vecm$rlm) print(vecm)  The cointegrating vectors you will get from this estimation will look like this:  ect1 ect2 ect3 ect4 y1.l1 1 0 0 0 y2.l1 0 1 0 0 y3.l1 0 0 1 0 y4.l1 0 0 0 1 y5.l1 b4.1 b4.2 b4.3 b4.4 constant c1 c2 c3 c4  here, b4.1 through to b4.4 are the coefficients of the 4 cointegrating equations (ecm's) ( which are$\beta's$). Similarly,$c's$are the intercepts of the cointegrating equation. As you can see, there are r-1 restrictions, that's 3 restrictions, on each equation by default. I want to put restrictions on these equations matrix and re-estimate the VECM so that I will have the following matrix of long run equations:  ect1 ect2 ect3 ect4 y1.l1 1 0 0 0 y2.l1 b1.1 1 0 0 y3.l1 b2.1 0 1 0 y4.l1 b3.1 0 0 1 y5.l1 b4.1 b4.2 b4.3 b4.4 constant c1 c2 c3 c4  From this output, I want to extract the first equation ect1 for inference. It should look like this:$y_1=\beta_0-\beta_1y_2-\beta_2y_3-\beta_3y_4-\beta_4y_5$What I do not know is how to get from the first long run equations matrix to the second one. Basically, I do not know how to construct the restrictions matrix on$\beta\$.

Any suggestions and hints are welcome and appreciated!