VECMCAUSE.RPF is an example of testing for causality in a VECM. This has separate tests for causality and long-run causality.
The data are 3 and 6 month US TBill yields. Because these don't trend, the appropriate choice for the Johansen test (done with @JOHMLE) is DET=RC (constant restricted to the cointegrating vector):
@johmle(lags=nlags,det=rc,cv=cv)
# tb3mo tb6mo
Based upon the output, we conclude that the series are cointegrated. The further analysis is done with the estimated cointegrating vector:
set z = cv(1)*tb3mo+cv(2)*tb6mo+cv(3)
The CV(3) is there because of the use of DET=RC. The constant is included there and not in the error correction representation. Error correction regressions are estimated for each of the series, regressing the difference on lagged "Z" and the lags of both differenced series. This does the regression for the 3 month rate:
set d3mo = tb3mo-tb3mo{1}
set d6mo = tb6mo-tb6mo{1}
linreg d3mo
# z{1} d3mo{1 to nlags-1} d6mo{1 to nlags-1}
(Note: there is no CONSTANT because the cointegrating model is DET=RC). The overall causality test for the 6 month to 3 month is testing jointly for zeros on Z{1} and the lags of D6MO:
exclude(title="Test for 6MO causing 3MO")
# z{1} d6mo{1 to nlags-1}
and the test for long-run causality looks at Z{1} only:
exclude(title="Test for 6MO long-run causing 3MO")
# z{1}
The results show long-run causality from 6MO to 3MO
The reverse direction tests are done with the analogous:
linreg d6mo
# z{1} d3mo{1 to nlags-1} d6mo{1 to nlags-1}
exclude(title="Test for 3MO causing 6MO")
# z{1} d3mo{1 to nlags-1}
exclude(title="Test for 3MO long-run causing 6MO")
# z{1}
The results here show causality but not long-run causality from 3MO to 6MO.
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 * * Test for cointegration. (We should test for unit roots first, but it's * fairly well-known that these are non-stationary). * compute nlags=10 * @johmle(lags=nlags,det=rc,cv=cv) # tb3mo tb6mo * * We conclude that the two series are cointegrated. The rest of this * uses the estimated cointegrating vector, though a theoretical value * (in this case (1,-1)) could also be used. * set z = cv(1)*tb3mo+cv(2)*tb6mo+cv(3) * set d3mo = tb3mo-tb3mo{1} set d6mo = tb6mo-tb6mo{1} * * 6 causing 3 * linreg d3mo # z{1} d3mo{1 to nlags-1} d6mo{1 to nlags-1} exclude(title="Test for 6MO causing 3MO") # z{1} d6mo{1 to nlags-1} exclude(title="Test for 6MO long-run causing 3MO") # z{1} * * 3 causing 6 * linreg d6mo # z{1} d3mo{1 to nlags-1} d6mo{1 to nlags-1} exclude(title="Test for 3MO causing 6MO") # z{1} d3mo{1 to nlags-1} exclude(title="Test for 3MO long-run causing 6MO") # z{1}
Output
Likelihood Based Analysis of Cointegration
Variables: TB3MO TB6MO
Estimated from 1959:02:20 to 2004:08:06
Data Points 2373 Lags 10 with Constant restricted to Cointegrating Vector
Unrestricted eigenvalues and -T log(1-lambda)
Rank EigVal Lambda-max Trace Trace-95% LogL
0 3225.2802
1 0.0259 62.3562 67.0737 20.1600 3256.4583
2 0.0020 4.7175 4.7175 9.1400 3258.8170
Cointegrating Vector for Largest Eigenvalue
TB3MO TB6MO Constant
5.319718 -5.375225 1.128813
Linear Regression - Estimation by Least Squares
Dependent Variable D3MO
Weekly Data From 1959:02:20 To 2004:08:06
Usable Observations 2373
Degrees of Freedom 2354
Centered R^2 0.1334503
R-Bar^2 0.1268242
Uncentered R^2 0.1334558
Mean of Dependent Variable -0.000535188
Std Error of Dependent Variable 0.212736745
Standard Error of Estimate 0.198789464
Sum of Squared Residuals 93.023608385
Log Likelihood 475.9999
Durbin-Watson Statistic 1.9979
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Z{1} -0.017101378 0.004080792 -4.19070 0.00002884
2. D3MO{1} 0.052434528 0.050425930 1.03983 0.29852445
3. D3MO{2} -0.181149552 0.050481690 -3.58842 0.00033948
4. D3MO{3} -0.068750983 0.051100938 -1.34540 0.17862706
5. D3MO{4} 0.097109180 0.050711964 1.91492 0.05562422
6. D3MO{5} -0.067968381 0.050557673 -1.34437 0.17895727
7. D3MO{6} -0.112841890 0.050401548 -2.23886 0.02525828
8. D3MO{7} 0.098750478 0.050231057 1.96592 0.04942467
9. D3MO{8} -0.067073655 0.048796087 -1.37457 0.16939552
10. D3MO{9} 0.106837695 0.048705265 2.19356 0.02836486
11. D6MO{1} 0.261721396 0.055864536 4.68493 0.00000296
12. D6MO{2} 0.209471878 0.056306025 3.72024 0.00020369
13. D6MO{3} 0.096165935 0.056789132 1.69339 0.09051428
14. D6MO{4} -0.060031557 0.056530885 -1.06192 0.28837869
15. D6MO{5} 0.097089164 0.056315322 1.72403 0.08483417
16. D6MO{6} 0.165910068 0.055984745 2.96349 0.00307226
17. D6MO{7} -0.225042143 0.055952339 -4.02203 0.00005952
18. D6MO{8} 0.104141828 0.054811972 1.89998 0.05755741
19. D6MO{9} -0.157050531 0.054790232 -2.86640 0.00418862
Test for 6MO causing 3MO
Null Hypothesis : The Following Coefficients Are Zero
Z Lag(s) 1
D6MO Lag(s) 1 to 9
F(10,2354)= 12.75506 with Significance Level 0.00000000
Test for 6MO long-run causing 3MO
Null Hypothesis : The Following Coefficients Are Zero
Z Lag(s) 1
t(2354)= -4.190700 or F(1,2354)= 17.561969 with Significance Level 0.00002884
Linear Regression - Estimation by Least Squares
Dependent Variable D6MO
Weekly Data From 1959:02:20 To 2004:08:06
Usable Observations 2373
Degrees of Freedom 2354
Centered R^2 0.1141866
R-Bar^2 0.1074132
Uncentered R^2 0.1141963
Mean of Dependent Variable -0.000627897
Std Error of Dependent Variable 0.189616152
Standard Error of Estimate 0.179143300
Sum of Squared Residuals 75.545325958
Log Likelihood 722.9349
Durbin-Watson Statistic 1.9983
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Z{1} -0.003605806 0.003677492 -0.98051 0.32693671
2. D3MO{1} -0.028232969 0.045442386 -0.62129 0.53446798
3. D3MO{2} -0.009897222 0.045492635 -0.21756 0.82779347
4. D3MO{3} -0.043994419 0.046050684 -0.95535 0.33949994
5. D3MO{4} 0.127715368 0.045700151 2.79464 0.00523789
6. D3MO{5} -0.095529392 0.045561109 -2.09673 0.03612386
7. D3MO{6} -0.058179627 0.045420414 -1.28091 0.20035019
8. D3MO{7} 0.052914689 0.045266772 1.16895 0.24254128
9. D3MO{8} -0.072366890 0.043973619 -1.64569 0.09996135
10. D3MO{9} 0.064662009 0.043891773 1.47321 0.14082682
11. D6MO{1} 0.307452051 0.050343500 6.10709 0.00000000
12. D6MO{2} 0.054514688 0.050741357 1.07436 0.28276968
13. D6MO{3} 0.076150520 0.051176719 1.48799 0.13688709
14. D6MO{4} -0.079513381 0.050943994 -1.56080 0.11870539
15. D6MO{5} 0.079280714 0.050749736 1.56219 0.11837773
16. D6MO{6} 0.092612714 0.050451829 1.83567 0.06653312
17. D6MO{7} -0.157359766 0.050422625 -3.12082 0.00182538
18. D6MO{8} 0.108200135 0.049394960 2.19051 0.02858506
19. D6MO{9} -0.110082952 0.049375368 -2.22951 0.02587389
Test for 3MO causing 6MO
Null Hypothesis : The Following Coefficients Are Zero
Z Lag(s) 1
D3MO Lag(s) 1 to 9
F(10,2354)= 2.54456 with Significance Level 0.00471672
Test for 3MO long-run causing 6MO
Null Hypothesis : The Following Coefficients Are Zero
Z Lag(s) 1
t(2354)= -0.980507 or F(1,2354)= 0.961394 with Significance Level 0.32693671