Edd's Knowledge Base

A VAR (vector autoregression) is the multivariate version of AR: several series are modeled jointly, and each depends on the past of all of them, not only its own. It builds on Autoregressive Models and needs the stationarity checks from Stationarity and Unit Roots.

The Model

For series :

Each is a matrix. For temperature and power with :

The off-diagonal coefficients capture how one series feeds into the other.

AR / ARIMAVAR
SeriesOneSeveral, modeled jointly
PredictorsOwn pastOwn past and the other series’ past
OutputOne forecastA forecast for every series
InputsChosen by you (ARIMAX adds given exogenous inputs)Every variable is endogenous

Workflow

  1. Stationarity: make each series stationary (ADF/KPSS per series, difference as needed).
  2. Lag order : compare VAR() by AIC, BIC, or HQC; one applies to all equations.
  3. Estimate: OLS equation by equation (efficient, since every equation has the same regressors).
  4. Check: residuals free of autocorrelation, and a stable system (companion-matrix roots inside the unit circle).
  5. Use: forecast, plus the tools below.
ToolQuestion it answers
Granger causality testDo past values of help predict beyond ‘s own past? (Predictive, not true causation)
Impulse response functionHow do all series respond over time to a one-time shock in one series?
Forecast error variance decompositionWhat share of each series’ forecast uncertainty comes from shocks to each series?

Limits and Extensions

  • Parameter explosion: coefficients grow as (5 series and 4 lags gives 100 plus constants). It needs plenty of data, or regularization (Bayesian VAR, LASSO-VAR) or dimension reduction.
  • Cointegration: non-stationary series with a stable long-run relationship should not simply be differenced; use a VECM (vector error-correction model), which models short-run dynamics and the pull back toward equilibrium.
  • Linearity: like AR, linear; nonlinear and neural multivariate models relax this.
  • Identification: impulse responses depend on assumptions about how shocks relate.
ExtensionAdds
VARMAMA terms (rare, hard to estimate)
VARXExogenous inputs
VECMCointegration
Bayesian VARShrinkage priors, helpful with large
Structural VARExplicit assumptions to interpret shocks
from statsmodels.tsa.api import VAR
 
model = VAR(df_stationary)                 # one column per series
order = model.select_order(maxlags=8)      # AIC, BIC, HQIC, FPE
res = model.fit(order.aic)
res.forecast(df_stationary.values[-res.k_ar:], steps=10)
res.test_causality("power", ["temp"], kind="f")   # Granger test
res.irf(10).plot()                                # impulse responses

Not executed.

When to use: several series influence each other and you want joint forecasts or to study how shocks propagate (temperature and power in a machine, interest rates and inflation). Use plain AR/ARIMA when one series suffices, and ARIMAX when external drivers need no forecasting.