fintech-algorithms

Impulse-Response Analysis

Install and import

bash
npm install fintech-algorithms
ts
import { impulseResponses } from "fintech-algorithms/statistical-time-series/multivariate-systems/impulse-response-analysis";

Signature

impulseResponses(coefficients, horizon)

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

coefficients
[
  [
    [0.55, 0.18],
    [-0.12, 0.42]
  ]
]
horizon
8
argument 3
[
  [0.8, 0],
  [0.35, 0.55]
]

Call

impulseResponses(coefficients, horizon)

Returns

object with 10 fields: responses, cumulative_responses, horizon, impact_matrix, companion_spectral_radius, stability_state, stability_boundary, near_boundary_threshold, …

{
  "responses": [
    [
      [0.8, 0],
      [0.35, 0.55]
    ],
    [
      [0.503, 0.099],
      [0.051, 0.231]
    ],
    [
      [0.28583, 0.09603],
      [-0.03894, 0.08514]
    ]
  ],
  "cumulative_responses": [
    [
      [0.8, 0],
      [0.35, 0.55]
    ],
    [
      [1.303, 0.099],
      [0.401, 0.781]
    ],
    [
      [1.58883, 0.19503],
      [0.36206, 0.86614]
    ]
  ],
  "horizon": 8,
  "impact_matrix": [
    [0.8, 0],
    [0.35, 0.55]
  ],
  "companion_spectral_radius": 0.502593274925,
  "stability_state": "stable",
  "stability_boundary": 1,
  "near_boundary_threshold": 0.9,
  "state": "computed",
  "reason": "ma-recursion-times-declared-impact"
}

Other exports

This module also exports companionMatrix, companionSpectralRadius, fitVAR, choleskyLower, fitRecursiveSVAR, fitVECMFixedBeta, movingAverageMatrices, 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

Impulse-Response Analysis — 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