HASBROUCK.RPF provides an example of the long-run decomposition of variance from J. Hasbrouck(1995). The original paper worked with a set of (log) prices which were considered to be tied to a single security, so, while the series were all non-stationary, there was only a single stochasic trend linking them, and the cointegrating space was assumed known (as the differences between any two prices was thought to be stationary). However, there is no reason for the idea of the long-run decomposition of variance to be limited to that situation alone—you can compute if for any Vector Error Correction Model (VECM).

This example looks at weekly data on two US Treasury Bill yields (for 3 month and 6 month). It does the calculation of the long-run decomposition using both an estimated cointegrating vector, and an assumed cointegrating vector (basically the same one used in the Hasbrouck paper). Another example of the technique that is closer to the analysis in the original paper is provided in Hasbrouck(1995).

open data w-tb3n6ms.txt

calendar(w) 1958:12:12

data(format=free,top=2,org=columns) 1958:12:12 2004:8:6 tb3mo tb6mo

*

* This is to simplify the descriptions throughout the program

*

set x = tb3mo

set y = tb6mo

This uses @VARLagSelect to select the lag length for an unrestricted VAR. The lag length chosen by this (3 as shown in the output) can be used in the later VECM estimation. Note that %%AUTOP (the variable defined by the procedure with the chosen lag length) is used in both the @JOHMLE procedure and in the VAR specification below—both count the lags in the expanded model, not the lags on differenced variables only.

@varlagselect(crit=sbc,lags=12)

# x y

This uses @JOHMLE to estimate the cointegrating space (output)

@johmle(lags=%%autop,det=constant,vectors=direct)

# x y

At conventional significance levels, one would actually reject that the two series have any unit root, much less that there is exactly one. However, with such a large number of observations (2380), the smallest eigenvalue is really quite small, the difference in the log likelihood is not very large (given the number of data points) would indicate that proceeding on the basis of a single cointegrating vector isn't unreasonable despite the test statistic being somewhat larger than the .05 rejection level.

This creates the error correction term from the first cointegrating vector:

compute beta=%xcol(direct,1)

equation(coeffs=beta) eecteq *

# x y

and this sets up and estimates the corresponding VECM:

system(model=evecm)

variables x y

det constant

lags 1 to %%autop

ect eecteq

end(system)

*

estimate

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.

compute alphaperp=%perp(%vecmalpha)

compute betaperp=%perp(beta)

compute psi=betaperp*inv(tr(alphaperp)*%varlagsums*betaperp)*tr(alphaperp)

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 (so the first column will be the shock in X and the second in the Cholesky factor shock in Y). Where (as in this case), there is just one common trend in the VECM, the decomposition will be identical.

Decomposition of Long-run variance

0.71437       0.28563

0.71437       0.28563

The second approach is basically what is used in the original paper. The cointegrating vector is assumed to be 1,-1 with constant restricted to the CV. (So the gap between the yields is assumed to be stationary). The map of the gap is used to take care of the constant in the CV:

sstats(mean) / (x-y)>>meanxy

equation(coeffs=||1.0,-1.0,-meanxy||) eqxy

# x y constant

Given that, the rest is effectively the same:

system(model=vecm)

variables x y

det constant

lags 1 to %%autop

ect eqxy

end(system)

*

estimate

compute alphaperp=%perp(%vecmalpha)

compute betaperp=%ones(2,1)

compute psi=betaperp*inv(tr(alphaperp)*%varlagsums*betaperp)*tr(alphaperp)

compute f=%decomp(%sigma)

compute split=psi*f

compute contrib=split.^2

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

ewise contrib(i,j)=contrib(i,j)/variance(i)

*

disp "Decomposition of Long-run variance" contrib

Full Program

open data w-tb3n6ms.txt
calendar(w) 1958:12:12
data(format=free,top=2,org=columns) 1958:12:12 2004:8:6 tb3mo tb6mo
*
* This is to simplify the descriptions throughout the program
*
set x = tb3mo
set y = tb6mo
*
@varlagselect(crit=sbc,lags=12)
# x y
*
* With empirically determined cointegrating vector
*
* Estimate cointegrating vector
*
@johmle(lags=%%autop,det=constant,vectors=direct)
# x y
compute beta=%xcol(direct,1)
equation(coeffs=beta) eecteq *
# x y
*
* Estimate VECM
*
system(model=evecm)
variables x y
det constant
lags 1 to %%autop
ect eecteq
end(system)
*
estimate
*
* Compute long-run matrix
*
compute alphaperp=%perp(%vecmalpha)
compute betaperp=%perp(beta)
compute psi=betaperp*inv(tr(alphaperp)*%varlagsums*betaperp)*tr(alphaperp)
*
* Compute Cholesky factorization of sigma
*
compute f=%decomp(%sigma)
*
* Compute decomposition of long-run variance
*
compute split=psi*f
compute contrib=split.^2
compute [vector] variance=contrib*%ones(%cols(contrib),1)
ewise contrib(i,j)=contrib(i,j)/variance(i)
*
disp "Decomposition of Long-run variance" contrib
*****************************************************************
*
* With theoretical cointegrating vector
*
* The cointegrating vector is 1,-1 with constant restricted to the CV.
* The mean of the gap is used to take care of the constant.
*
sstats(mean) / (x-y)>>meanxy
equation(coeffs=||1.0,-1.0,-meanxy||) eqxy
# x y constant
*
system(model=vecm)
variables x y
det constant
lags 1 to %%autop
ect eqxy
end(system)
*
estimate
*
compute alphaperp=%perp(%vecmalpha)
compute betaperp=%ones(2,1)
compute psi=betaperp*inv(tr(alphaperp)*%varlagsums*betaperp)*tr(alphaperp)
*
* Compute Cholesky factorization of sigma
*
compute f=%decomp(%sigma)
*
* Compute decomposition of long-run variance
*
compute split=psi*f
compute contrib=split.^2
compute [vector] variance=contrib*%ones(%cols(contrib),1)
ewise contrib(i,j)=contrib(i,j)/variance(i)
*
disp "Decomposition of Long-run variance" contrib


Output

VAR Lag Selection

Lags SBC/BIC

0  4.6243319

1 -2.5382092

2 -2.6280922

3 -2.6519316*

4 -2.6418374

5 -2.6345211

6 -2.6348747

7 -2.6274272

8 -2.6275968

9 -2.6164856

10 -2.6078608

11 -2.5957255

12 -2.5858686

Likelihood Based Analysis of Cointegration

Variables:  X Y

Estimated from 1959:01:02 to 2004:08:06

Data Points 2380 Lags 3 with Constant

Unrestricted eigenvalues and -T log(1-lambda)

Rank     EigVal  Lambda-max  Trace  Trace-95%   LogL

0                                       3173.7918

1   0.0322    77.7775 83.2625   15.4100 3212.6805

2   0.0023     5.4850  5.4850    3.8400 3215.4230

Cointegrating Vector for Largest Eigenvalue

X         Y

-4.841219 4.901440

Decomposition of Long-run variance

0.71437       0.28563

0.71437       0.28563

VAR/System - Estimation by Cointegrated Least Squares

Weekly Data From 1959:01:02 To 2004:08:06

Usable Observations                      2380

Dependent Variable X

Mean of Dependent Variable       -0.000529412

Std Error of Dependent Variable   0.212503772

Standard Error of Estimate        0.200903142

Sum of Squared Residuals         95.819559913

Durbin-Watson Statistic                2.0061

Variable                        Coeff      Std Error      T-Stat      Signif

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

1.  D_X{1}                        0.046563838  0.048032664      0.96942  0.33243430

2.  D_X{2}                       -0.206708916  0.048098940     -4.29758  0.00001796

3.  D_Y{1}                        0.265016920  0.053808526      4.92518  0.00000090

4.  D_Y{2}                        0.254739566  0.054285930      4.69255  0.00000285

5.  Constant                     -0.021703951  0.006093409     -3.56187  0.00037547

6.  EC1{1}                        0.019593957  0.004118113      4.75799  0.00000207

Dependent Variable Y

Mean of Dependent Variable       -0.000529412

Std Error of Dependent Variable   0.189401985

Standard Error of Estimate        0.180737213

Sum of Squared Residuals         77.548941844

Durbin-Watson Statistic                2.0051

Variable                        Coeff      Std Error      T-Stat      Signif

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

1.  D_X{1}                       -0.041903295  0.043211319     -0.96973  0.33228008

2.  D_X{2}                       -0.034633868  0.043270943     -0.80040  0.42356177

3.  D_Y{1}                        0.316443817  0.048407421      6.53709  0.00000000

4.  D_Y{2}                        0.099389637  0.048836905      2.03513  0.04194829

5.  Constant                     -0.005099778  0.005481775     -0.93032  0.35230255

6.  EC1{1}                        0.004361043  0.003704752      1.17715  0.23925423

Decomposition of Long-run variance

0.71294       0.28706

0.71294       0.28706

VAR/System - Estimation by Cointegrated Least Squares

Weekly Data From 1959:01:02 To 2004:08:06

Usable Observations                      2380

Dependent Variable X

Mean of Dependent Variable       -0.000529412

Std Error of Dependent Variable   0.212503772

Standard Error of Estimate        0.200797185

Sum of Squared Residuals         95.718515280

Durbin-Watson Statistic                2.0061

Variable                        Coeff      Std Error      T-Stat      Signif

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

1.  D_X{1}                        0.048486354  0.047986068      1.01043  0.31239438

2.  D_X{2}                       -0.204537574  0.048052287     -4.25656  0.00002157

3.  D_Y{1}                        0.263351220  0.053742129      4.90028  0.00000102

4.  D_Y{2}                        0.253403207  0.054200839      4.67526  0.00000310

5.  Constant                     -0.000323186  0.004115971     -0.07852  0.93742103

6.  EC1{1}                       -0.098607364  0.019655344     -5.01682  0.00000056

Dependent Variable Y

Mean of Dependent Variable       -0.000529412

Std Error of Dependent Variable   0.189401985

Standard Error of Estimate        0.180700187

Sum of Squared Residuals         77.517171688

Durbin-Watson Statistic                2.0051

Variable                        Coeff      Std Error      T-Stat      Signif

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

1.  D_X{1}                       -0.038955127  0.043183332     -0.90209  0.36710211

2.  D_X{2}                       -0.031412792  0.043242923     -0.72643  0.46764916

3.  D_Y{1}                        0.313366545  0.048363292      6.47943  0.00000000

4.  D_Y{2}                        0.096292876  0.048776091      1.97418  0.04847681

5.  Constant                     -0.000340417  0.003704019     -0.09190  0.92678144

6.  EC1{1}                       -0.027168526  0.017688118     -1.53598  0.12467750

Decomposition of Long-run variance

0.67269       0.32731

0.67269       0.32731