fintech-algorithms

AutoReg

Install and import

bash
npm install fintech-algorithms
ts
import { forecastAutoReg } from "fintech-algorithms/statistical-time-series/forecast-models/autoreg";

Signature

forecastAutoReg(values, ar, intercept, 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

values
[10, 12, 11]
ar
[0.5]
intercept
5
horizon
2

Call

forecastAutoReg(values, ar, intercept, horizon)

Returns

object with 4 fields: forecast, fitted, residuals, state

{
  "forecast": [10.5, 10.25],
  "fitted": [null, 10, 11],
  "residuals": [null, 2, 0],
  "state": {
    "order": 1,
    "last_values": [11]
  }
}

Diagrams

AutoReg — boundary failure
AutoReg — diagnostic workbench
AutoReg — family handoff
AutoReg — forecast origin
AutoReg — recursion anatomy

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