fintech-algorithms

ARIMA

Install and import

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

Signature

forecastARIMA(values, ar, ma, intercept, differenceOrder, 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
[100, 102, 105, 109, 114, 120]
ar
[0.5]
ma
[]
intercept
1
differenceOrder
1
horizon
2

Call

forecastARIMA(values, ar, ma, intercept, differenceOrder, horizon)

Returns

object with 5 fields: forecast, fitted, residuals, state, differenced_forecast

{
  "forecast": [124, 127],
  "fitted": [null, 2, 2.5, 3, 3.5],
  "residuals": [0, 1, 1.5, 2, 2.5],
  "state": {
    "order": [1, 0],
    "last_values": [6],
    "last_residuals": [2.5],
    "presample_innovations": "zero",
    "future_innovations": "zero conditional mean",
    "difference_order": 1,
    "integration_anchors": [120]
  },
  "differenced_forecast": [4, 3]
}

Diagrams

ARIMA — boundary failure
ARIMA — diagnostic workbench
ARIMA — family handoff
ARIMA — forecast origin
ARIMA — 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