Chapter 24 — Vector Error Correction Models (VECM)
In earlier chapters, we studied:
nonstationary time series,
cointegration,
and error correction models (ECMs).
We also introduced:
VAR models,
multivariate dynamics,
and impulse response analysis.
VAR models allow economic variables to interact dynamically through time.
But an important problem arises when variables are:
Many macroeconomic and financial variables display precisely this behavior.
Examples include:
money supply and prices,
GDP and credit,
exchange rates and inflation,
stock indices across markets.
These variables may drift individually through time, yet still maintain stable long-run relationships.
This raises an important question.
The answer is the:
VECMs combine:
multivariate dynamics,
cointegration,
and equilibrium adjustment
within a unified framework.
Throughout this chapter, we use Thai macroeconomic data as a running example.
Learning Objectives¶
By the end of this chapter, you should be able to:
explain the intuition behind VECMs
distinguish VARs from VECMs
understand equilibrium correction
interpret error correction terms
understand short-run versus long-run dynamics
estimate VECMs
understand cointegration rank
interpret adjustment coefficients
perform Johansen cointegration tests
interpret VECMs economically
24.1 Why Standard VAR Models Become Problematic¶
Standard VAR models usually require stationary variables.
But many macroeconomic variables are:
trending,
persistent,
and integrated of order one.
Examples include:
CPI,
money supply,
nominal GDP,
and price levels.
The Problem¶
Suppose we estimate a VAR using nonstationary variables.
Several problems may arise:
spurious relationships,
unreliable statistical inference,
unstable long-run behavior.
One common solution is:
Differencing often restores stationarity.
But differencing introduces another important problem.
For example:
inflation and money supply may move together over decades,
GDP and credit may share common long-run trends,
exchange rates and prices may adjust toward purchasing power parity.
Pure differencing may destroy this information.
24.2 Cointegration and Long-Run Equilibrium¶
Suppose two variables:
drift through time individually,
but maintain a stable long-run relationship.
Then they may be:
Cointegration implies that long-run equilibrium forces exist even when short-run fluctuations are substantial.
Intuition¶
Cointegrated variables may temporarily drift apart.
But equilibrium forces gradually pull them back together.
This creates a distinction between:
short-run deviations,
and long-run equilibrium restoration.
24.3 Rubber-Band Analogy¶
A useful analogy is:
Short-run shocks may pull the variables apart temporarily.
But the rubber band creates pressure toward equilibrium.
This is precisely the role of the:
24.4 From ECM to VECM¶
Earlier in the book, we studied single-equation ECMs.
For example:
The term:
measures deviation from long-run equilibrium.
Extending to Multiple Variables¶
A VECM generalizes this idea to:
several variables,
several equations,
and multiple equilibrium relationships.
24.5 Short-Run versus Long-Run Dynamics¶
One of the most important features of a VECM is the separation between:
short-run movements,
and long-run equilibrium adjustment.
Short-Run Dynamics¶
Short-run fluctuations capture:
temporary shocks,
cyclical movements,
and immediate reactions.
These effects may generate temporary deviations from equilibrium.
Long-Run Dynamics¶
Long-run dynamics capture:
equilibrium restoration,
persistent relationships,
and gradual adjustment forces.
24.6 Thai Macroeconomic Example¶
We now examine Thai macroeconomic variables.
Our dataset contains:
CPI,
broad money supply (BM),
and real GDP.
These variables are useful because:
they display strong trends,
they may be nonstationary,
and economic theory suggests possible long-run relationships.
24.7 Loading the Data¶
import pandas as pd
from io import StringIO
data_text = """
year,cpi,BM_,gdp_r
1991,50.70,204654.4084,38.23977231
1992,52.80,237852.2993,41.58407966
1993,54.50,272926.6351,43.40940123
1994,57.30,302096.2673,46.88149708
1995,60.60,355694.6742,50.68815184
1996,64.10,393470.4887,53.55329227
1997,67.70,470396.7099,52.07872106
1998,73.10,517768.2452,48.10357948
1999,73.30,537431.8537,50.30235946
2000,74.50,563808.6622,52.54366163
2001,75.70,594569.9039,54.3535078
2002,76.20,617075.0830,57.69600000
2003,77.60,707867.6497,61.84370042
2004,79.80,747291.5105,65.73352411
2005,83.40,792795.6350,68.48596905
2006,87.30,857454.6312,71.88876509
2007,89.20,911063.5572,75.79552154
2008,94.10,994546.5100,77.10330582
2009,93.30,1061828.8660,76.53419316
2010,96.33,1178006.9540,82.27951477
2011,100.00,1356089.1230,82.96559013
2012,103.02,1496760.9480,88.96449269
2013,105.27,1606334.2890,91.36862416
2014,107.26,1681035.3120,92.11543151
"""
thai = pd.read_csv(
StringIO(data_text)
)
thai.head()24.8 Plotting the Variables¶
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots(figsize=(10,5))
# Left axis: CPI
ax1.plot(
thai["year"],
thai["cpi"],
linewidth=2,
label="CPI"
)
ax1.set_xlabel("Year")
ax1.set_ylabel("CPI")
# Right axis: Broad Money
ax2 = ax1.twinx()
ax2.plot(
thai["year"],
thai["BM_"],
linewidth=2,
linestyle="--",
label="Broad Money"
)
ax2.set_ylabel("Broad Money")
plt.title("Thailand: CPI and Broad Money")
lines1, labels1 = ax1.get_legend_handles_labels()
lines2, labels2 = ax2.get_legend_handles_labels()
ax1.legend(
lines1 + lines2,
labels1 + labels2,
loc="upper left"
)
plt.savefig(
"figs/ch24/cpiBM.png",
dpi=300,
bbox_inches="tight"
)
plt.close()
This immediately raises important questions:
Are the variables nonstationary?
Do they share a long-run equilibrium relationship?
Could they be cointegrated?
24.9 A Simple VECM Representation¶
A simple VECM may be written as:
This model combines:
short-run dynamics,
and long-run equilibrium correction.
Short-Run Dynamics¶
The differenced variables:
capture:
short-run fluctuations,
temporary shocks,
and immediate dynamic interactions.
These effects describe how variables move from period to period.
Long-Run Equilibrium Correction¶
The term:
measures deviation from long-run equilibrium.
If the variables drift too far apart, the system gradually adjusts.
Adjustment Speed¶
The coefficient:
measures how strongly the system reacts to disequilibrium.
large values imply faster adjustment,
smaller values imply slower correction.
24.10 Extending to Multivariate Systems¶
In larger systems involving several variables, the same ideas continue to apply.
A multivariate VECM contains:
short-run dynamics,
long-run equilibrium relationships,
and adjustment mechanisms.
Economists often write these systems compactly using matrix notation.
You do not need to focus heavily on the matrix algebra.
Conceptually, the interpretation remains the same:
differenced terms capture short-run movements,
while the equilibrium term captures long-run correction forces.
24.11 Cointegration and Adjustment¶
The long-run equilibrium structure of a VECM is often summarized using:
Conceptually:
describes the long-run equilibrium relationships,
while measures how strongly variables adjust when equilibrium is disturbed.
Intuition¶
Suppose prices rise much faster than money supply.
The system may become temporarily unbalanced.
Adjustment mechanisms may then generate:
slower price growth,
faster money growth,
or both.
This gradual return toward equilibrium is the essence of error correction dynamics.
24.12 Cointegration Rank¶
An important concept in VECMs is the:
The rank determines how many long-run equilibrium relationships exist in the system.
| Rank | Interpretation |
|---|---|
| 0 | no cointegration |
| 1 | one equilibrium relationship |
| multiple | several equilibrium relationships |
24.13 Johansen Cointegration Test¶
The Johansen procedure is the standard approach for testing cointegration in multivariate systems.
Unlike the Engle–Granger approach, Johansen testing allows:
multiple variables,
and multiple cointegrating relationships.
24.14 Trace and Maximum Eigenvalue Tests¶
Johansen procedures commonly report:
trace statistics,
and maximum eigenvalue statistics.
These help answer the question:
24.15 Johansen Test in Python¶
from statsmodels.tsa.vector_ar.vecm import coint_johansen
data = thai[["cpi","BM_"]].dropna()
johansen_test = coint_johansen(
data,
det_order=0,
k_ar_diff=2
)
print(johansen_test.lr1)[7.30400737e+00 1.97612579e-03]24.16 Estimating a VECM in Python¶
from statsmodels.tsa.vector_ar.vecm import VECM
model = VECM(
data,
k_ar_diff=2,
coint_rank=1
)
results = model.fit()
print(results.summary())24.17 Interpreting the VECM Results¶
The VECM combines:
differenced short-run dynamics,
and long-run equilibrium correction.
A crucial component is the:
This measures deviation from long-run equilibrium.
Example¶
Suppose money supply rises much faster than prices.
The VECM captures pressure for future adjustment.
Possible responses include:
inflation increasing,
money growth slowing,
or both.
24.18 Adjustment Speeds¶
Adjustment coefficients measure:
Large Adjustment Coefficients¶
Large coefficients suggest:
rapid correction,
strong equilibrium restoration,
and faster adjustment.
Small Adjustment Coefficients¶
Small coefficients suggest:
slow adjustment,
persistent disequilibrium,
and weaker correction forces.
24.19 VECMs versus VARs in Differences¶
A differenced VAR removes long-run equilibrium information.
A VECM preserves it.
| Feature | VAR in Differences | VECM |
|---|---|---|
| stationary dynamics | ✓ | ✓ |
| long-run equilibrium | ✗ | ✓ |
| cointegration | ignored | incorporated |
| equilibrium adjustment | ✗ | ✓ |
24.20 Forecasting with VECMs¶
VECMs are often superior to differenced VARs when cointegration exists.
Why?
Because they preserve:
equilibrium relationships,
long-run information,
and adjustment dynamics.
24.22 Financial Applications of VECMs¶
VECMs are widely used in finance.
Examples include:
pairs trading,
stock market integration,
exchange-rate systems,
and interest-rate term structure.
Example: Pairs Trading¶
If two stock prices are cointegrated:
temporary deviations may create trading opportunities.
This idea underlies many statistical arbitrage strategies.
24.22 Macroeconomic Applications¶
VECMs are also widely used in macroeconomics.
Examples include:
money demand,
purchasing power parity,
inflation dynamics,
and monetary policy transmission.
24.23 Gretl Example: Johansen Test and VECM¶
Gretl provides built-in tools for cointegration testing and VECM estimation.
Step 1¶
Load multiple nonstationary variables.
Step 2¶
Menu:
Model → Time Series → VECMStep 3¶
Choose:
lag length,
deterministic terms,
and cointegration rank.
[GRETL Screenshot Placeholder: Johansen test output]Step 4¶
Estimate the VECM.
GRETL reports:
cointegration vectors,
adjustment coefficients,
and short-run dynamics.
[GRETL Screenshot Placeholder: VECM estimation output]24.24 Common Mistakes¶
24.25 Looking Ahead¶
This concludes our introduction to multivariate time series systems.
We have now studied:
VAR models,
impulse responses,
and VECMs.
The next part of the book turns toward:
volatility,
ARCH models,
and GARCH models.
We shift from modeling:
toward modeling:
of financial time series.
Key Takeaways¶
Concept Check¶
Basic¶
What is a Vector Error Correction Model (VECM)?
How does a VECM differ from a standard VAR model?
When should a VECM be used instead of a VAR?
Intuition¶
Why is differencing alone not sufficient when variables are cointegrated?
What is the economic meaning of cointegration in a multivariate system?
Explain the “rubber band” analogy in the context of VECM.
Structure¶
What are the two main components of a VECM?
What does the term represent?
What do the terms capture?
α and β¶
What does the matrix represent?
What does the matrix represent?
Why is the decomposition important?
Challenge¶
Why is it not enough to estimate a VAR in differences when variables are cointegrated?
Interpretation & Practice¶
A system shows strong cointegration.
What does this imply about long-run relationships?
The cointegration rank is zero.
What does this imply?
The cointegration rank is one.
What does this imply?
Adjustment coefficients are large in magnitude.
What does this suggest?
Adjustment coefficients are close to zero.
What does this imply?
Error Correction¶
The error correction term is significant in one equation but not the other.
What does this imply?
A variable does not respond to disequilibrium.
What might this suggest?
Economic Interpretation¶
CPI and money supply are cointegrated.
What does this imply about long-run behavior?
You estimate a system with:
CPI
money supply
GDP
You find:
cointegration rank = 1
CPI adjusts strongly
money supply adjusts weakly
What does this suggest about economic dynamics?
Which variable leads the system?
Which variable follows?
Challenge¶
Why is VECM considered a “restricted VAR”?
Numerical Practice¶
Cointegration Logic¶
Suppose:
one cointegrating vector exists
What does this imply?
Rank Interpretation¶
Suppose a system of 3 variables has:
cointegration rank = 2
How many long-run relationships exist?
Adjustment Coefficients¶
Suppose:
Which variable adjusts to equilibrium?
Which does not?
Interpretation¶
Suppose:
What does this represent?
Short vs Long Run¶
Why is it important to include both:
terms
and terms?
Diagnostics¶
Suppose cointegration is ignored and a VAR in differences is estimated.
What information is lost?
Challenge¶
Suppose cointegration rank is incorrectly specified.
What problems might arise?
Johansen Test Interpretation¶
What does the Johansen test estimate?
What is the difference between:
trace test
maximum eigenvalue test
Interpretation¶
Suppose the test suggests rank = 1.
What does this imply?
Suppose test statistics are small.
What does this suggest?
Challenge¶
Why is determining the correct cointegration rank important?
IRF & Forecasting in VECM¶
How do impulse responses differ in VECM vs VAR?
Why do long-run relationships affect IRFs?
Interpretation¶
A shock causes variables to deviate, then gradually return.
What does this reflect?
Why might VECM forecasts outperform differenced VAR forecasts?
Challenge¶
Why is long-run information valuable in forecasting?
Appendix 24A — Relationship Between VAR and VECM¶
A VECM can be derived algebraically from a VAR expressed in levels.
Suppose:
Rewriting the system in differences produces:
short-run difference terms,
and a long-run equilibrium term.
This decomposition leads directly to the VECM representation.
Appendix 24B — Why Cointegration Matters Economically¶
Cointegration matters because many economic variables are tied together by long-run equilibrium forces.
Examples include:
money and prices,
income and consumption,
exchange rates and inflation.
Without equilibrium adjustment:
economic systems could drift apart indefinitely.
Cointegration formalizes the idea that: