Using gretl’s vecm Command

The Australian/U. S. GDP example above was carried out manually in a series of steps in order to familiarize you with the structure of the VEC model and how, at least in principle, they are estimated. In most applications, you will probably use other methods to estimate the VECM; they provide additional information that is useful and are usually more efficient. Gretl contains a full-featured vecm command that estimates a VECM. Chapter 24 of Cottrell and Lucchetti (2011) provides an excellent tutorial on estimating a VECM and includes some examples using gretl. Before using the vecm command in gretl, this is required reading!

One feature of the example in POE4 that bothers me is that tests for autocorrelation in the error correction models reject the no serial correlation hypothesis. That implies that the lag structure in the error correction models probably needs more thought. Thus, lags are added to the model and it is reestimated using gretl’s vecm command, the syntax for which is:


Arg um ents: order rank ylist [ ; xiist ] [ ; ndist ]

Options: —nc (no constant)

—rc. (restricted constant)

—crt (constant and restricted trend)

—ct (constant and unrestricted trend)

—seasons Is (include centered seasonal dummies) —impulse-responses (print impulse responses)

—variance-decomp (print variance decompositions)

After some experimentation I decide to use a third order model. Since there are only 2 series, the maximum and only number of cointegrating vectors is 1. The default, ‘case 3,’ which is an unrestricted constant, is used to model the deterministic components of the model. Choosing the correct case is another part of the art of doing a VECM study and I am not expert enough to give advice on how to do this. I will leave you to your own devices to resolve this tricky issue.

The model is estimated via a script:

—– 3rd order VECM with 1 cointegrating vector—unrestricted constant

vecm 3 1 aus usa

The dialog boxes are also useful. Choose Model>Time-Series>VECM to bring up the appropriate dialog box shown in Figure 13.4. It allows you to add endogenous variables to the VAR, exogenous variables (which must be I(0)), choose lags, number of cointegrating vectors, and choose the model for the deterministic portion of the trend. One of the advantages of using the dialog is that the model results appear, as usual, in a separate model window. The window gives you immediate access to tests, plots, and additional tools for analysis. Furthermore, there is also a handy facility that allows quick respecificaiton of the model. From the menu bar of the model window choose Edit>Revise specification brings up the VECM dialog box again for you to change settings.

One way to evaluate whether you have made adequate modeling choices is to look at various statistics within the output to check for significance of lags, as well as the magnitudes and signs of the coefficients. Even without the —verbose option, the command produces quite a bit of output. Here I divide it into two parts. The first part of our output can be seen below in Figure 13.5 The lag order is given, the selected cointegration rank is shown, and the “case” (unrestricted constant) is identified. Next are the estimates from the cointegrating equation. The adjustment vectors are actually the coefficients on the lagged residuals from the cointegrating relationship. Generally,

Figure 13.4: The VECM dialog box

these should have opposite signs in two variable models, otherwise the adjustments to shocks may not be equilibrating. Finally, some model selection statistics appear at the bottom that may be useful in determining the order of the VECM. As with the ones computed in our own modelsel2 function, smaller is better.

The second part of the output appears in Figure 13.6. This shows the estimates from the complete VECM. You will want to check to see if unnecessary lags have been included in the model (insignificant t-ratios on the longest lags), check the value of the Durbin-Watson statistic (it should be close to 2), and check the signs and significance of the error correction terms. In this case the signs are as expected, and only the Australian economy adjusts significantly to shocks in the short – run. Issuing a modtest 1 —autocorr after the vecm will produce some autocorrelation statistics. Check these to make sure that no autocorrelation remains.

In this example, having 2 lagged differences in the U. S. equation appears to be warranted. The second lag in the Australian equation is also significant at 10%. The signs on the error correction terms make sense. I would conclude that this model is a worthy candidate for further use.

One more check is worth considering. A plot of the error correction terms is shown in Figure 13.7 This plot shows that most of the disequilibrium is negative. Australia is constantly playing catch­up to the U. S. I’m not sure I believe this. You will notice that the coefficient in the cointegrating equation is -1.025. The simple least squares estimation of it was -0.98. I suspect that this parameter should be equal to —1 (these market economies are roughly comparable) and I test for it, using a restrict statement. The hypothesis is not rejected at 5% and the restriction is imposed and the plot recast as shown in Figure 13.8. You can see that it has the same basic shape as in Figure 13.7, but the now there are many more positive disequilibria. The regression output from

VECM system, lag order 3

Maximum likelihood estimates, observations 1970:4-2000:4 (T = 121)

beta (cointegrating vectors, standard errors in parentheses)

Estimates of the cointegrating

Figure 13.5: The first part of the output from the vecm 3 1 aus usa command.

the restricted VECM appears below: The magnitude of the adjustment parameters have become more similar in magnitude. The coefficient for Australia (-0.096929) is significant at 10% and the one for the U. S. is not.

Finally, there are some advantages of working with a script as well. Gretl has accessors for some of the output from vecm. The $jbeta accessor stores the parameters from the cointegrating estimations. $vecGamma stores the coefficients on the lagged differences of the cointegrated variables, and $ec stores the error correction terms. In the script, I compute the error correction terms manually using $jbeta. There are other accessors for the vecm results. See the Gretl Users Guide for details.

————– Restricting the VECM and accessing some results

1 vecm 3 1 aus usa

2 restrict —full

3 b[1]+b[2]=0

4 end restrict


5 scalar a = $vecGamma

6 scalar b =$jbeta

7 series ec = aus + $jbeta[2,1]*usa


std. error








d a us





0. 9996

d aus






d usa






d usa EC1


0.224547 -0.121361





0.0898 * 0.0131 **

Mean dependent var 0.503339 Sura squared resid 42.50365 R-squared 0.170396 rlno -0.024521

S. D. dependent var 0.653412 S. E. of regression 0.607345 Adjusted R-3criared 0.134 32 6 Durtin-Watson 1.997441

const d aus d aus



1 <H CM 1 1

0.331044 0.0233260 -0.0366754




2.390 0.2909 -1.099

0.0046 0.7716 0.2740

d usa






* *

d usa






rf rf rf






Equation 2: d_usa


std. error



Mean dependent var 0.512457 Sura squared resid 27.24164 R-squared 0.154880 rlno -0.006820

S. D. dependent var 0.518283 S. E. of regression 0.436707 Adjusted R-3quared 0.113136

Figure 13.6: The second part of the output from the vecm 3 1 aus usa command.

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>