Course contentsShow
← Data Science
Lesson 745 of 2,14519. Time Series FoundationsFree lesson

STL Decomposition (Seasonal-Trend Loess)

Using robust loess smoothing for flexible seasonal decomposition that handles complex patterns.

STL Decomposition (Seasonal-Trend Loess)

What You'll Learn

You'll discover how STL decomposition uses flexible smoothing to separate time series components even when patterns are complex or changing.

The Core Idea

STL stands for Seasonal-Trend decomposition using Loess. Unlike classical decomposition methods that assume fixed, unchanging seasonal patterns, STL uses a technique called loess (locally estimated scatterplot smoothing) to flexibly fit curves to your data.

Think of loess like drawing a smooth line through points using only nearby neighbors—instead of forcing one rigid pattern across all time, it adapts locally. This makes STL incredibly powerful for real-world data where seasonality might shift over time or where trends aren't perfectly linear.

How STL Works Differently

Classical decomposition calculates a single seasonal pattern and repeats it identically throughout your series. STL, however, allows the seasonal pattern to evolve gradually. It uses weighted local regressions that focus on nearby observations, making it robust to outliers and capable of handling irregular patterns.

The "robust" version of STL goes further by down-weighting extreme values, so a few unusual observations won't distort your entire decomposition.

Why This Matters

STL handles:

  • Changing seasonality (e.g., holiday shopping patterns that shift year-to-year)
  • Complex trends that aren't straight lines
  • Outliers without breaking down
  • Missing values more gracefully than classical methods

It decomposes your series into trend, seasonal, and remainder components—just like classical methods—but with far more flexibility and reliability.

Key Takeaway: STL decomposition uses flexible loess smoothing to extract trend and seasonal components that can adapt and change over time, making it more robust and realistic for complex real-world time series data.