VAR vs VARMA vs VARMAX
Understanding Multivariate Time-Series Forecasting Models
Introduction
When predicting future values of complex systems like economic indicators, stock prices, or weather patterns, multiple variables often influence each other.
For example, unemployment, inflation, and interest rates interact continuously.
To analyze such systems, statisticians use multivariate time-series models such as:
- Vector Autoregression (VAR)
- Vector Autoregressive Moving-Average (VARMA)
- VARMAX
What is Vector Autoregression (VAR)?
Imagine tracking two weekly variables:
- Food spending
- Weekly savings
Your spending today might depend on what you spent last week and what you saved last week.
VAR predicts each variable using both its past values and the past values of other variables.
x_t = a11 * x_(t-1) + a12 * y_(t-1) + e1_t y_t = a21 * x_(t-1) + a22 * y_(t-1) + e2_t
- x_t – value of variable X at time t
- y_t – value of variable Y at time t
- a coefficients – show how variables influence each other
- e_t – random error
Vector Autoregressive Moving-Average (VARMA)
VARMA extends VAR by including moving averages.
Moving averages account for the effects of unexpected shocks.
Example: an unexpected car repair may reduce next week’s savings.
x_t = a11*x_(t-1) + a12*y_(t-1) + b11*e1_(t-1) + b12*e2_(t-1) + e1_t y_t = a21*x_(t-1) + a22*y_(t-1) + b21*e1_(t-1) + b22*e2_(t-1) + e2_t
The b coefficients capture how previous shocks influence the system.
What is VARMAX?
VARMAX expands VARMA by introducing exogenous variables.
These are outside variables that influence the system but are not affected by it.
Example: salary may influence spending and saving but is determined externally.
x_t = a11*x_(t-1) + a12*y_(t-1) + b11*e1_(t-1) + c1*z_t + e1_t y_t = a21*x_(t-1) + a22*y_(t-1) + b21*e1_(t-1) + c2*z_t + e2_t
- z_t – exogenous variable
- c coefficients – effect of the external variable
Interactive Lag Simulator
CLI Example – Forecasting Model
$ python forecast.py Loading dataset... Variables detected: GDP Inflation Interest Rate Training VAR Model... Lag Order: 2 AIC: 1311.8 BIC: 1344.2 Forecasting next 6 months... Forecast generated successfully.
Python Implementation
VAR Model
from statsmodels.tsa.api import VAR model = VAR(data) results = model.fit(lags=2) forecast = results.forecast(data.values[-2:], steps=5)
VARMAX Model
from statsmodels.tsa.statespace.varmax import VARMAX model = VARMAX(data, exog=external_variable, order=(1,1)) results = model.fit() forecast = results.forecast(steps=5)
Model Comparison
| Model | Main Concept | Use Case |
|---|---|---|
| VAR | Uses past values of variables | Basic multivariate forecasting |
| VARMA | Uses past values and shocks | Capturing unexpected events |
| VARMAX | Adds external variables | Forecasting with outside influences |
Key Takeaways
- VAR predicts variables using past relationships.
- VARMA includes the effects of unexpected shocks.
- VARMAX introduces external influencing variables.
- These models are essential for forecasting interconnected systems.
- Widely used in economics, finance, and climate modeling.