Hasbrouck(1995) proposes the calculation of the long-run decomposition of variance for a set of prices for a single security in several markets. The assumption is that the gaps between the prices in different markets is stationary, so they are linked by a single stochastic trend. The concept of the long-run decomposition of variance can be applied to any VECM, not just one with a single trend. We provide another example which includes an estimated (rather than assumed) cointegrating vector in hasbrouck.rpf.

The program file hasbrouck_bonds.rpf uses a different data set than in the Hasbrouck paper, but applies the same technique. The data in this case are bond prices of different maturities. The data are monthly with zero-coupon equivalent bond prices for 1, 2, 3, 4 and 5 year. The following converts these to yield per annum. The first loop normalizes (they are based upon $100 face values, hence the /100 to change to a $1 face value), while the SET instructions convert the log discount over n years to the equivalent per annum rate.

open data bondprice.prn

calendar(m) 1952:6

data(format=prn,org=columns) 1952:06 2003:12 qdate price1 price2 price3 price4 price5


* Normalize and convert to percentages


dofor s = price1 to price5

   set s = 100.0*log(s{0}/100.0)

end dofor s


* Compute percentage yields per annum


set y1 = -price1

set y2 = -price2/2.0

set y3 = -price3/3.0

set y4 = -price4/4.0

set y5 = -price5/5.0

This graphs the five yields:

graph(footer="Bond Yields") 5

# y1

# y2

# y3

# y4

# y5

With five cointegrating vectors, under the assumption, we can use any independent set of four gaps between yields as cointegrating vectors. (Actually, any set of weights that add to zero will work as a cointegrating vector, but gaps are obviously the simplest). In Hasbrouck's analysis, the constant is restricted to the cointegrating vector, so the intercepts in those are computed by taking means of the corresponding differences. This sets up the four error correction terms for the VECM, using the gaps between Y1 and each of the other four yields.

sstats(mean) / (y1-y2)>>mean12 (y1-y3)>>mean13 (y1-y4)>>mean14 (y1-y5)>>mean15

equation(coeffs=||1.0,-1.0,-mean12||) eq12

# y1 y2 constant

equation(coeffs=||1.0,-1.0,-mean13||) eq13

# y1 y3 constant

equation(coeffs=||1.0,-1.0,-mean14||) eq14

# y1 y4 constant

equation(coeffs=||1.0,-1.0,-mean15||) eq15

# y1 y5 constant

This uses @VARLagSelect to select the lag length for an unrestricted VAR. The lag length chosen by this (2 as shown in the output) can be used in the later VECM estimation.


# y1 y2 y3 y4 y5

This sets up and estimates the VECM:


variables y1 y2 y3 y4 y5

lags 1 to %%autop

ect eq12 eq13 eq14 eq15




This computes the long-run loadings for the system. Hasbrouck calls this \(\Psi\); in other treatments it is often called \(\bf{C}\). Note that this will always be an \(N \times N\) matrix for any VECM, just of rank equal to the number of common trends. The beta-perp is just a vector of 1's by assumption.

The forecast error variance in a VECM goes to infinity with the horizon (eventually at a linear rate), but the ratios converge, and that's what Hasbrouck computes. This computes the Cholesky factorization of the covariance matrix (in the natural order x-y). In practice, you can use any factor of the covariance matrix as F. (Hasbrouck suggests using different orderings to see what the limits are on contributions of different components).

compute f=%decomp(%sigma)

Given PSI and F, this computes and displays the decomposition of long-run variance:

compute split=psi*f

compute contrib=split.^2

compute [vector] variance=contrib*%ones(%cols(contrib),1)

compute contrib=%ddivide(contrib,variance)

disp "Decomposition of Long-run variance" contrib

Each row has the decomposition of a variable, where each column is the corresponding fraction of the long-run variance that is associated with the corresponding shock Where (as in this case), there is just one common trend in the VECM, the decomposition will be identical for each series.


VAR Lag Selection


   0  1.8074083

   1 -4.9137795

   2 -4.9592854*

   3 -4.8927897

   4 -4.7345130

   5 -4.5755459

   6 -4.4238027

   7 -4.2541699

   8 -4.0750437

   9 -3.9063727

  10 -3.7646193

  11 -3.6078685

  12 -3.4575746

Decomposition of Long-run variance

      0.78276       0.05865       0.01457       0.01560       0.12842

      0.78276       0.05865       0.01457       0.01560       0.12842

      0.78276       0.05865       0.01457       0.01560       0.12842

      0.78276       0.05865       0.01457       0.01560       0.12842

      0.78276       0.05865       0.01457       0.01560       0.12842