Skip to main content

VECM (Vector Error Correction Model)

VECM is a multivariate model used when several time series are non-stationary I(1) yet cointegrated — that is, a long-run equilibrium relationship exists among them. VECM extends VAR by adding an error correction term that captures the speed at which the variables return to long-run equilibrium after a shock.

In EcoLab, VECM belongs to the Time Series group. Unlike ARDL (a single equation, suitable when there is one clear dependent variable), VECM is appropriate when you suspect a multi-directional simultaneous relationship among the variables.


When should you use VECM?

  • You have two or more variables that are all I(1) and suspect a long-run (cointegrating) relationship.
  • You care about system dynamics (impulse responses, variance decomposition), not just a single equation.
  • Cointegration has been confirmed by the Johansen test (trace / max-eigenvalue).

If all variables are I(0) → use a plain VAR. If they are I(1) but NOT cointegrated → use a VAR in differences.


Model specification

Reduced VECM form:

ΔYt=ΠYt1+iΓiΔYti+εt\Delta Y_t = \Pi \, Y_{t-1} + \sum_i \Gamma_i \, \Delta Y_{t-i} + \varepsilon_t
  • Π=αβ\Pi = \alpha \beta': the matrix β\beta contains the cointegrating vectors (long-run relationships); α\alpha is the speed of adjustment.
  • The rank of Π=r\Pi = r = the number of cointegrating relationships, determined by the Johansen test.
  • Γi\Gamma_i: short-run dynamics.

Testing workflow

  1. Unit-root tests (ADF/PP/KPSS): confirm the variables are all I(1).
  2. Lag selection for the base VAR (AIC/BIC/HQ).
  3. Johansen cointegration test (trace & max-eigenvalue) → determine the rank rr.
  4. Estimate the VECM with rank rr; check the sign and significance of α\alpha (error correction).
  5. Residual diagnostics: autocorrelation (LM), normality, stability; analyze IRF and variance decomposition (FEVD).

Running in EcoLab

  1. Data Collection module: obtain the relevant time series (same frequency).
  2. Modeling module → Time Series group → VAR/VECM; choose the system of variables.
  3. Declare the lag length and the cointegration rank (or let the system suggest them from Johansen).
  4. Read the results: the long-run vector β\beta, the adjustment coefficient α\alpha, IRF/FEVD; get the code from the Replication Code tab.

Input / output example

Input (illustrative): quarterly series of lgdp (log GDP), lm2 (log money supply), lcpi (log price).

Output (format, illustrative figures — not real results):

ComponentValueNote
Johansen trace (r=0)rejectedat least one relationship
Johansen trace (r≤1)not rejectedr = 1
α\alpha (lgdp)−0.18***adjusts toward equilibrium
Long-run vector β\betalgdp − 0.7·lm2 + 0.5·lcpiequilibrium relationship

Replication code

* --- VECM ---
tsset time

* Step 1: Johansen cointegration rank test
vecrank y1 y2 y3, lags(2)

* Step 2: Estimate VECM with rank r = 1
vec y1 y2 y3, rank(1) lags(2)

* Long-run cointegrating vector (beta)
* Speed-of-adjustment coefficients (alpha)

* IRF from VECM
irf create vecirf, set(vec_irf) step(20)
irf graph oirf

Limitations and notes

  • Sensitive to lag selection and the deterministic terms (constant/trend) in Johansen.
  • Requires a sufficiently long sample; Johansen results are unreliable with short samples.
  • Interpreting cointegrating vectors requires normalization and grounding in economic theory.
  • Does not handle I(2) variables; check the order of integration first.

Video tutorial

Video Tutorial: Running VECM in EcoLab

See also