Member-only story
STL decomposition : How to do it from Scratch?
Figure out what STL decomposition is and how it works.
This article will help you understand what is STL decomposition and how to do it from scratch. At the end, I will use statsmodel library too, to get the results in seconds.
What is STL decomposition?
So, STL stands for Seasonal and Trend decomposition using Loess. This is a statistical method of decomposing a Time Series data into 3 components containing seasonality, trend and residual.
Now, what is a Time Series data? Well, it is a sequence of data points that varies across a continuous time axis. Below is an example of a time series data where you can see the time axis is at an hour level and value of stock varies across the time.
Now let’s talk about trend. Trend gives you a general direction of the overall data. From the above example, I can say that from 9:00am to 11:00am there is a downward trend and from 11:00am to 1:00pm there is an upward trend and after 1:00pm the trend is constant.