The STL decomposition method was proposed by Cleveland et al. in STL decomposition
1990 as an alternative to Census II. The name “STL” is an acronym for “A Seasonal-Trend decomposition procedure based on Loess.”
STL consists of a sequence of applications of the Loess smoother (Section 3/3/1) to give a decomposition that is highly resistant to extreme observations. One advantage of STL over other seasonal decomposition methods is that it is capable of handling seasonal time series where the length of seasonality is other than quarterly or monthly. In fact, any seasonal period greater than one is allowable.
3/6 STL decomposition 123
Also, STL can be applied when the time series contains missing values, something other decomposition methods cannot handle easily.
Currently, only an additive version of the STL procedure is avail-able. Multiplicative decomposition can be carried out by first trans-forming the data using logarithms.
Like Census II, STL is an iterative algorithm in which the estimates of the trend-cycle and seasonal components are progressively refined and improved. STL consists of two recursive procedures, one nested within the other. In each iteration of the inner loop, the seasonal and trend-cycle components are updated once. An iteration of the outer loop consists of one or two iterations of the inner loop followed by an identification of extreme values. Future iterations of the inner loop downweight the extreme values that were identified in the previous iteration of the outer loop. About 10 or 20 iterations of the outer loop are carried out in total.
3/6/1 Inner loop
We now describe the steps involved in a single iteration of the inner loop. Each iteration consists of a seasonal smoothing that updates the seasonal component followed by a trend-cycle smoothing which updates the trend-cycle component. The whole procedure must start with some initial estimate of the trend-cycle. This is set to be zero.
That is, the procedure begins by assuming no trend at all. This poor estimate is quickly updated to something more reasonable after one iteration. As with the other decomposition methods, we will describe the procedure assuming we have monthly data.
Step 1 A de-trended series is computed by subtracting the trend estimate from the original data. That is,
Yt− Tt= St+ Et.
Step 2 The de-trended values for each month are collected to form monthly sub-series. These twelve separate sub-series are each smoothed by a Loess smoother. The smoothed sub-series are glued back together to form a preliminary seasonal component.
The Loess smoothers are extrapolated to estimate the seasonal component for a few months before and after the observed data.
Step 3 A 3 × 12 × 12 moving average is applied to the preliminary seasonal component estimated in Step 2. The result is in turn smoothed by a Loess smoother of length 13 (one more than the seasonal period). The loss of values at the beginning and end of the series due to the weighted moving average was anticipated and overcome by the extrapolation of the seasonal component in Step 2. The purpose of this step is to identify any trend-cycle that may have contaminated the preliminary seasonal component in Step 2. If there is little trend-cycle in the preliminary seasonal component, the result of this smoothing will be a series with all values close to zero.
Step 4 The seasonal component is estimated as the difference be-tween the preliminary seasonal component of Step 2 and the smoothed seasonal component of Step 3.
Step 5 A seasonally adjusted series is computed by subtracting the result of Step 4 from the original data. That is, Yt−St= Tt+Et. Step 6 The seasonally adjusted series is smoothed by Loess to give
the trend component, Tt.
3/6/2 Outer loop
The outer loop begins with one or two iterations of the inner loop.
The resulting estimates of trend-cycle and seasonal components are then used to calculate the irregular component:
Et= Yt− Tt− St.
Large values of Et indicate an extreme observation. These are identified and a weight calculated. That concludes the outer loop.
Future iterations of the inner loop use the weights in Steps 2 and 6 to downweight the effect of extreme values. Also, future iterations of the inner loop begin with the trend component from the previous iteration rather than starting with zero as in the very first iteration of the inner loop.
3/6 STL decomposition 125 3/6/3 Choosing the STL parameters
Figure 3-1 shows the results of an STL decomposition applied to the housing data.
There are two smoothing parameters to select when using STL: the parameters for the Loess smoothers in Steps 2 and 6. The first is the seasonal smoothing parameter which determines how much change there will be in the seasonal indices from year to year. A small seasonal smoothing parameter will allow the seasonal component to change substantially from year to year, while a large seasonal smoothing parameter forces the seasonal component to change slowly from year to year. It is also possible to force the seasonal component to be identical across years.
The second smoothing parameter affects the smoothness of the trend calculated in Step 6. Again, a small parameter allows the trend to react to the variation in the data more than a large parameter will.
It is important not to make the trend smoothing parameter too small or the seasonal variation might contaminate the trend component.
It is possible to have two or more trend-cycle components in an STL decomposition. This is useful when the user wishes to separate the trend-cycle into the long-term trend and a shorter-term cyclical component. There are also various other refinements in the compu-tation of an STL decomposition which are discussed in Cleveland et al. (1990).
3/6/4 Comparing STL with X-12-ARIMA
X-12-ARIMA and STL are the two most sophisticated decomposition methods currently available. Their strengths and weaknesses and listed below.
• STL is less developed than X-12-ARIMA. For example, there are no publicly available versions of STL which handle trading day variation or calendar variation and there is no multiplicative option for STL.
• There are no seasonal adjustment diagnostics available with STL whereas there is a very large suite of well-developed diag-nostics with X-12-ARIMA.
• STL is much more flexible than X-12-ARIMA in being able to handle trends of varying smoothness, missing values, and seasonality of period other than 4 or 12. But this flexibility also means the user has more decisions to make in specifying the two smoothing parameters.
• The calculations involved in STL are simpler than those for X-12-ARIMA, making it easier to extend the method to new situations.
• The estimate of trend for STL is unstable near the ends of the series (see the comments by Gray and Thomson in the discussion of Cleveland et al., 1990).
The computer source code for both X-12-ARIMA and STL is publicly available for other researchers to use and adapt.1 Executable versions of X-12-ARIMA are available from the same Internet site.
STL is also available as an option in the package S-plus.