STL_Seasonal - chart function
STL_Seasonal is a time series decomposition function. Along with STL_Trend and STL_Residual, this function is used to decompose a time series into seasonal, trend, and residual components. In the context of the STL algorithm, time series decomposition is used to identify both a recurring seasonal pattern and a general trend, given an input metric and other parameters. The STL_Seasonal function can identify a seasonal pattern within a time series, separating this from the general trend displayed by the data.
The three STL functions are related to the input metric through a simple sum:
STL_Trend + STL_Seasonal + STL_Residual = Input metric
STL (seasonal and trend decomposition using Loess) employs data smoothing techniques, and through its input parameters, allows the user to adjust the periodicity of the calculations it performs. This periodicity determines how the time dimension of the input metric (a measure) is segmented in the analysis.
At minimum, STL_Seasonal takes an input metric (Expression) and an integer value for its Period, returning a floating-point value. The input metric will be in the form of an aggregation that varies along the time dimension. Optionally, you can include values for the seasonal_smoother and trend_smoother to adjust the smoothing algorithm.
Syntax:
STL_Seasonal(Expression, period [,seasonal_smoother [,trend_smoother]])
Return data type: dual
Argument | Description |
---|---|
Expression |
The measure to decompose into Seasonal and Trend components. This should be a measure such as Sum(Sales) or Sum(Passengers) that varies along the time dimension. This must not be a constant value. |
period |
The periodicity of the dataset. This parameter is an integer value representing the number of discrete steps that make up one period, or seasonal cycle, of the signal. For instance, if the time series is segmented into one section for each quarter of the year, you must set the period to a value of 4 to define the periodicity as Year. |
seasonal_smoother |
Length of the seasonal smoother. This must be an odd integer. The seasonal smoother uses data for a particular phase in the seasonal variation, over a number of periods. One discrete step of the time dimension is used from each period. The seasonal smoother indicates the number of periods used for smoothing. For example, if the time dimension is segmented by month and the period is Year (12), the seasonal component will be computed so that each particular month of each year is calculated from data for the same month, both in that year and in adjacent years. The seasonal_smoother value is the number of years used for smoothing. |
trend_smoother |
Length of the trend smoother. This must be an odd integer. The trend smoother uses the same time scale as the period parameter, and its value is the number of granules used for smoothing. For example, if a time series is segmented by month, the trend smoother will be the number of months used for smoothing. |
The STL_Seasonal chart function is often used in combination with the following functions:
Function | Interaction |
---|---|
STL_Trend - chart function | This is the function used to compute the trend component of a time series. |
STL_Residual - chart function | When breaking down an input metric into seasonal and trend component, part of the measure's variation will not fit within either of the two main components. The STL_Residual function computes this portion of the decomposition. |
For a tutorial with a full example showing how to use this function, see Tutorial - Time series decomposition in Qlik Sense.