Classical decomposition is a lovely first teacher, but it is rigid: it assumes a fixed seasonal shape, it surrenders the endpoints to its moving averages, and a single wild outlier can smear across the whole trend. Real series misbehave in all three ways — seasonal patterns evolve, the latest data matters most, and outliers happen. STL — Seasonal-Trend decomposition using Loess, introduced by Cleveland and colleagues in 1990 — was built to fix exactly these shortcomings, and it has become the default decomposition in modern forecasting practice.
Like everything in this module, STL splits an additive series into three pieces,
but it estimates them with a smarter, more flexible tool — loess — applied over and over in a loop until the pieces settle.
The whole method rests on one idea, so it is worth building intuition for. Loess (LOcal regrESSion) estimates a smooth curve not by fitting one global line but by fitting a little regression around every point:
The result is a smooth curve that bends freely to follow local structure, unlike the stiff
straight-average of a moving average. The width of the neighbourhood (the span) is loess's
smoothness dial, playing the same bias–variance role the window width
STL is loess applied cleverly and repeatedly. Conceptually there are two nested loops.
Because the seasonal component is re-smoothed each pass from the actual data, it is allowed to change gradually over the years — and the robustness loop is what makes STL shrug off spikes that would wreck a classical decomposition.
STL delivers the same four-panel plot as classical decomposition — observed, trend, seasonal, remainder — but with two visible differences: the trend reaches all the way to both ends (no chopped endpoints), and the seasonal band's shape can drift across the record rather than being a perfect stencil repeated forever.
Look closely at the seasonal panel below: its amplitude grows a little from left to right. A classical decomposition would have forced one fixed shape there; STL lets the season breathe.
The costs are real but modest: STL is additive only (see the warning below), it does not
automatically handle calendar effects like trading days or moving holidays the way
STL only ever fits the additive model
It is a small joke by the statisticians who built it. Loess (and its older sibling lowess, locally weighted scatterplot smoothing) is a deliberate pun on the geological term loess — the fine, wind-blown sediment that settles into smooth, gently-layered deposits. A loess smoother likewise lays a smooth surface over scattered data. William Cleveland, who developed both loess and STL at Bell Labs in the 1980s, was one of the great champions of looking at data; STL is very much a tool built by someone who trusted the eye, giving you honest, robust, visual components you can actually inspect.