SARIMA/SARIMAX
Install and import
npm install fintech-algorithmsimport { forecastSARIMAX } from "fintech-algorithms/statistical-time-series/forecast-models/sarima-sarimax";Signature
forecastSARIMAX(values, exog, futureExog, beta, ar, ma, seasonalAr, seasonalMa, intercept, differenceOrder, seasonalDifferenceOrder, period, 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
[12, 15, 18, 21, 24, 27]Showing 6 of 8 elements.
[
[1],
[2],
[3]
]Showing 3 of 8 elements.
[
[9],
[10]
][2][0.5][][0.25][]01022Call
forecastSARIMAX(values, exog, futureExog, beta, ar, ma, seasonalAr, seasonalMa, intercept, differenceOrder, seasonalDifferenceOrder, period, horizon)Returns
object with 6 fields: forecast, fitted, residuals, state, transformed_forecast, residualized_forecast
{
"forecast": [35.625, 38.0625],
"fitted": [null, null, null, 0.625, 0.625, 0.625],
"residuals": [0, 0, 0, 0.375, 0.375, 0.375],
"state": {
"order": [3, 0],
"last_values": [1, 1, 1],
"last_residuals": [0.375],
"presample_innovations": "zero",
"future_innovations": "zero conditional mean",
"orders": {
"nonseasonal": [1, 1, 0],
"seasonal": [1, 0, 0, 2]
},
"combined_ar": [0.5, 0.25, -0.125],
"combined_ma": [],
"beta": [2]
},
"transformed_forecast": [0.625, 0.4375],
"residualized_forecast": [17.625, 18.0625]
}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.statespace.sarimax.SARIMAX — statsmodels developers
- Forecasting: Principles and Practice — Seasonal ARIMA — 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