Skip to main content

Multivariate Forecasting (VAR / VECM)

Vector autoregression & error correction — native lead-lag and cointegration modeling


Overview

  • Model ID: multivariate-forecasting
  • Framework: statsmodels
  • Best for: Jointly forecasting multiple related series; pairs / cointegration research
  • GPU required: No (CPU-only)
  • Specialist: forecasting

One parameterized model for VAR (Vector AutoRegression) and VECM (Vector Error Correction). With model="auto" it runs the Johansen cointegration test and selects VECM when the series are cointegrated (rank ≥ 1), otherwise VAR. This models lead-lag dynamics and long-run equilibria natively — ideal for pairs (e.g. BTC↔ETH, venue-vs-venue basis).


When to Use

Perfect for:

  • Two or more interdependent series forecast jointly
  • Cointegration / pairs trading research (mean-reversion to an equilibrium)
  • Lead-lag relationships between assets/venues

Not ideal for:

  • A single univariate series (use ARIMA / Prophet)
  • Highly non-linear dynamics

Quick Start

job = client.training.create(
model="multivariate-forecasting",
dataset_id=dataset.id,
hyperparameters={"model": "auto", "columns": ["btc", "eth"], "horizon": 10},
)
job.wait()

Dataset Format

Two or more numeric columns (the endogenous series), aligned by row, plus an optional date column:

ds,btc,eth
2022-01-01,46200.0,3760.0
2022-01-02,47100.0,3820.0
...

Leave columns empty to use all numeric columns as endogenous series. Requirements: ≥ 2 series and ≥ maxlags + 20 aligned observations.


Hyperparameters

ParameterDefaultDescription
model"auto"auto (Johansen-driven) / var / vecm
maxlags10Max VAR lags (AIC-selected)
k_ar_diff1VECM differenced lag order
deterministic"ci"VECM deterministic terms (n,co,ci,lo,li)
horizon10Forecast horizon (steps)
columns[]Endogenous series (empty = all numeric columns)
date_column""Timestamp column (empty = auto-detect)

Inference

result = client.endpoints.infer(endpoint_id=ep, input_data={"horizon": 4})

Returns one forecast vector per series; model_type reflects the selected kind:

{
"model_type": "vecm",
"horizon": 4,
"forecasts": {"btc": [47200, 47350, ...], "eth": [3840, 3855, ...]}
}

Pass recent values per series in series to forecast from your own history, or omit to use the trained model's data.