Theta Forecast
Install and import
npm install fintech-algorithmsimport { forecastTheta } from "fintech-algorithms/statistical-time-series/forecast-models/theta-forecast";Signature
forecastTheta(values, alpha, 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, 14, 16]0.52Call
forecastTheta(values, alpha, horizon)Returns
object with 3 fields: forecast, fitted, state
{
"forecast": [16.125, 17.125],
"fitted": [null, 10, 11, 12.5],
"state": {
"ses_level": 14.25,
"ols_slope": 2,
"alpha": 0.5,
"finite_sample_correction": 1.875
}
}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
- The theta model: a decomposition approach to forecasting — V. Assimakopoulos and K. Nikolopoulos
- Unmasking the Theta method — Rob J. Hyndman and Md Baki Billah
- The Theta Model — 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