One of the largest challenges in accurately forecasting future marketing data is dealing with seasonal trends. STL, an abbreviation for Seasonal Trend Decomposition using LOESS, is a procedure that breaks time series down into three components:
- Overall Trend
- Irregular remainder
LOESS is simply a method for local non-parametric regression. Essentially what happens here is, the seasonal values are removed from the raw data and the remainder is smoothed via LOESS to determine the overall trend. Here is a graphical example of STL Decomposition:
Source: Inside-R (http://www.inside-r.org)
As you can see, when looking at the raw data by itself, it appears difficult to predict the next points in the time series. However, once the oscillating seasonal component is removed, the overall trend can be more easily identified.
When forecasting the future, the overall trend can be forecasted using methods such as regression or ARIMA (AutoRegressive Integrated Moving Average). Then, the seasonal component can be added back in to create a more reliable seasonal forecast.
Here is an example of the basic usage of the STL function in R:
stl(x, s.window, s.degree = 0, t.window = NULL, t.degree = 1, l.window = nextodd(period), l.degree = t.degree, s.jump = ceiling(s.window/10), t.jump = ceiling(t.window/10), l.jump = ceiling(l.window/10), robust = FALSE, inner = if(robust) 1 else 2, outer = if(robust) 15 else 0, na.action = na.fail)
Additional documentation on performing seasonal trend decomposition using R can be found here.
Subscribe to our blog.
We'll occasionally send you an email when we have featured posts and great stories about analytics and data forecasting.
If you liked this post, you might want to take a look at Levers.
Levers offers forecasting and simulation software for marketing analytics - ecommerce, lead gen, social and more. Learn how to make your future business strategies with Levers.