STL Decomposition (Seasonal-Trend decomposition using LOESS) is a versatile and robust filtering algorithm that decomposes a time series signal into three additive components: a low-frequency trend, a repeating seasonal pattern, and a high-frequency residual (remainder) capturing noise and anomalies. Unlike classical decomposition methods, STL handles any type of seasonality, not just monthly or quarterly, and is highly resistant to the distorting effects of transient outliers in the data.
Glossary
STL Decomposition

What is STL Decomposition?
A robust, iterative filtering procedure for decomposing a time series into trend, seasonal, and residual components using locally weighted regression (LOESS).
The procedure operates iteratively through an inner loop of LOESS smoothing against cyclic sub-series and an outer loop that computes robustness weights to down-weight extreme residuals. In renewable forecasting, STL is commonly applied to isolate the stable diurnal solar generation pattern from volatile weather-driven noise, allowing grid operators to model the predictable baseline separately from the stochastic cloud-driven irradiance ramp rate.
Key Features of STL Decomposition
STL (Seasonal-Trend decomposition using LOESS) is a versatile and robust filtering procedure for decomposing a time series. It isolates the systematic components of a signal, making it indispensable for understanding the underlying drivers of variable renewable generation data.
LOESS-Based Robustness
Unlike classical decomposition methods that rely on simple moving averages, STL uses Locally Estimated Scatterplot Smoothing (LOESS). This non-parametric method fits low-degree polynomials to localized subsets of the data. This provides superior handling of non-linear trends and irregular seasonal patterns common in solar irradiance data, and is inherently robust to outliers that would otherwise distort the decomposition.
Component Isolation
STL decomposes a time series into three additive components:
- Trend (T_t): The long-term, low-frequency variation, such as gradual panel degradation.
- Seasonal (S_t): The repeating, high-frequency pattern, like the diurnal solar cycle.
- Remainder (R_t): The stochastic, high-frequency noise left after extracting trend and seasonality, representing weather-driven volatility. This clean separation allows forecasters to model each component independently.
Handling Complex Seasonality
A defining strength of STL is its ability to handle seasonal components that evolve over time. The seasonal pattern is not assumed to be constant; it can slowly change in amplitude and shape. This is critical for capturing the shifting shape of the daily solar curve across different months or the gradual change in diurnal wind patterns, providing a more accurate baseline than fixed seasonal dummies.
Iterative Inner-Outer Loop Design
The algorithm operates through two nested iterative loops:
- Inner Loop: Alternates between updating the seasonal and trend components using LOESS smoothing and moving averages to converge on a stable decomposition.
- Outer Loop: Calculates robustness weights based on the magnitude of the remainder component. Data points with large remainders (anomalies) are down-weighted in subsequent inner loop iterations, making the decomposition resilient to cloud-induced irradiance spikes or sensor errors.
Configurable Smoothing Parameters
The user controls the decomposition's granularity through key parameters:
- n_p: The number of observations per seasonal cycle (e.g., 24 for hourly diurnal data).
- s_window: The span of the LOESS window for seasonal extraction, controlling how rapidly the seasonal pattern can evolve.
- t_window: The span for trend extraction, defining the smoothness of the long-term component. This configurability allows precise tuning for intraday forecasting versus day-ahead trend analysis.
Preprocessing for Forecasting Pipelines
In renewable generation forecasting, STL is rarely the final model but a critical preprocessing step. By removing the deterministic diurnal cycle (seasonal component), the resulting stationary remainder can be fed into machine learning models like Long Short-Term Memory (LSTM) networks or Gradient Boosting Machines. These models then focus solely on learning the complex, weather-driven residual dynamics, significantly improving forecast accuracy.
Frequently Asked Questions
Clear, technical answers to the most common questions about Seasonal-Trend decomposition using LOESS, its application in renewable energy forecasting, and how it isolates meaningful signals from meteorological noise.
STL decomposition is a robust, iterative filtering procedure that decomposes a time series into three additive components: seasonal, trend, and remainder (residual). The algorithm uses Locally Weighted Scatterplot Smoothing (LOESS) in a nested loop structure. The inner loop iteratively updates the seasonal and trend components: it detrends the series, smooths cycle-subseries to extract the seasonal pattern, applies a low-pass filter to the seasonal component to prevent low-frequency leakage, detrends again, and then deseasonalizes to extract the trend via LOESS smoothing. The outer loop computes robustness weights based on the residuals, down-weighting the influence of outliers or anomalous observations in subsequent inner loop iterations. This dual-loop architecture makes STL uniquely resistant to transient anomalies like sensor dropouts or storm-driven irradiance spikes, which would otherwise distort the decomposition in classical methods like X-11 or SEATS.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
STL decomposition is a foundational signal processing technique. These related concepts define the analytical landscape for isolating and forecasting grid load and generation patterns.
Loess (Locally Estimated Scatterplot Smoothing)
The core statistical engine driving STL. Loess fits low-degree polynomials to localized subsets of data using weighted least squares, giving more influence to points near the target. In STL, an inner loop applies Loess iteratively to update the seasonal component, while an outer loop uses Loess on the residuals to compute robustness weights, mitigating the influence of outliers on the trend and seasonal estimates.
Seasonal-Trend Decomposition using LOESS (STL)
A versatile and robust filtering procedure for decomposing a time series into trend, seasonal, and remainder components. Unlike classical decomposition, STL handles any seasonal periodicity, allows the seasonal component to evolve over time, and is robust to anomalous observations. It is widely applied to load profiling to separate predictable diurnal human behavior from long-term electrification trends and stochastic weather-driven noise.
Classical Decomposition
A simpler precursor to STL that decomposes a time series into trend, seasonal, and random components using moving averages. It assumes a fixed, non-evolving seasonal pattern and is highly sensitive to outliers. While computationally cheap, it is generally unsuitable for energy data where consumption patterns shift due to demand response programs or seasonal amplitude changes driven by climate variability.
X-13ARIMA-SEATS
A sophisticated seasonal adjustment software package developed by the U.S. Census Bureau. It combines the RegARIMA modeling framework (for pre-adjusting outliers, calendar effects, and holiday impacts) with signal extraction filters. For grid forecasting, X-13ARIMA-SEATS excels at modeling complex calendar effects—such as moving holidays and daylight saving time transitions—that heavily influence commercial and residential load patterns.
Empirical Mode Decomposition (EMD)
An adaptive, data-driven method for decomposing a non-linear and non-stationary signal into Intrinsic Mode Functions (IMFs) . Unlike STL, EMD does not require pre-specifying a seasonal period, making it useful for analyzing transient grid events like inter-area oscillations or fault-induced ringing that lack a fixed frequency. It is often used as a pre-processing step for Hilbert spectral analysis of power quality disturbances.
Discrete Wavelet Transform (DWT)
A mathematical tool that decomposes a signal into components at different frequency scales, providing simultaneous time-frequency localization. In energy forecasting, DWT is used to denoise price spikes or separate high-frequency renewable ramp events from the smoother, low-frequency diurnal cycle. It provides a multi-resolution analysis that complements STL's additive decomposition structure.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us