VECM: Estimation of a Vector Error Correction Model

View source: R/varx.R

VECMR Documentation

Estimation of a Vector Error Correction Model

Description

Estimates a VECM under a given cointegration-rank restriction or cointegrating vectors.

Usage

VECM(
  y,
  dim_p,
  x = NULL,
  dim_q = dim_p,
  dim_r = NULL,
  beta = NULL,
  type = c("Case1", "Case2", "Case3", "Case4", "Case5"),
  t_D1 = list(),
  t_D2 = list(),
  D1 = NULL,
  D2 = NULL
)

Arguments

y

Matrix. A (K \times (p+T)) data matrix of the K endogenous time series variables.

dim_p

Integer. Lag-order p for the endogenous variables y.

x

Matrix. A (L \times (p+T)) data matrix of the L weakly exogenous time series variables.

dim_q

Integer. Lag-order q for the distributed lag of the weakly exogenous variables x.

dim_r

Integer. Cointegration-rank r of the VECM.

beta

Matrix. A ((K+L+n_{d1}) \times r) cointegrating matrix to be imposed – or estimated by the reduced-rank regression if NULL (the default).

type

Character. The conventional case of the deterministic term in the Johansen procedure.

t_D1

List of vectors. The activating break periods \tau for the period-specific deterministic regressors in d_{1,t}, which are restricted to the cointegration relations. Just as in coint, the accompanying lagged regressors are automatically included in d_{2,t}.

t_D2

List of vectors. The activating break periods \tau for the period-specific deterministic regressors in d_{2,t}, which are unrestricted.

D1

Matrix. A (n_{\bullet} \times (p+T)) data matrix of customized deterministic regressors added to d_{1,t}, which are restricted to the cointegration relations. Unlike 't_D1', these customized regressors require potential accompanying regressors to be manually included in d_{2,it}.

D2

Matrix. A (n_{\bullet} \times (p+T)) data matrix of customized deterministic regressors added to d_{2,t}, which are unrestricted. These additional regressors correspond to 'dumvar' in urca's ca.jo, which is fixed over bootstrap iterations.

Value

A list of class 'varx'.

References

Johansen, S. (1996): Likelihood-Based Inference in Cointegrated Vector Autoregressive Models, Advanced Texts in Econometrics, Oxford University Press, USA.

Luetkepohl, H. (2005): New Introduction to Multiple Time Series Analysis, Springer, 2nd ed.

Examples

### extend basic example in "vars" ###
library(vars)
data(Canada)
names_k = c("e", "U", "rw")  # names of endogenous variables
names_l = c("prod")  # names of exogenous variables
names_s = NULL  # optional shock names
x = Canada[ , names_l, drop=FALSE]
y = Canada[ , names_k, drop=FALSE]

# colnames of the restriction matrices are passed as shock names #
SR = matrix(NA, nrow=4, ncol=4, dimnames=list(NULL, names_s))
SR[4, 2] = 0
LR = matrix(NA, nrow=4, ncol=4, dimnames=list(NULL, names_s))
LR[1, 2:4] = 0
LR[2:4, 4] = 0

# estimate, identify, and plot the IRF #
R.vecm = VECM(y=y, dim_p=3, x=x, dim_q=3, dim_r=1, type="Case4")
R.grt  = id.grt(R.vecm, LR=LR, SR=SR)
R.irf  = irf(R.grt, n.ahead=50)
plot(R.irf)


pvars documentation built on Nov. 5, 2025, 6:57 p.m.