ARIMA
Install and import
npm install fintech-algorithmsimport { 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
[100, 102, 105, 109, 114, 120][0.5][]112Call
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
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.
References
- Forecasting: Principles and Practice — ARIMA models — Rob J. Hyndman and George Athanasopoulos
- statsmodels.tsa.arima.model.ARIMA — statsmodels developers
- Forecasting: Principles and Practice — Evaluating point forecast accuracy — Rob J. Hyndman and George Athanasopoulos
- Forecasting: Principles and Practice — Time series cross-validation — Rob J. Hyndman and George Athanasopoulos
- Forecasting: Principles and Practice — Evaluating regression and residual behavior — Rob J. Hyndman and George Athanasopoulos