fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Multivariate Systems

5 algorithms in Statistical Time Series.

In this family#

  1. VAR contract

    Vector autoregression: every series regressed on lags of all of them. The natural model when variables move together, and the base every impulse-response and variance-decomposition result is computed from.

    fitVAR(values, lags, includeIntercept)
  2. Structural VAR contract

    Identifies structural shocks by Cholesky decomposition of the residual covariance. The identification is recursive, which means **variable ordering is an economic assumption**: the first variable is assumed unaffected contemporaneously by the others, and reordering changes the results.

    fitRecursiveSVAR(values, lags)
  3. VECM contract

    Vector error correction with a fixed cointegrating vector. For series that wander individually but not apart: differencing them separately would throw away the long-run relationship, which is usually the thing of interest.

    fitVECMFixedBeta(values, beta, differenceLags, includeIntercept)
  4. Impulse-Response Analysis contract

    Traces how a one-off shock to one variable propagates through the system over time. The headline output of any VAR — and only interpretable given the identifying assumption that produced the impact matrix.

    impulseResponses(coefficients, horizon)
  5. Forecast-Error Variance Decomposition contract

    Attributes each variable's forecast error variance to the structural shocks, by horizon. Answers 'how much of the movement in this variable is explained by that one' — subject, again, to the identification.

    forecastErrorVarianceDecomposition(coefficients, sigmaU, horizon)

What they share#

Every topic here is a record-transform, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { fitVAR } from "fintech-algorithms/statistical-time-series/multivariate-systems/var";
import { fitRecursiveSVAR } from "fintech-algorithms/statistical-time-series/multivariate-systems/structural-var";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Statistical Time Series collects 29 algorithms across 5 families. For the concept behind this family rather than the call signatures, see the concept guides.