RATS 10.1
RATS 10.1

MONTEVECM.RPF is an example of Monte Carlo integration for the impulse responses for a VECM (Vector Error Correction Model). This requires RATS 9.2 or later. This is based upon the ECT.RPF example which does a more thorough analysis of the unit root and cointegration properties of the data. The analysis is of three series of US Treasury yields (FTBS3 is the 3-month T-bill rate, FTB12 is the 12-month T-bill rate and FCM7 is the 7-year bond rate).

 

If the cointegration vector is taken as fixed (it's quite difficult to allow it also to be unknown), the VECM is just another example of a multivariate linear system with the same right side variables in each equation. As such, the same methods for drawing coefficients can be employed as are used in a standard Vector Autoregression. The following estimates the (one) cointegrating vector and creates an error correction term based upon it. This uses the DET=RC option on @JOHMLE, which allows for a constant restricted to the cointegrating vector (so the series won't trend).

 

@johmle(lags=6,det=rc,cv=cvector)

# ftbs3 ftb12 fcm7

equation(coeffs=cvector) ecteq *

# ftbs3 ftb12 fcm7 constant

 

This sets up the VECM based upon that:

 

system(model=ectmodel)

variables ftbs3 ftb12 fcm7

lags 1 to 6

ect ecteq

end(system)

 

and this estimates it:

 

estimate

 

The number of estimated coefficients per equation is 16: 5 each on the lagged differences for each of the three variables, plus the one coefficient on the lagged error correction term. You don't have to create a separate series for the error correction, nor do you have to difference the data yourself—that's all done internally by the ESTIMATE instruction.

 

The draws for the impulse responses can be done using the stock @MCVARDODRAWS procedure:

 

@mcvardodraws(model=ectmodel,draws=mcdraws,steps=nsteps)

 

and graphs can be done with @MCGRAPHIRF (or you can use @MCPROCESSIRF to produce customized graphics or use @MCFEVDTABLE for error decompositions). Note that you do not use the ACCUM option on any of those procedures—the impulse responses for ECTMODEL already take into account the structure of the models, and produce responses of the levels, not the differences. This does the median responses with two layers of error bands, with 68% on the inner and 95% on the outer.

 

@mcgraphirf(model=ectmodel,varlabels=vlabels,shocklabels=vlabels,$

   center=median,percent=||.025,.16,.84,.975||,$

   footer="Pointwise 68 and 95% Posterior Bands")

Full Program

 

compute mcdraws=1000
compute nsteps=36
*
cal(m) 1975:1
open data haverate.rat
data(format=rats) 1975:1 2001:6 ftbs3 ftb12 fcm7
*
@johmle(lags=6,det=rc,cv=cvector)
# ftbs3 ftb12 fcm7
equation(coeffs=cvector) ecteq *
# ftbs3 ftb12 fcm7 constant
*
* Set up the model with the error correction term
*
system(model=ectmodel)
variables ftbs3 ftb12 fcm7
lags 1 to 6
ect ecteq
end(system)
*
dec vect[strings] vlabels
compute vlabels=||"3-Month T-Bills","1-Year T-Bills","7-year T-Bonds"||
estimate
*
@mcvardodraws(model=ectmodel,draws=mcdraws,steps=nsteps)
@mcgraphirf(model=ectmodel,varlabels=vlabels,shocklabels=vlabels,$
   center=median,percent=||.025,.16,.84,.975||,$
   footer="Pointwise 68 and 95% Posterior Bands")

Output

 

Likelihood Based Analysis of Cointegration

Variables:  FTBS3 FTB12 FCM7

Estimated from 1975:07 to 2001:06

Data Points 312 Lags 6 with Constant restricted to Cointegrating Vector

 

Unrestricted eigenvalues, -T log(1-lambda) and Trace Test

  Roots     Rank    EigVal   Lambda-max  Trace  Trace-95%

        3        0    0.0818    26.6264 41.2013   34.8000

        2        1    0.0333    10.5567 14.5750   19.9900

        1        2    0.0128     4.0183  4.0183    9.1300

 

Cointegrating Vector for Largest Eigenvalue

FTBS3     FTB12    FCM7      Constant

-3.154123 3.132882 -0.321838   0.619010

 

 

VAR/System - Estimation by Cointegrated Least Squares

Monthly Data From 1975:07 To 2001:06

Usable Observations                       312

 

Dependent Variable FTBS3

Mean of Dependent Variable       -0.005929487

Std Error of Dependent Variable   0.572477918

Standard Error of Estimate        0.491510475

Sum of Squared Residuals         71.508433993

Durbin-Watson Statistic                1.9616

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  D_FTBS3{1}                    0.143892238  0.183591916      0.78376  0.43380689

2.  D_FTBS3{2}                    0.192186442  0.183710031      1.04614  0.29634985

3.  D_FTBS3{3}                   -0.092909875  0.191610137     -0.48489  0.62811289

4.  D_FTBS3{4}                    0.408247277  0.174242798      2.34298  0.01979251

5.  D_FTBS3{5}                   -0.212660827  0.169932295     -1.25144  0.21176048

6.  D_FTB12{1}                    0.290088325  0.260050689      1.11551  0.26553809

7.  D_FTB12{2}                   -0.362872849  0.253978857     -1.42875  0.15412986

8.  D_FTB12{3}                    0.063761999  0.259907946      0.24533  0.80637455

9.  D_FTB12{4}                   -0.577081483  0.246168719     -2.34425  0.01972637

10. D_FTB12{5}                    0.151509694  0.247373031      0.61247  0.54069404

11. D_FCM7{1}                     0.218441482  0.191699666      1.13950  0.25541657

12. D_FCM7{2}                    -0.278771615  0.195277984     -1.42756  0.15447181

13. D_FCM7{3}                     0.165902869  0.196382770      0.84479  0.39890849

14. D_FCM7{4}                     0.162678086  0.199755989      0.81438  0.41607968

15. D_FCM7{5}                     0.233716355  0.196062364      1.19205  0.23419602

16. EC1{1}                        0.062282194  0.027826301      2.23825  0.02594825


 

Dependent Variable FTB12

Mean of Dependent Variable       -0.008685897

Std Error of Dependent Variable   0.561943004

Standard Error of Estimate        0.478368229

Sum of Squared Residuals         67.735504190

Durbin-Watson Statistic                1.9627

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  D_FTBS3{1}                   -0.196215312  0.178682946     -1.09812  0.27304455

2.  D_FTBS3{2}                    0.609142341  0.178797903      3.40688  0.00074806

3.  D_FTBS3{3}                   -0.220795394  0.186486772     -1.18397  0.23737345

4.  D_FTBS3{4}                    0.510834851  0.169583809      3.01229  0.00281676

5.  D_FTBS3{5}                   -0.357619776  0.165388563     -2.16230  0.03139593

6.  D_FTB12{1}                    0.468313663  0.253097328      1.85033  0.06526232

7.  D_FTB12{2}                   -0.744190992  0.247187847     -3.01063  0.00283170

8.  D_FTB12{3}                   -0.015874824  0.252958401     -0.06276  0.95000264

9.  D_FTB12{4}                   -0.618901400  0.239586540     -2.58321  0.01026839

10. D_FTB12{5}                    0.359172305  0.240758650      1.49184  0.13680725

11. D_FCM7{1}                     0.385581182  0.186573907      2.06664  0.03963750

12. D_FCM7{2}                    -0.250214867  0.190056546     -1.31653  0.18901517

13. D_FCM7{3}                     0.438478573  0.191131793      2.29412  0.02248400

14. D_FCM7{4}                     0.088147039  0.194414816      0.45340  0.65059530

15. D_FCM7{5}                     0.114017121  0.190819954      0.59751  0.55062274

16. EC1{1}                        0.018519738  0.027082268      0.68383  0.49461586


 

Dependent Variable FCM7

Mean of Dependent Variable       -0.008173077

Std Error of Dependent Variable   0.382826930

Standard Error of Estimate        0.323888686

Sum of Squared Residuals         31.051548720

Durbin-Watson Statistic                1.9830

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  D_FTBS3{1}                   -0.200394764  0.120980828     -1.65642  0.09869691

2.  D_FTBS3{2}                    0.439301740  0.121058662      3.62883  0.00033528

3.  D_FTBS3{3}                   -0.184196931  0.126264563     -1.45882  0.14567571

4.  D_FTBS3{4}                    0.279448031  0.114820077      2.43379  0.01553315

5.  D_FTBS3{5}                   -0.361887479  0.111979603     -3.23173  0.00136925

6.  D_FTB12{1}                    0.196795311  0.171364559      1.14840  0.25173008

7.  D_FTB12{2}                   -0.408312647  0.167363429     -2.43968  0.01528740

8.  D_FTB12{3}                   -0.109147013  0.171270497     -0.63728  0.52443602

9.  D_FTB12{4}                   -0.240149459  0.162216813     -1.48042  0.13982405

10. D_FTB12{5}                    0.461874003  0.163010414      2.83340  0.00492198

11. D_FCM7{1}                     0.461530253  0.126323560      3.65356  0.00030584

12. D_FCM7{2}                    -0.257426149  0.128681550     -2.00049  0.04636053

13. D_FCM7{3}                     0.444830857  0.129409566      3.43739  0.00067154

14. D_FCM7{4}                    -0.022530435  0.131632402     -0.17116  0.86421351

15. D_FCM7{5}                    -0.116804509  0.129198430     -0.90407  0.36669313

16. EC1{1}                       -0.034984890  0.018336586     -1.90793  0.05736794


 

Graphs


Copyright © 2025 Thomas A. Doan