AutoReg
Install and import
npm install fintech-algorithmsimport { 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
[10, 12, 11][0.5]52Call
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
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.ar_model.AutoReg — 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