This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/7910/. Also, please do not modify any references to the original work (if any) contained in this content.
The decomposition is a mathematical procedure of splitting single time series into multiple different time series. Most often, time series is split into 3 components: trend, seasonality, and random fluctuation. Trend gives you an idea about your data's underlying trend (e.g., up or down). The seasonal component gives you an idea about your data's seasonal patterns - you usually have fixed periods of time, e.g., 12 months. Random fluctuations also called noise, irregular, or remainder, are the original time series residuals after removal of trend and a seasonal component. Thus, by using all three components, you can reconstruct the original time series values.
The decomposition procedure depends on the model you choose. There are additive decomposition and multiplicative decomposition.
Additive Model represents time series as additions of all three components:
Time series = Trend + Seasonal + Random
Multiplicative Model represents time series as multiplications of all three components:
Time series = Trend * Seasonal * Random
The general advice is if the seasonality's magnitude increases with time, use multiplicative decomposition, otherwise use additive decomposition.
The first step is to identify the trend. To do this, you should smooth the data using a moving average. The moving average period should be equal to the seasonal period of your data. In the case of even number - 12 for monthly data or 4 for quarters, a data-centered moving average (CMA) is used. If you want to smooth edges, the first and last values are duplicated as needed.
After you calculate the trend values, you should remove them from the original time series - detrend the time series. You should receive new time series with the more visible seasonal component.
For the additive model, detrending is done like this:
Detrended Time Series = Time Series - Trend.
For the multiplicative model, detrending is done like this:
Detrended Time Series = Time Series / Trend
The next step is to average seasonality. To do this, you are simply averaging the values for the same period, e.g., the average value for all January values, the average value for all February values, etc. This forms values for the seasonal component, which are then repeated for the whole timeline.
The last component, random fluctuations, is obtained by removing both trend and seasonal components from the original time series (or removing the seasonal component from the detrended time series, which is the same).
Random noise for additive model:
Random = Time Series - Trend - Seasonal
Random noise for multiplicative model:
Random = Time Series / (Trend * Seasonal)
The random component is used to detect anomalies and outliers.
The calculator below performs the decomposition of time series both ways, so you can plug your data and play with it.