fintech-algorithms

VECM

Install and import

bash
npm install fintech-algorithms
ts
import { fitVECMFixedBeta } from "fintech-algorithms/statistical-time-series/multivariate-systems/vecm";

Signature

fitVECMFixedBeta(values, beta, differenceLags, includeIntercept)

Worked example

executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

Input

values
[
  [57.3488705363, 57.391383279],
  [57.9060942406, 57.7180113466],
  [57.8301951168, 57.7940655992]
]

Showing 3 of 120 elements.

beta
[1, -1]
differenceLags
1

Call

fitVECMFixedBeta(values, beta, differenceLags, includeIntercept)

Returns

object with 17 fields: beta, alpha, gamma, intercept, sigma_u_mle, error_correction, pi, adjustment_root, …

{
  "beta": [1, -1],
  "alpha": [-0.03243684502, 0.406805203364],
  "gamma": [
    [
      [0.041044635794, -0.023887057656],
      [-0.069691641426, 0.155827060535]
    ]
  ],
  "intercept": [0.004904479316, 0.007790140091],
  "sigma_u_mle": [
    [0.115776128937, 0.119483748379],
    [0.119483748379, 0.19954598501]
  ],
  "error_correction": [
    0.188082894,
    0.0361295176,
    -0.620844851,
    -0.6261144079,
    -0.5222041208,
    -0.7533463451
  ],
  "pi": [
    [-0.03243684502, 0.03243684502],
    [0.406805203364, -0.406805203364]
  ],
  "adjustment_root": 0.560757951616,
  "error_correction_loading_root": 0.560757951616,
  "half_life": null,
  "exact_half_life": null,
  "half_life_scope": "not-reported-short-run-gamma-present",
  "effective_observations": 118,
  "rank": 1
}

Showing 14 of 17 fields.

Other exports

This module also exports companionMatrix, companionSpectralRadius, fitVAR, choleskyLower, fitRecursiveSVAR, movingAverageMatrices, impulseResponses, forecastErrorVarianceDecomposition. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams

VECM — system map

How it works

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References