fintech-algorithms

Forecast-Error Variance Decomposition

Install and import

bash
npm install fintech-algorithms
ts
import { forecastErrorVarianceDecomposition } from "fintech-algorithms/statistical-time-series/multivariate-systems/forecast-error-variance-decomposition";

Signature

forecastErrorVarianceDecomposition(coefficients, sigmaU, 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]
  ]
]
sigmaU
[
  [0.64, 0.28],
  [0.28, 0.425]
]
horizon
8
argument 4
[
  [0.8, 0],
  [0.35, 0.55]
]

Call

forecastErrorVarianceDecomposition(coefficients, sigmaU, horizon)

Returns

object with 10 fields: shares, impact_matrix, horizon, row_sums, companion_spectral_radius, stability_state, stability_boundary, near_boundary_threshold, …

{
  "shares": [
    [
      [1, 0],
      [0.288235294118, 0.711764705882]
    ],
    [
      [0.989143895172, 0.010856104828],
      [0.260105787983, 0.739894212017]
    ],
    [
      [0.980857224422, 0.019142775578],
      [0.258546673098, 0.741453326902]
    ]
  ],
  "impact_matrix": [
    [0.8, 0],
    [0.35, 0.55]
  ],
  "horizon": 8,
  "row_sums": [
    [1, 1],
    [1, 1],
    [1, 1]
  ],
  "companion_spectral_radius": 0.502593274925,
  "stability_state": "stable",
  "stability_boundary": 1,
  "near_boundary_threshold": 0.9,
  "state": "computed",
  "reason": "orthogonalized-squared-response-share"
}

Other exports

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

Forecast-Error Variance Decomposition — 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