About the Sales Forecast Simulator

Written by MySimulator Team · Reviewed by MySimulator Editorial Review

Last updated: 20 July 2026

Real sales data is rarely just noise — it usually has a long-run trend (growing or shrinking demand), a repeating seasonal pattern (holiday spikes, summer lulls, weekday effects), and random variation on top that no model can predict. Classical time series decomposition splits an observed series into exactly these three pieces: y(t) = trend(t) + season(t) + residual(t). Once the trend and seasonal shape are estimated from history, they can be extended forward in time to produce a forecast, while the spread of the residuals tells you how much to trust that forecast.

This simulation generates 104 weeks (two years) of synthetic sales data from an adjustable linear trend, an adjustable seasonal cycle, and Gaussian noise. It then runs a real decomposition pipeline client-side: a centred moving average isolates the trend, phase-averaging isolates the seasonal index, and a linear regression on the deseasonalised data gives the forecast trend line. The residual standard deviation of the in-sample fit drives a ±1.96σ confidence band around the projected forecast. Adjust the sliders to see how trend strength, seasonal amplitude and noise level change the fit quality (MAE, RMSE) and how tightly the forecast tracks a freshly-simulated "true" future.

Frequently Asked Questions

What does the shaded confidence band around the forecast mean?

The band is a ±1.96σ interval around the point forecast, built from the residual standard deviation of the in-sample fit (the gap between the model's fitted values and the actual historical data). Assuming those residuals are roughly normally distributed and the same noise process continues into the future, about 95% of actual outcomes should fall inside the band. It is not a guarantee — it is the model's best estimate of how wrong it typically is, projected forward at a constant width.

Why does the forecast miss badly when noise sigma is high?

Classical decomposition separates a series into trend, seasonality and residual noise, then assumes the noise averages out over time. When σ is large relative to the trend and seasonal signal, individual weeks are dominated by randomness that has no persistent structure — there is nothing in the noise for the model to learn, so the confidence band widens and any single future point is likely to land far from the central forecast line even though the average behaviour over many weeks still tracks the trend plus seasonal pattern.

What is classical time series decomposition?

Decomposition splits an observed series y(t) into components: y(t) = trend(t) + season(t) + residual(t). This simulator estimates the trend with a centred moving average that smooths out the seasonal cycle, subtracts it to isolate seasonal effects, averages the detrended values by phase (e.g. all week-27s together) to get a repeating seasonal index, then re-fits a linear trend on the deseasonalised data. The residual is whatever is left over — ideally close to pure noise with no remaining pattern.

What is the difference between MAE and RMSE?

Mean Absolute Error averages |actual − fitted| across all points, treating every error equally regardless of size. Root Mean Squared Error averages the squared errors before taking a square root, which penalises large errors far more heavily than small ones. When RMSE is noticeably larger than MAE, it signals that a few weeks have unusually large errors (outliers) rather than errors being spread evenly — useful for spotting whether your noise σ or seasonal amplitude setting is producing occasional large spikes the trend+seasonal model cannot capture.

How is the seasonal component estimated?

For each phase of the annual cycle (week 0 through week 51 of the period), the simulator averages the detrended residual across every occurrence of that phase in the two years of history. With 104 weeks of data that is two observations per phase, which is enough to recover a clean seasonal shape when noise is low but produces a noisier seasonal index when σ is high. The 51 phase averages are then centred to sum to zero so the seasonal component does not bias the overall trend level.

Why does the forecast just repeat the same seasonal shape every year?

Classical decomposition assumes the seasonal pattern is stable from one cycle to the next — it has no mechanism for the seasonal shape itself to evolve over time (that would require a more advanced model such as Holt-Winters with a seasonal smoothing parameter, or a state-space / ARIMA model with seasonal differencing). Repeating the fixed seasonal index is a strong but simple assumption: it works well when the underlying business cycle genuinely repeats, and fails if the seasonal pattern is shifting.

Why does the true future line diverge from the forecast even at low noise?

The forecast line extrapolates the fitted trend and seasonal index estimated purely from the 104 weeks of noisy history, while the true future line continues the exact underlying generative process with a fresh draw of random noise. Even at low σ the fitted trend slope and seasonal index are estimates with some sampling error, so a small gap between the two lines is expected. As σ increases that estimation error grows, which is exactly why the confidence band exists.

Why use a moving average to find the trend instead of fitting a line directly?

Fitting a straight line directly to raw data that still contains a strong seasonal cycle can bias the slope, because the seasonal peaks and troughs are not evenly distributed across the sample window. A centred moving average with a window equal to the seasonal period cancels out one full cycle at every point, producing a smooth trend estimate that is not distorted by seasonality. Only after the seasonal component has been isolated and removed does the simulator fit a linear regression, giving a trend estimate that is not confounded with the seasonal signal.