Some Interesting Issues in VECM using R
[This article was first published on K & L Fintech Modeling, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
This post deals with some interesting issues regarding the VECM model. Among them are the VAR representation of VECM, the weak exogeniety restrictions and user-defined cointegrating vectors and so on. With the help of useful R packages, these issues are discussed. Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Some Interesting Issues in VECM
In this post, we will cover some issues regarding VECM model and use the example of the previous VECM post. For those who are not familiar with the VECM or VAR model, refer to the previous posts below.
Transformation of VAR in levels to VECM in differences
A VAR(p) in levels can be transformed to the corresponding VECM(p-1) in differences as follows.
The Johansen cointegration test is applied to this this VECM(p-1) representation. Conversely, we can back out coefficients of VECM from that of VAR model using the above transformation.
Comparison of coefficients from VECM, cajorls, vec2var
In the previous post, the estimated parameters of vec2var() are somewhat different from that of the VECM() and cajorls() but I said that three sets of parameters are all the same. This is evident because we know the above transformation from VAR(p) to VECM(p-1).
Our example is about VECM(1) or VAR(2), we can convert parameters of vec2var() in the form of VECM representation as follows.
Π=−(I–Π1–Π2),Γ1=−Π2
The following R code implements these transformations.
#—————————— # AR(1) #—————————— VECM_tsDyn$coefficients[,4:7] t(cajorls_ca.jo$rlm$coefficients[7:10,]) –vec2var_ca.jo$A$A2 #—————————— # ECT : long-run impact matrix #—————————— VECM_tsDyn$coefficients[,1:2] t(cajorls_ca.jo$rlm$coefficients[1:2,]) (vec2var_ca.jo$A$A1 + vec2var_ca.jo$A$A2 – diag(4))[,1:2] #—————————— # constant and seasonal dummy #—————————— VECM_tsDyn$coefficients[,c(3, 8:10)] t(cajorls_ca.jo$rlm$coefficients[3:6,]) vec2var_ca.jo$deterministic | cs |
AR(1) coefficients from three models are the same. (Γ1=−Π2)
Long-run impact matrices from three models are also the same. (Π=Π1+Π2–I)
Intercepts and seasonal dummy variables are same as we found already in the previous post.
A Restricting Matrix
Before going to the Johansen’s hypothesis testing on parameter restrictions, we need to understand a restricting matrix and real parameters to be estimated.
Given an unrestricted parameter matrix βu with two columns which are considered two set of coefficients from two equations, a multiplication of some restricting matrix R and βu produces a restricted parameter matrix βr.
βr⏟v×c=R⏟v×(v−r)×βu⏟(v−r)×cv=the number of variablesc=the number of cointegrationsr=the number of restrictions |
In particular, when a restricting matrix does not have any restrictions, this restricting matrix coincides with the identity matrix as follows.
[βr11βr12βr21βr22βr31βr32βr41βr42]⏟restrictedparameters= [1000010000100001]⏟restrictingmatrix[βu11βu12βu21βu22βu31βu32βu41βu42]⏟unrestrictedparameters
The resulting restricted parameters have the following representations. (i=1,2) βr1i=βu1iβr2i=βu2iβr3i=βu3iβr4i=βu4i
When we assume βr2i=0, the transformation between parameters have the following form. In this case, columns of a restricting matrix and rows of an unrestricted parameter matrix reduced by the number of restrictions (= 1) simultaneously.
[βr11βr12βr21βr22βr31βr32βr41βr42]⏟restrictedparameters= [100000010001]⏟restrictingmatrix[βu11βu12βu21βu22βu31βu32]⏟unrestrictedparameters
The resulting restricted parameters have the following representations. (i=1,2) βr1i=βu1iβr2i=0βr3i=βu2iβr4i=βu3i
Restrictions on Cointegrating Relationship
One advantage of Johansen’s approach is that it allows to easily test restrictions on α and β with likelihood ratio test. These Hypothesis testings of restrictions on cointegrating relationship are carried out by alrtest(), blrtest() or ablrtest() functions in urca package.
In principle, one parameter restriction is on the corresponding coefficient of a variable. This leads to a selection matrix that determines which variable to be selected. In other words, parameter restrictions are performed not by setting α and β matrices directly but by using the selection matrices indirectly. This selection matrix has the following form.
ΠXt=[π11π12π13π21π22π23π31π32π33][xtytzt]=[α11α12α21α22α31α32][1–β11–β121–β21–β22][xtytzt]=[α11α12α21α22α31α32][11–β11–β21–β12–β22]‘Xt=αβ‘Xt
1) Restrictions on beta
As in Johansen and Juselius (1990), the first hypothesis is that coefficients of money and income are equal with opposite sign as follows. H3:β1i=−β2i
This hypothesis can be represented in matrix notation. [βr11βr12βr21βr22βr31βr32βr41βr42]⏟restrictedparameters= [−100100010001]⏟restrictingmatrix[βu11βu12βu21βu22βu31βu32]⏟unrestrictedparameters
The resulting restricted parameters have the following representations. (i=1,2) βr1i=−βu1iβr2i=βu1iβr3i=βu2iβr4i=βu3i
We can use the following R code to apply this linear restriction on the cointegrating long run vector beta.
#———————————————- # Restrictions on beta matrix # H3 : beta=H*phi #———————————————- # Null Hypothesis ~ H3 : -b1 = b2 H <– matrix(byrow = TRUE, c(–1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), 4, 3) # Testing Hypothesis blr <– blrtest(coint_ca.jo, H=H, r=2) summary(blr) | cs |
In the above R code, the restriction matrix (H) has a dimension of 4×3 since there is one restriction and the number of parameters to be estimated is 6 (= 3×2) not 8 (= 4×2). Hypothesis testing on H3 null hypothesis is done by using blrtest() function in urca package.
2) Restrictions on alpha – weak exogeneity tests
The second hypothesis is that adjustment speeds of money and income are zero. This is so called the weak exogeneity test since when a speed of adjustment of some variable is zero, that variable does not be affected from the long-run cointegrating relationships.
H4:β1i=0 and β2i=0
This hypothesis can be represented in matrix notation. [βr11βr12βr21βr22βr31βr32βr41βr42]⏟restrictedparameters= [00001001]⏟restrictingmatrix[βu11βu12βu21βu22βu31βu32]⏟unrestrictedparameters
The resulting restricted parameters have the following representations. (i=1,2) βr1i=0βr2i=0βr3i=βu1iβr4i=βu2i
We can use the following R code to apply these two linear restrictions on the adjustment speed vector alpha.
#———————————————- # Restrictions on alpha matrix # – weak exogeneity tests # H4 : alpha=A*psi #———————————————- # Null Hypothesis ~ H4 : a1 = a2 = 0 A <– matrix(byrow = TRUE, c(0, 0, 0, 0, 1, 0, 0, 1), 4, 2) # Testing Hypothesis alr <– alrtest(coint_ca.jo, A=A, r=2) summary(alr) | cs |
In the above R code, the restriction matrix (A) has a dimension of 4×2 since there are two zero restrictions (weakly exogenous) and the number of parameters to be estimated is 4 (= 2×2) not 8 (= 4×2). Hypothesis testing on H4 null hypothesis is done by using alrtest() function in urca package.
3) Results of blrtest() and alrtest()
The following output is the concatenated two hypothesis testing results.
These results show that since p-value of H3 is 0.17, H3 hypothesis can not be rejected (beta restriction) under the 5% significant level. In contrast, H4 hypothesis is rejected (alpha restriction) since p-value of H4 is 0.04 under the 5% significant level. Therefore we can conclude that β1i=−β2i in cointegrating vectors and the first and second variables are not jointly weakly exogenous.
In summary, we can draw two conclusions.
|
Beta-restricted VECM
In VECM() function in tsDyn, user-defined beta (cointegrating vector) can be inserted into VECM() function with beta argument. The following R code implements a beta-restricted VECM model using the above blr output.
#======================================================== # Beta-restricted VECM #======================================================== VECM_tsDyn_beta <– VECM(lev, lag=1, r=2, estim = “ML”, LRinclude = “none”, exogen = dum_season, beta = blr@V[,1:2]) summary(VECM_tsDyn_beta) | cs |
The folloiwng result shows that VECM estimation is carried out, which is subject to user-defined beta cofficient matrix.
Since VECM() output is easily adapted to predict() function. we can make forecasts by using this beta-restricted VECM model.
Concluding Remarks
In this post, we have dealt with some interesting issues regarding VECM model such as the hypothesis testing on parameter restrictions and the transformation of VAR(p) to VECM(p-1) and so on. In particular, as we have understood the concept of a restricting matrix, another various hypothesis testings are available using R by changing a restricting matrix.
Reference
Johansen, S. and Juselius, K. (1990), Maximum Likelihood Estimation and Inference on Cointegration – with Applications to the Demand for Money, Oxford Bulletin of Economics and Statistics, 52, 2, 169–210. ◼
To leave a comment for the author, please follow the link and comment on their blog: K & L Fintech Modeling.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.