Bayesian VECM — III. Money demand — R cross-check¶
Vector autoregressions, Part 6c (R)¶
Validates bvecm_money_python.ipynb. The series are genuinely I(1) (so cointegration is well-defined), but the Johansen trace test should return $r=0$: the classic long-run money-demand relation has broken down. urca's ur.df (unit-root tests) and ca.jo (Johansen) confirm the Python finding.
Data: bvecm_money_data.csv — log real M2, log real GDP, 3-month rate, quarterly 1959–2019 (FRED).
In [1]:
.libPaths('C:/Users/user/R/win-library/4.6')
suppressMessages(library(urca))
d <- read.csv('bvecm_money_data.csv'); Y <- d[, c('realM2','realGDP','tbill')]
for (nm in colnames(Y)) {
s <- summary(ur.df(Y[[nm]], type = 'drift', lags = 4, selectlags = 'AIC'))
cat(sprintf('ADF %-8s: stat %6.2f (5%% crit %.2f) -> %s\n', nm, s@teststat[1], s@cval[1,2],
ifelse(s@teststat[1] > s@cval[1,2], 'I(1)', 'I(0)')))
}
jo <- ca.jo(Y, type = 'trace', ecdet = 'none', K = 2, spec = 'transitory')
cat('\nJohansen trace test:\n'); print(round(cbind(trace = jo@teststat, jo@cval), 1))
cat('\ncross-check -> Python: all three I(1), but Johansen r=0 -> money-demand cointegration has BROKEN DOWN\n')
ADF realM2 : stat -0.36 (5% crit -2.88) -> I(1) ADF realGDP : stat -1.81 (5% crit -2.88) -> I(1) ADF tbill : stat -2.26 (5% crit -2.88) -> I(1)
Johansen trace test:
trace 10pct 5pct 1pct r <= 2 | 0.5 6.5 8.2 11.7 r <= 1 | 5.6 15.7 18.0 23.5 r = 0 | 18.1 28.7 31.5 37.2
cross-check -> Python: all three I(1), but Johansen r=0 -> money-demand cointegration has BROKEN DOWN
Same verdict: the relation is gone¶
ur.dfconfirms all three series are I(1) — genuine candidates for cointegration, so (unlike the Fisher case) the test is meaningful.ca.jofinds $r=0$. Even the first trace statistic falls short of its critical value: there is no cointegrating vector. Maximum likelihood and the Bayesian VECM agree — no stable long-run money demand over this sample.- Together with Parts 6a–6b, the three R cross-checks reproduce the full spectrum: $r=2$ (yields), full rank (Fisher), $r=0$ (money) — the rank is the whole story, and it replicates across method and software.
References¶
- Pfaff, B. (2008). Analysis of Integrated and Cointegrated Time Series with R. Springer.
- Friedman, B. M. & Kuttner, K. N. (1992). American Economic Review 82, 472–492.