How QuantumLayers Forecasts Time Series: STL, Holt-Winters and SARIMA
Any dataset with a date column and a numeric column is a time series, and most business questions about one come down to two things: is there a pattern, and where is it going? QuantumLayers now answers both as part of the standard insights run. It decomposes every series into trend and seasonal components, picks the columns with real structure, and forecasts them with two independent models. This guide walks through each step, shows what the decomposition and forecasts look like, and gives four habits for reading the results correctly.
What Is New
QuantumLayers has always answered the first question with its temporal analysis pipeline: stationarity, trend, structural breaks and autocorrelation. Three new methods now answer the second.
| Method | What it does | What you see |
|---|---|---|
| STL-style seasonal decomposition | Splits a series into trend, seasonal cycle and residual | Seasonal and trend strength, plus when the cycle peaks and bottoms out |
| Holt-Winters exponential smoothing | Tracks level, trend and season as running estimates | A forecast with its smoothing constants and in-sample RMSE |
| SARIMA | Models the series from its own past values and past errors | An independent second forecast to compare against |
There is nothing to configure. If your dataset has a date column and enough history, the forecasts appear among your insights. The date column can hold full dates, timestamps, months (2024-01), quarters (2024-Q1) or plain years. Plain years are recognised as dates when the column name says so (year, date, period and similar), since on their own they look like any other number.
Step 1: Building a Regular Series
Raw business data is rarely evenly spaced. Orders arrive at random times; some days have hundreds of rows and some have none. Forecasting models need one value per period, at a regular interval.
QuantumLayers first picks an aggregation interval: hour, day, week, month or year. It chooses the interval so that each bucket holds a few observations on average, with at least five buckets overall, and never finer than the data itself: a column of years is grouped by year and a column of months by month, however many rows share each period. It then averages each numeric column within each bucket and fills short gaps. The interval also sets the seasonal cycle to look for, and through it the forecast horizon.
| Interval | Seasonal cycle checked | Periods per cycle | Forecast horizon |
|---|---|---|---|
| Hourly | Daily | 24 | 12 periods (capped) |
| Daily | Weekly | 7 | 7 days |
| Weekly | Yearly | 52 | 12 weeks (capped) |
| Monthly | Yearly | 12 | 12 months |
| Yearly | None | n/a | About 20% of the length, 3 to 6 periods |
Step 2: The Temporal Tests
Before any forecasting, each column goes through the existing temporal tests. Their results decide which columns are worth forecasting, and one of them sets how SARIMA is differenced.
| Test | Question it answers | Used later for |
|---|---|---|
| Stationarity (ADF) | Does the series wander without a stable mean? | Differencing first, so a random walk is not mistaken for a trend; SARIMA’s d |
| Structural breaks (CUSUM) | Did the mean shift at some point and stay shifted? | Ranking bonus |
| Average level | Is the mean significantly different from zero? | Ranking bonus |
| Autocorrelation | How much does each period resemble the one before? | Ranking score |
| Trend | Is there a linear trend, and how well does it fit? | Ranking score (R²) |
Step 3: Seasonal Decomposition
Every column with at least 12 aggregated periods, and enough history for about two full seasonal cycles, gets a seasonal decomposition. The method follows the classical STL approach:
- Estimate a rough trend with a centered moving average over one full cycle.
- Subtract it and average what remains at each position in the cycle (every Monday, every January) to get the seasonal pattern.
- Remove that pattern, re-estimate the trend on the deseasonalized series, and extract the seasonal pattern again against the refined trend.
- Whatever is left is the residual.
From these components, QuantumLayers computes two measures defined by Hyndman and Athanasopoulos in Forecasting: Principles and Practice. Seasonal strength, from 0 to 1, is how much of the non-trend variation the seasonal cycle explains. Trend strength, from 0 to 1, is how much of the non-seasonal variation the trend explains. In the example, the residual panel is small next to the other two, so both strengths are close to 1.
When seasonal strength is above 0.3, the insight reports it along with where the cycle peaks and bottoms out, in calendar terms. For example: “peaking around Friday and lowest around Monday”, or “peaking around the week of Jun 7 and lowest around the week of Dec 20”.
Step 4: Choosing Which Columns to Forecast
Fitting forecasting models is more expensive than running the other tests, and a forecast of a flat, structureless column tells you nothing. So QuantumLayers ranks the columns and forecasts only the top five. Each column’s score adds up the evidence of real temporal structure.
| Score component | Rewards |
|---|---|
| Trend fit (R²) | A clear linear direction |
| Autocorrelation strength | Memory from one period to the next |
| Seasonal strength | A repeating cycle |
| Structural break bonus | A detected shift in the mean |
| Significant level bonus | A mean clearly different from zero |
A column does not have to pass any single test to be forecast. The score only decides the order. In a dataset with ten numeric columns, the five with the most going on get forecasts, and the rest do not.
Step 5: The Forecasting Models
Forecasts look one seasonal cycle ahead, capped at 12 periods, as in the table in Step 1. Short horizons are deliberate: forecast error grows quickly with distance.
Holt-Winters
Holt-Winters exponential smoothing keeps three running estimates: the current level, the current trend, and the seasonal effect at each position in the cycle. At every step, each estimate is updated as a weighted blend of the new observation and the previous estimate. Three smoothing constants control the weights: alpha for the level, beta for the trend and gamma for the season.
QuantumLayers searches a grid of values (0.1, 0.3, 0.5, 0.7, 0.9) for each constant and keeps the combination with the lowest in-sample squared error. Low values mean the model trusts long history; high values mean it reacts quickly to recent data. If there are at least two full seasonal cycles of history, the model runs with all three components (triple exponential smoothing). Otherwise it drops the seasonal part and runs Holt’s linear method (double exponential smoothing).
SARIMA
SARIMA models a series as a combination of its own recent values (autoregressive terms), recent forecast errors (moving-average terms), and the same at seasonal lags, after differencing to remove trend and seasonality. The order is written as (p,d,q)(P,D,Q)[s]. QuantumLayers uses a fixed structure rather than an automatic order search: d is set by the ADF test (1 if the series is non-stationary, 0 otherwise), D is 1 when there is enough history to spare a full season, p = 2, q = 1, and P = Q = 1 when seasonal.
The model is estimated with the Hannan-Rissanen method. First, a long autoregression is fitted to estimate the past forecast errors. Then the series is regressed on its own lags and on those estimated errors with ordinary least squares. This avoids the numerical instability of full maximum-likelihood fitting while producing forecasts close to the textbook version. The forecasts are then integrated back to the original scale.
| Holt-Winters | SARIMA | |
|---|---|---|
| Minimum history | Seasonal version needs two full cycles; otherwise Holt’s linear method | At least 20 periods, or three full cycles when seasonal |
| Parameters | alpha, beta, gamma from a grid search | Fixed (2,d,1)(1,D,1)[s] |
| Fitting | Lowest in-sample squared error | Hannan-Rissanen, two-stage least squares |
| Shown when | RMSE below the series’ standard deviation and projected change above 5% | Projected change above 5% |
Why Two Models
Holt-Winters and SARIMA come from different modelling traditions. Holt-Winters assumes the series is a smooth level with a trend and a repeating season. SARIMA assumes it is driven by the correlation structure of its own past. When both point the same way by similar amounts, you can have more confidence in the direction. When they disagree, that disagreement is itself information: the future is less predictable than either number suggests.
On the simulated series above, a clean trend with a regular cycle, the two models end within a few units of each other, and the Holt-Winters in-sample RMSE of 3.0 is a small fraction of the series’ standard deviation of 23. Real data is rarely this tidy. On ten years of NASA POWER clear-sky solar irradiance, the two models’ 12-week forecasts ended within 1% of each other. On ten years of Berlin weather, they agreed on the direction of the spring warm-up but differed by almost 6°C on how fast it would arrive.
Reading the Output
| Field | Example |
|---|---|
| Model and parameters | “triple exponential smoothing”, “SARIMA(2,0,1)(1,1,1)[52]” |
| Projected change | Percentage from the last observed value to the last forecast value |
| Forecast values | Every period in the horizon, in the insight metadata |
| Holt-Winters fit | Chosen smoothing constants and in-sample RMSE |
| Suggested chart | A time series chart aggregated at the same interval |
Four habits will help you read them well.
Read levels when values are near zero
The headline percentage compares the last value with the final forecast value. When the last value is close to zero, the percentage becomes enormous and can be misleading. For anything that can approach or cross zero, such as temperature, profit, net flows or growth rates, look at the forecast levels instead.
Use the RMSE as your error bar
The Holt-Winters RMSE is the typical size of the model’s error on the history it was fitted to. Out-of-sample error is usually larger. If the RMSE is 3 units, do not plan around a forecast as if it were accurate to 0.1.
Check the history length
With less than two full cycles of history, Holt-Winters cannot model seasonality and will extend the recent trend instead. If that recent trend is a seasonal decline, it will forecast the decline continuing, sometimes past physically possible values. When a forecast looks wrong, the first thing to check is whether the dataset covers enough cycles. Pulling more history usually fixes it.
Look at breaks and seasonality together
If a structural break was found, the forecast is fitted on data that includes both regimes. If you know the break reflects a permanent change, such as a price change, a new market or a new measurement method, filter the data to the period after it and run insights again.
Related: Leading Indicators
The same insights run also includes a cross-correlation test between pairs of time series. It looks for one series that moves before another, at lags of one period or more, and reports the lag: for example, “marketing spend leads signups by 2 weeks”. A leading indicator is often more useful than a statistical forecast, because it tells you what will happen based on something you can already observe. Keep in mind that two series following the same seasonal cycle will often show a one-period lead simply because each period resembles the next.
Where to Find It
Forecasts, seasonal patterns and leading indicators appear in the Insights panel of any dataset with a date column. They are also available to the QL agent, and through the generate_insights tool on the QuantumLayers MCP server, which returns forecasts as insights of type forecast. You can include them in scheduled reports, and monitors will notify you when a forecast or seasonal pattern appears or disappears between runs.
To try it without your own data, connect one of the built-in public API templates with a long history, such as Open-Meteo historical weather, NASA POWER, or FRED, and run insights.
| Before trusting a forecast | Check |
|---|---|
| History | At least two full seasonal cycles, three for seasonal SARIMA |
| Fit | Holt-Winters RMSE well below the series’ standard deviation |
| Agreement | Holt-Winters and SARIMA point the same way by similar amounts |
| Breaks | No structural break mixing two regimes, or data filtered to after it |
| Scale | Levels read directly when values are near zero |
For every other test in the insights run, see Inside the QuantumLayers Statistical Pipeline. For a broader introduction to forecasting with business data, see Predictive Analytics for Non-Data-Scientists. The seasonal and trend strength measures follow Hyndman, R.J. and Athanasopoulos, G., Forecasting: Principles and Practice.
