ARMA
Install and import
npm install fintech-algorithmsimport { forecastARMA } from "fintech-algorithms/statistical-time-series/forecast-models/arma";Signature
forecastARMA(values, ar, ma, 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
[10, 12, 11][0.5][0.25]52Call
forecastARMA(values, ar, ma, intercept, horizon)Returns
object with 4 fields: forecast, fitted, residuals, state
{
"forecast": [10.375, 10.1875],
"fitted": [null, 10, 11.5],
"residuals": [0, 2, -0.5],
"state": {
"order": [1, 1],
"last_values": [11],
"last_residuals": [-0.5],
"presample_innovations": "zero",
"future_innovations": "zero conditional mean"
}
}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
- statsmodels.tsa.arima.model.ARIMA — statsmodels developers
- Forecasting: Principles and Practice — ARIMA models — Rob J. Hyndman and George Athanasopoulos
- 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