You can use package tsDyn for this, function VECM
, and summary()
on that output:
library(tsDyn)
library(vars)
#> Loading required package: MASS
#> Loading required package: strucchange
#> Loading required package: zoo
#>
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#>
#> as.Date, as.Date.numeric
#> Loading required package: sandwich
#> Loading required package: urca
#> Loading required package: lmtest
data(Canada)
beta_tsDyn <- VECM(Canada, lag = 1, estim = "ML")
## sd in parenthesis:
summary(beta_tsDyn)
#> #############
#> ###Model VECM
#> #############
#> Full sample size: 84 End sample size: 82
#> Number of variables: 4 Number of estimated slope parameters 24
#> AIC -496.5914 BIC -431.6099 SSR 98.31618
#> Cointegrating vector (estimated by ML):
#> e prod rw U
#> r1 1 0.150283 -0.2465121 3.61281
#>
#>
#> ECT Intercept e -1
#> Equation e 0.0132(0.0164) -12.2255(15.3094) 0.7656(0.1466)***
#> Equation prod 0.0666(0.0276)* -61.9059(25.7226)* -0.2986(0.2464)
#> Equation rw -0.1817(0.0335)*** 170.2479(31.2632)*** -0.1962(0.2994)
#> Equation U -0.0438(0.0123)*** 41.0526(11.4980)*** -0.5846(0.1101)***
#> prod -1 rw -1 U -1
#> Equation e 0.1651(0.0663)* -0.0236(0.0581) 0.1421(0.2009)
#> Equation prod 0.1479(0.1114) 0.1232(0.0977) -0.8435(0.3376)*
#> Equation rw -0.0437(0.1354) -0.0570(0.1187) 0.4351(0.4103)
#> Equation U -0.0731(0.0498) -0.0291(0.0437) -0.1331(0.1509)
## get matrix of ECT and their sd:
coefs_all <- summary(beta_tsDyn)$coefMat
coefs_all[grep("ECT", rownames(coefs_all)),]
#> Estimate Std. Error t value Pr(>|t|)
#> e:ECT 0.01324009 0.01640290 0.8071796 4.220820e-01
#> prod:ECT 0.06664213 0.02755983 2.4180891 1.799714e-02
#> rw:ECT -0.18171584 0.03349618 -5.4249718 6.638121e-07
#> U:ECT -0.04383977 0.01231927 -3.5586331 6.464448e-04
## just fo rthe sake of making sure, do we get same cointegrating vector as in urca?
beta_vars <- cajorls(ca.jo(Canada))$beta
all.equal(beta_vars,
coefB(beta_tsDyn), check.attributes = FALSE)
#> [1] TRUE