# VECM in STATA for two cointegrating equations

In the previous article, Johansen cointegration test revealed the cointegration between time series Gross Domestic Product (GDP), Private Final Consumption (PFC) and Gross Fixed Capital Formation (GFC), containing up to two cointegrating equations. Therefore, unrestricted Vector Auto Regression (VAR) is not applicable in such cases. Vector Error Correction Model (VECM) is a special case of VAR which takes into account the cointegrating relations among the variables.

## Vector Error Correction Model (VECM) in STATA

To start with VECM, follow these steps:

• Click on ‘Statistics’ in the main tab
• Select ‘Multivariate Time Series’
• Select ‘Vector Error-Correction Model’

Figure 1: Pathway for VECM in STATA

The ‘vec’ dialogue box will appear as shown in the figure below. Fill three options; ‘Dependent variables’, ‘Number of co-integrating equations’  and ‘Maximum lag’.

Figure 2: Window for VECM in STATA

In ‘Dependent variables’ select ‘gdp’, ‘gfc’ and ‘pfc’, using the drop-down menu. In ‘Number of co-integrating equations (rank)’, select ‘2’, since the previous article showed two cointegrating equations using the Johansen cointegration test. Finally in ‘Maximum lag to be included’, select ‘8’, as the previous article showed 8 lags. Click on ‘OK’.

Figure 3: Window for VECM in STATA

The results will appear as shown in the figure below. Since this case has 8 lags and two equations, the results are lengthy. For more clarity, the explanation is broken down into parts.

## Part I of results of VECM in STATA

This contains the STATA command showing in the result window with information about all the variables as shown in the figure below. For instance, VECM has taken the first difference of these variables, such that they are represented as D_gdp, D_gfc, and D_pfc. Further, the R-square value of all three variables are good enough to justify their causality, and p values close to zero also indicates significance.

Figure 4: Part 1 of Results of VECM in STATA

## Part II of VECM in STATA

This part of the result shows the regression equations by taking ‘D_gdp’ as dependent and lagged values of GFC and PFC as independent variables as shown in the figure below. The interpretation is as follows:

1. ‘ce1’ and ‘ce2’ represent two cointegrating equations. To ascertain the long-term causality between GDP and PFC and GFC, the ‘ce1’ and ‘ce2’ have to show a negative coefficient and a significant p-value. As the figure below shows, both the equations do not have negative coefficient but ‘ce2’ has a significant p-value of 0.011. Since all two conditions are missing here, this VECM do not show any long-term causality between GDP and the other two variables PFC and GFC.
2. Furthermore, to examine the short-term causality between variables, see individual lag coefficients and p values for each independent variable (figure below). Thus this part explains the lagged values of GFC and PFC for GDP. As per the result, the only 1st lag of GFC is significant (p-value is 0.00), apart from that no other lag, even of PFC have no significance level. That means the only first lag of GFC has a short-term causality with GDP.

Figure 5: Part 2 of results of VECM in STATA

## Part III of VECM in STATA

Similarly, the results of VECM go forward by assuming each of remaining variable as dependent and other as the independent. For instance, ‘D_gfc’ is dependent and ‘D_pfc’ is independent (figures below).

1. In the case of GFC, a long-term causality from GDP and PFC to GFC is noticeable because ‘ce2’ equation, in this case, has both negative coefficient and significant p-value.
2. A short-term causality is evident only in case of PFC that too on seventh lag with significant p values 0.000.
3. In case of PFC, a long-term causality from GFC and GDP to PFC is absent as both ‘ce1’ and ‘ce2’ equations, in this case, have both non-negative coefficient and insignificant p-value.
4. In the case of PFC, a short-term causality is evident in case of 1st lag of GFC and GDP with significant p values 0.000.

Figure 5: Steps 3, 4 and 5 of VECM results in STATA

Figure 6: Step 6 of VECM results in STATA

To ensure whether the VECM is correctly specified or not, a set of diagnostics tests such as tests for normality, serial correlation and heteroskedasticity need to be performed. The next article will show how to conduct these diagnostics tests in STATA.

### Divya Dhuria

Research analyst at Project Guru
DIvya has a keen interest in policy making and wealth management. She is a Master in Economics from Gokhale Institute of Politics and Economics. She has been trained in the econometric techniques to assess different possible economic relationships. She hascontributed to the working paper on National Rural Health Mission at Institute of economic growth, Delhi. Along with academical growth, she likes to explore and visit different places in her spare time.

### Related articles

• How to perform Johansen cointegration test in VAR with three variables? The previous article showed lag selection and stationarity for Vector Auto Regression (VAR) with three variables; Gross Domestic Product (GDP), Gross Fixed Capital Formation (GFC) and Private Final Consumption (PFC). This article shows the co-integration test for VAR with three variables.
• Lag selection and cointegration test in VAR with two variables The previous article showed that the three-time series values Gross Domestic Product (GDP), Gross Fixed Capital Formation (GFC) and Private Final Consumption (PFC) are non-stationary. Therefore they may have long-term causality. The general assumption, in this case, is that consumption […]
• How to perform regression analysis using VAR in STATA? In multivariate time series, the prominent method of regression analysis is Vector Auto-Regression (VAR). It is important to understand VAR for more clarity.
• How to test and diagnose VECM in STATA? This article explains testing and diagnosing VECM in STATA to ascertain whether this model is correct or not. Among diagnostic tests, common ones are tested for autocorrelation and test for normality.
• ARIMA modeling for time series analysis in STATA In the previous article, all possibilities for performing Autoregressive Integrated Moving Average (ARIMA) modeling for the time series GDP were identified as under. S. […]
Discussions

## 8 Comments.

1. Hi,
Thanks for the detail explanation. Great job.
There are many resources in the net about these tests but only a few provide explanations. You did a great job. I am wondering if you could help the reader with a publication like table for unit root tests, lag selection, cointegration, and vecm test so that it will be so easier to run and summarize results.

2. Hi HP,

Thanks for your comment. We have already published articles on how to do unit root test, lag selection, cointegration, and vecm test. Each of those articles also includes the output as produced by STATA. If you need to summarize results, either you can copy the output tables first to excel and then import them to a word document. But it often does not give you the right alignment or formatting. For a better way to summarize results, you can use the command “outreg2”. For that, first, install the comment in STATA, then copy and paste your output tables in a word document and finally run the command. Refer to this link for how to use this command.

https://www.princeton.edu/~otorres/Outreg2.pdf

Hope it helps.

3. Thank you.

4. Johansen tests for cointegration
Trend: constant Number of obs = 34
Sample: 5 – 38 Lags = 4
——————————————————————————-
5%
maximum trace critical
rank parms LL eigenvalue statistic value
0 114 -65.153897 . 207.3882 94.15
1 125 -13.512973 0.95206 104.1063 68.52
2 134 9.1839255 0.73687 58.7125 47.21
3 141 24.124265 0.58474 28.8318* 29.68
4 146 32.964474 0.40549 11.1514 15.41
5 149 38.016635 0.25709 1.0471 3.76
6 150 38.540188 0.03033
————————————————————————
can I say there cointigration? when I have tested stability it is not stable and not normal so what can I do to have stable out put

5. I thank you very much for your response but I have attempted to do stability test and I have got the result of it. Also please the following result and see whether it has long term and short term relationship and also normality.

AIC = 2.399748
Log likelihood = -30.39534 HQIC = 2.614638
Det(Sigma_ml) = 3.56e-06 SBIC = 3.009285

Equation Parms RMSE R-sq chi2 P>chi2
—————————————————————-
D_LCDT 2 .164031 0.4397 27.46918 0.0000
D_LEpnd 2 .120953 0.6194 56.94922 0.0000
D_LGrant 2 .378515 0.1601 6.672735 0.0356
D_LRGDP 2 .128568 0.2534 11.88228 0.0026
D_Lopns 2 3.11808 0.1337 5.400241 0.0672
—————————————————————-

——————————————————————————
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
————-+—————————————————————-
D_LCDT |
_ce1 |
L1. | .0677391 .0586611 1.15 0.248 -.0472345 .1827128
|
_cons | .134283 .0271441 4.95 0.000 .0810815 .1874844
————-+—————————————————————-
D_LEpnd |
_ce1 |
L1. | .1363515 .0432553 3.15 0.002 .0515727 .2211303
|
_cons | .1291361 .0200154 6.45 0.000 .0899067 .1683656
————-+—————————————————————-
D_LGrant |
_ce1 |
L1. | -.2432827 .1353649 -1.80 0.072 -.508593 .0220275
|
_cons | .1283122 .062637 2.05 0.041 .0055459 .2510785
————-+—————————————————————-
D_LRGDP |
_ce1 |
L1. | -.0068975 .0459785 -0.15 0.881 -.0970137 .0832187
|
_cons | .0731539 .0212755 3.44 0.001 .0314547 .1148531
————-+—————————————————————-
D_Lopns |
_ce1 |
L1. | 2.57387 1.115092 2.31 0.021 .388329 4.75941
|
_cons | .0019491 .5159836 0.00 0.997 -1.00936 1.013258
——————————————————————————

Cointegrating equations

Equation Parms chi2 P>chi2
——————————————-
_ce1 4 346.3087 0.0000
——————————————-

Identification: beta is exactly identified

Johansen normalization restriction imposed
——————————————————————————
beta | Coef. Std. Err. z P>|z| [95% Conf. Interval]
————-+—————————————————————-
_ce1 |
LCDT | 1 . . . . .
LEpnd | -2.482578 .4359987 -5.69 0.000 -3.33712 -1.628036
LGrant | 1.178082 .2423768 4.86 0.000 .7030325 1.653132
LRGDP | 1.110874 .6505622 1.71 0.088 -.1642045 2.385953
Lopns | -.056375 .0174486 -3.23 0.001 -.0905737 -.0221763
_cons | -3.983634 . . . . .
——————————————————————————

.
end of do-file

. do “C:\Users\belayz\AppData\Local\Temp\STD07000000.tmp”

. vec LCDT LEpnd LGrant LRGDP Lopns,lags(1)rank (1) noetable

Vector error-correction model

Sample: 2 – 38 Number of obs = 37
AIC = 2.399748
Log likelihood = -30.39534 HQIC = 2.614638
Det(Sigma_ml) = 3.56e-06 SBIC = 3.009285

Cointegrating equations

Equation Parms chi2 P>chi2
——————————————-
_ce1 4 346.3087 0.0000
——————————————-

Identification: beta is exactly identified

Johansen normalization restriction imposed
——————————————————————————
beta | Coef. Std. Err. z P>|z| [95% Conf. Interval]
————-+—————————————————————-
_ce1 |
LCDT | 1 . . . . .
LEpnd | -2.482578 .4359987 -5.69 0.000 -3.33712 -1.628036
LGrant | 1.178082 .2423768 4.86 0.000 .7030325 1.653132
LRGDP | 1.110874 .6505622 1.71 0.088 -.1642045 2.385953
Lopns | -.056375 .0174486 -3.23 0.001 -.0905737 -.0221763
_cons | -3.983634 . . . . .
——————————————————————————

.
end of do-file

. do “C:\Users\belayz\AppData\Local\Temp\STD07000000.tmp”

. vec LCDT LEpnd LGrant LRGDP Lopns,lags(1)rank (1) noetable

Vector error-correction model

Sample: 2 – 38 Number of obs = 37
AIC = 2.399748
Log likelihood = -30.39534 HQIC = 2.614638
Det(Sigma_ml) = 3.56e-06 SBIC = 3.009285

Cointegrating equations

Equation Parms chi2 P>chi2
——————————————-
_ce1 4 346.3087 0.0000
——————————————-

Identification: beta is exactly identified

Johansen normalization restriction imposed
——————————————————————————
beta | Coef. Std. Err. z P>|z| [95% Conf. Interval]
————-+—————————————————————-
_ce1 |
LCDT | 1 . . . . .
LEpnd | -2.482578 .4359987 -5.69 0.000 -3.33712 -1.628036
LGrant | 1.178082 .2423768 4.86 0.000 .7030325 1.653132
LRGDP | 1.110874 .6505622 1.71 0.088 -.1642045 2.385953
Lopns | -.056375 .0174486 -3.23 0.001 -.0905737 -.0221763
_cons | -3.983634 . . . . .
——————————————————————————

.
end of do-file

. do “C:\Users\belayz\AppData\Local\Temp\STD07000000.tmp”

. vec LCDT LEpnd LGrant LRGDP Lopns,lags(1)rank (1) nobtable

Vector error-correction model

Sample: 2 – 38 Number of obs = 37
AIC = 2.399748
Log likelihood = -30.39534 HQIC = 2.614638
Det(Sigma_ml) = 3.56e-06 SBIC = 3.009285

Equation Parms RMSE R-sq chi2 P>chi2
—————————————————————-
D_LCDT 2 .164031 0.4397 27.46918 0.0000
D_LEpnd 2 .120953 0.6194 56.94922 0.0000
D_LGrant 2 .378515 0.1601 6.672735 0.0356
D_LRGDP 2 .128568 0.2534 11.88228 0.0026
D_Lopns 2 3.11808 0.1337 5.400241 0.0672
—————————————————————-

——————————————————————————
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
————-+—————————————————————-
D_LCDT |
_ce1 |
L1. | .0677391 .0586611 1.15 0.248 -.0472345 .1827128
|
_cons | .134283 .0271441 4.95 0.000 .0810815 .1874844
————-+—————————————————————-
D_LEpnd |
_ce1 |
L1. | .1363515 .0432553 3.15 0.002 .0515727 .2211303
|
_cons | .1291361 .0200154 6.45 0.000 .0899067 .1683656
————-+—————————————————————-
D_LGrant |
_ce1 |
L1. | -.2432827 .1353649 -1.80 0.072 -.508593 .0220275
|
_cons | .1283122 .062637 2.05 0.041 .0055459 .2510785
————-+—————————————————————-
D_LRGDP |
_ce1 |
L1. | -.0068975 .0459785 -0.15 0.881 -.0970137 .0832187
|
_cons | .0731539 .0212755 3.44 0.001 .0314547 .1148531
————-+—————————————————————-
D_Lopns |
_ce1 |
L1. | 2.57387 1.115092 2.31 0.021 .388329 4.75941
|
_cons | .0019491 .5159836 0.00 0.997 -1.00936 1.013258
——————————————————————————

.
end of do-file

. do “C:\Users\belayz\AppData\Local\Temp\STD07000000.tmp”

. vec LCDT LEpnd LGrant LRGDP Lopns,lag(2)rank (1)

Vector error-correction model

Sample: 3 – 38 Number of obs = 36
AIC = 2.804347
Log likelihood = -11.47824 HQIC = 3.403095
Det(Sigma_ml) = 1.30e-06 SBIC = 4.519826

Equation Parms RMSE R-sq chi2 P>chi2
—————————————————————-
D_LCDT 7 .178226 0.4397 22.7582 0.0019
D_LEpnd 7 .112423 0.7265 77.01659 0.0000
D_LGrant 7 .354822 0.3877 18.36007 0.0104
D_LRGDP 7 .129923 0.3683 16.90535 0.0180
D_Lopns 7 3.16823 0.2577 10.06795 0.1848
—————————————————————-

——————————————————————————
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
————-+—————————————————————-
D_LCDT |
_ce1 |
L1. | -.0564224 .0707425 -0.80 0.425 -.1950752 .0822304
|
LCDT |
LD. | .0698024 .2275522 0.31 0.759 -.3761916 .5157965
|
LEpnd |
LD. | .0972834 .2407466 0.40 0.686 -.3745712 .5691381
|
LGrant |
LD. | -.0251761 .0802288 -0.31 0.754 -.1824217 .1320694
|
LRGDP |
LD. | .328565 .4310464 0.76 0.446 -.5162705 1.1734
|
Lopns |
LD. | .0047569 .0107492 0.44 0.658 -.0163112 .025825
|
_cons | .1235277 .0483707 2.55 0.011 .0287228 .2183326
————-+—————————————————————-
D_LEpnd |
_ce1 |
L1. | .1734465 .0446235 3.89 0.000 .0859862 .2609069
|
LCDT |
LD. | -.044177 .1435369 -0.31 0.758 -.3255042 .2371501
|
LEpnd |
LD. | .076646 .1518598 0.50 0.614 -.2209937 .3742856
|
LGrant |
LD. | .1050035 .0506073 2.07 0.038 .005815 .2041919
|
LRGDP |
LD. | -.665257 .2718984 -2.45 0.014 -1.198168 -.132346
|
Lopns |
LD. | .0063684 .0067805 0.94 0.348 -.0069211 .0196578
|
_cons | .0693701 .0305116 2.27 0.023 .0095685 .1291718
————-+—————————————————————-
D_LGrant |
_ce1 |
L1. | .2509111 .1408383 1.78 0.075 -.0251269 .526949
|
LCDT |
LD. | .6066396 .4530238 1.34 0.181 -.2812708 1.49455
|
LEpnd |
LD. | -.1620136 .4792921 -0.34 0.735 -1.101409 .7773816
|
LGrant |
LD. | -.3765547 .1597241 -2.36 0.018 -.6896081 -.0635013
|
LRGDP |
LD. | -1.844968 .8581518 -2.15 0.032 -3.526915 -.1630213
|
Lopns |
LD. | -.001615 .0214001 -0.08 0.940 -.0435585 .0403285
|
_cons | .0891856 .0962992 0.93 0.354 -.0995574 .2779285
————-+—————————————————————-
D_LRGDP |
_ce1 |
L1. | .0764743 .0515697 1.48 0.138 -.0246005 .177549
|
LCDT |
LD. | -.1907902 .1658804 -1.15 0.250 -.5159098 .1343293
|
LEpnd |
LD. | .2469228 .1754988 1.41 0.159 -.0970486 .5908941
|
LGrant |
LD. | .0269571 .058485 0.46 0.645 -.0876713 .1415856
|
LRGDP |
LD. | -.2205035 .3142231 -0.70 0.483 -.8363694 .3953624
|
Lopns |
LD. | .0035621 .0078359 0.45 0.649 -.0117961 .0189202
|
_cons | .036443 .0352612 1.03 0.301 -.0326677 .1055536
————-+—————————————————————-
D_Lopns |
_ce1 |
L1. | -2.250422 1.257553 -1.79 0.074 -4.715181 .2143374
|
LCDT |
LD. | 5.360883 4.045077 1.33 0.185 -2.567323 13.28909
|
LEpnd |
LD. | -.5193796 4.279628 -0.12 0.903 -8.907296 7.868537
|
LGrant |
LD. | 2.92722 1.426186 2.05 0.040 .131947 5.722493
|
LRGDP |
LD. | 5.600819 7.66249 0.73 0.465 -9.417385 20.61902
|
Lopns |
LD. | -.041468 .1910831 -0.22 0.828 -.4159839 .333048
|
_cons | .0134316 .8598615 0.02 0.988 -1.671866 1.698729
——————————————————————————

Cointegrating equations

Equation Parms chi2 P>chi2
——————————————-
_ce1 4 197.9077 0.0000
——————————————-

Identification: beta is exactly identified

Johansen normalization restriction imposed
——————————————————————————
beta | Coef. Std. Err. z P>|z| [95% Conf. Interval]
————-+—————————————————————-
_ce1 |
LCDT | 1 . . . . .
LEpnd | -2.495936 .5687129 -4.39 0.000 -3.610593 -1.38128
LGrant | -.223748 .2883544 -0.78 0.438 -.7889123 .3414163
LRGDP | 4.119485 1.050475 3.92 0.000 2.060591 6.178379
Lopns | .0162884 .0183115 0.89 0.374 -.0196014 .0521782
_cons | -31.60329 . . . . .
——————————————————————————

.
end of do-file

. do “C:\Users\belayz\AppData\Local\Temp\STD07000000.tmp”

. vecstable

Eigenvalue stability condition
+—————————————-+
| Eigenvalue | Modulus |
|————————–+————-|
| 1 | 1 |
| 1 | 1 |
| 1 | 1 |
| 1 | 1 |
| .9951696 | .99517 |
| -.1939456 + .5329696i | .567161 |
| -.1939456 – .5329696i | .567161 |
| -.4558523 | .455852 |
| .2549587 | .254959 |
| -.1655585 | .165558 |
+—————————————-+
The VECM specification imposes 4 unit moduli.

.
end of do-file

. do “C:\Users\belayz\AppData\Local\Temp\STD07000000.tmp”

. vecstable, graph

Eigenvalue stability condition
+—————————————-+
| Eigenvalue | Modulus |
|————————–+————-|
| 1 | 1 |
| 1 | 1 |
| 1 | 1 |
| 1 | 1 |
| .9951696 | .99517 |
| -.1939456 + .5329696i | .567161 |
| -.1939456 – .5329696i | .567161 |
| -.4558523 | .455852 |
| .2549587 | .254959 |
| -.1655585 | .165558 |
+—————————————-+
The VECM specification imposes 4 unit moduli.

.
end of do-file

. do “C:\Users\belayz\AppData\Local\Temp\STD07000000.tmp”

. veclmar, mlag(1)

Lagrange-multiplier test
+————————————–+
| lag | chi2 df Prob > chi2 |
|——+——————————-|
| 1 | 12.9130 25 0.97755 |
+————————————–+
H0: no autocorrelation at lag order

.
end of do-file

. do “C:\Users\belayz\AppData\Local\Temp\STD07000000.tmp”

. veclmar, mlag(2)

Lagrange-multiplier test
+————————————–+
| lag | chi2 df Prob > chi2 |
|——+——————————-|
| 1 | 12.9130 25 0.97755 |
| 2 | 10.0484 25 0.99652 |
+————————————–+
H0: no autocorrelation at lag order

.
end of do-file

. do “C:\Users\belayz\AppData\Local\Temp\STD07000000.tmp”

. vecnorm

Jarque-Bera test
+——————————————————–+
| Equation | chi2 df Prob > chi2 |
|——————–+———————————–|
| D_LCDT | 3.189 2 0.20304 |
| D_LEpnd | 0.047 2 0.97694 |
| D_LGrant | 0.935 2 0.62654 |
| D_LRGDP | 524.794 2 0.00000 |
| D_Lopns | 1.167 2 0.55799 |
| ALL | 530.131 10 0.00000 |
+——————————————————–+

Skewness test
+——————————————————–+
| Equation | Skewness chi2 df Prob > chi2 |
|——————–+———————————–|
| D_LCDT | .7012 2.950 1 0.08587 |
| D_LEpnd | .07336 0.032 1 0.85738 |
| D_LGrant | .39395 0.931 1 0.33456 |
| D_LRGDP | 3.7208 83.068 1 0.00000 |
| D_Lopns | -.43828 1.153 1 0.28302 |
| ALL | 88.134 5 0.00000 |
+——————————————————–+

Kurtosis test
+——————————————————–+
| Equation | Kurtosis chi2 df Prob > chi2 |
|——————–+———————————–|
| D_LCDT | 3.3988 0.239 1 0.62523 |
| D_LEpnd | 2.9022 0.014 1 0.90462 |
| D_LGrant | 3.0511 0.004 1 0.95013 |
| D_LRGDP | 20.161 441.726 1 0.00000 |
| D_Lopns | 2.9025 0.014 1 0.90490 |
| ALL | 441.997 5 0.00000

6. No answer for this question ? the economist please say something

7. Cheng TONGYANG

Thank you. Your lesson is very important and very good for all researchers.

We are looking for candidates who have completed their master's degree or Ph.D. Click here to know more about our vacancies.