# Function and Seasonal Component Forecast (Time Series)

## Synopsis

This operator trains an Function and Seasonal Component Forecast model.## Description

The model contains of a polynomial function which describes the trend of a time series and a seasonal component with length seasonality which describes the seasonal effects of a time series.

A forecast for a time series is created by evaluating the polynomial function to determine the trend values and adding or multiplying (depending on the *decomposition mode* of the performed decomposition) the corresponding values of the seasonal component.

This operator trains a Function and Seasonal Component Forecast model by first performing a decomposition (for the type of decomposition see parameter *decomposition method*) on the *time series* to determine trend and seasonal component.
The seasonal component is directly used for the Forecast model.
A polynomial fit (degree specified by the parameter *degree*) is performed on the trend values. The fitted function is provided to the Forecast model.

If *no decomposition* is selected, no decomposition is performed on the time series.
The seasonal component will have a length of 1 and a value of 0.
The polynomial fit is then performed on the original time series values and not on the decomposed trend values.

If *no fit* is selected, the polynomial function is not fitted and a constant with value 0 (in case the *decomposition mode* is *additive*) or 1 (in case the *decomposition mode* is *multiplicative*) is used for the function.

This operator works only on numerical time series.

## Differentiation

This operator is similar to other modeling operators, but is specifically designed to work on time series data. One of the implications of this is, that the forecast model should be applied on the same data it was trained on.

### Apply Forecast

This operator receives a trained Forecast Model (e.g. the Function and Seasonal Component Forecast model) and creates the forecast for the time series it was trained on.

### ARIMA

This operator trains an ARIMA model (Autoregressive Integrated Moving Average) on time series data to perform a forecast.

### Default Forecast

This operator trains a Default Forecast model (predicting single value) on time series data to perform a forecast.

### Holt-Winters

This operator trains a Holt-Winters model (triple exponential smoothing) on time series data to perform a forecast.

## Input

- example set (Data table)
The ExampleSet which contains the time series data as an attribute.

## Output

- forecast model (IOObject)
The Function and Seasonal Forecast model fitted to the specified time series attribute. It also contains the original time series values.

- original (Data table)
The ExampleSet that was given as input is passed through without changes.

## Parameters

- time series attribute
The time series attribute (numerical) for which the Function and Seasonal Component Forecast model should be build. The required attribute can be selected from this option. The attribute name can be selected from the drop down box of the parameter if the meta data is known.

- indices attribute
The attribute holding the indices values of the time series. It can be either a date, date_time or numeric value type attribute. The attribute name can be selected from the drop down box of the parameter if the meta data is know

- sort time series
If this parameter is selected, the input time series will be sorted, according to the selected

*indices attribute*, before the time series operation is applied on. If it is not selected and the input time series is not sorted, a corresponding User Error is thrown.Keep in mind that the indices values still needs to be unique. If the values are non-unique a corresponding User Error is thrown.

The data set provided at the

*original*output port will be the sorted input time series. - decomposition method
This parameter defines the kind of decomposition used to determine the trend and seasonal components of the time series. The seasonal component is directly used for the Function and Seasonal Forecast model, the trend component is used to fit the polynomial function to it.

- no decomposition: No decomposition is performed. The seasonal component will have a length of 1 and a value of 0. The polynomial fit will be performed on the original time series values
- classic decomposition: A Classic Decomposition is performed (see operator Classic Decomposition).
- STL decomposition:
: A STL Decomposition is performed (see operator STL Decomposition). The
*decomposition mode*is set to*additive*.

- function fitting method
This parameter defines the method to fit the function for the Forecast model. The function is fitted on the decomposed trend values, if the

*decomposition method*is not*no decomposition*. Then the fit is performed on the original time seires values.- no fit:
The function is not fitted and a constant with value 0 (in case the
*decomposition mode*is*additive*) or 1 (in case the*decomposition mode*is*multiplicative*) is used for the function of the Forecast model. - polynomial function:
A polynomial function of the degree specified by the
*degree*parameter is fitted. Invalid values are ignored by this fit. See operator Extract Coefficients (Polynomial Fit) for more details.

- no fit:
The function is not fitted and a constant with value 0 (in case the
- degree
This parameter is only visible if

*function fitting method*is*polynomial fit*. This parameter defines the degree of the polynomial function fitted to the time series. - decomposition mode
This parameter is only visible if

*decomposition method*is*classic decomposition*. The mode, how the different components are combined.- additive: Trend, seasonal and remainder component are added to build the time series: Y = T + S + R. Used if seasonal and remainder component are independent of the trend level.
- multiplicative: Trend, seasonal and remainder component are multiplied to build the time series: Y = T x S x R. Used if the magnitude of seasonal and remainder component depends on the trend level.

- seasonality
This parameter is only visible if

*decomposition method*is*classic decomposition*or*STL decomposition*. The length of one seasonal pattern of the seasonal component. For example for a seasonal pattern which occurs every year the seasonality is 4 (for quartely data), 12 (for montly data) or 52 (for weekly data). Or for a pattern which occurs every hour the seasonality is 60 (for minutely data) or 3600 (for secondly data). - ignore invalid values
This parameter is only visible if

*decomposition method*is*classic decomposition*. If this parameter is set to true invalid values (missing, positive and negative infinity) are ignored in the computation of the trend component of the classic decomposition. - default robust calculations
This parameter is only visible if

*decomposition method*is*STL decomposition*. This parameter defines if the decomposition includes default settings for robust iterations to handle outliers. The number of inner iterations is set to 1 and the number of robust iterations to 15. - inner iterations
This parameter is only visible if

*decomposition method*is*STL decomposition*. This parameter defines the number of inner iterations performed to improve the accuracy of the estimation of the decomposition components. - robust iterations
This parameter is only visible if

*decomposition method*is*STL decomposition*. This parameter defines the number of robust (outer) iterations peformed to reduce the effect of outliers on the estimation of the trend and the seasonal component. Can be set to 0, if no outliers are expected in the data. - seasonal smoothing settings
This parameter is only visible if

*decomposition method*is*STL decomposition*. This parameter defines which settings of the seasonal smoothing are set by the user and which are set to default values by the operator. The seasonal smoothing has 3 parameters, the*seasonal width*, the*seasonal degree*and the*seasonal jump*. See the description of the individual parameters on their effects and their default settings.- default:
Only
*seasonal width*has to be specified. - periodic: This option contrains the seasonal component to be exactly periodic. All three parameters are set by the operator.
- width and degree:
*seasonal width*and*seasonal degree*have to be specified,*seasonal jump*is set to the default value. - width and jump:
*seasonal width*and*seasonal jump*have to be specified,*seasonal degree*is set to the default value. - all: All three parameters have to be specified.

- default:
Only
- seasonal width
This parameter is only visible if

*decomposition method*is*STL decomposition*. The width of the Loess smoother to determine the seasonal components. Has to be larger than 2 and uneven. If*seasonal width*is even, it is automatically increased by one. A large*seasonal width*reduce the rate of change of the seasonal component over time. Has always to be specified, except the*seasonal smoothing settings*is set to*periodic*. In this case the*seasonal width*is set to 100 times the length of the time series. - seasonal degree
This parameter is only visible if

*decomposition method*is*STL decomposition*. The degree of the polynomial used in the Loess smoothing. Has to be 0, 1, or 2 and defaults to 1. If the*seasonal smoothing settings*is set to*periodic*the degree is set to 0. - seasonal jump
This parameter is only visible if

*decomposition method*is*STL decomposition*. The number of points skipped between the Loess smoothing. Has to be larger than 0 and defaults to 10% of the*seasonal width*(ceiled). - trend smoothing settings
This parameter is only visible if

*decomposition method*is*STL decomposition*. This parameter defines which settings of the trend smoothing are set by the user and which are set to default values by the operator. The trend smoothing has 3 parameters, the*trend width*, the*trend degree*and the*trend jump*. See the description of the individual parameters on their effects and their default settings.- default: For all three parameters the default values are used.
- flat: The trend component is forced to be flat. All three parameters are set by the operator.
- linear: The trend component is forced to be linear. All three parameters are set by the operator.
- width:
Only
*trend width*has to be specified. - degree:
Only
*trend degree*has to be specified. - jump:
Only
*trend jump*has to be specified. - width and degree:
*trend width*and*trend degree*have to be specified,*trend jump*is set to the default value. - width and jump:
*trend width*and*trend jump*have to be specified,*trend degree*is set to the default value. - degree and jump:
*trend degree*and*trend jump*have to be specified,*trend width*is set to the default value. - all: All three parameters have to be specified.

- trend width
This parameter is only visible if

*decomposition method*is*STL decomposition*. The width of the Loess smoother to determine the trend components. Has to be larger than 2 and uneven. If*trend width*is even, it is automatically increased by one. The*trend width*increases the smoothing effect on the trend component. If the*trend smoothing settings*is set to*flat*or*linear*the*trend width*is automatically set to 100 times*seasonality*times length of time series. If it is not specified by the user, the*trend width*defaults to floor(1.5 x*seasonality*/ (1 - 1.5 /*seasonal width*) + 0.5). - trend degree
This parameter is only visible if

*decomposition method*is*STL decomposition*. The degree of the polynomial used in the Loess smoothing. Has to be 0, 1, or 2 and defaults to 1. If the*trend smoothing settings*is set to*flat*or*linear*the*trend width*is automatically set 0 (*flat*) or 1 (*linear*). - trend jump
This parameter is only visible if

*decomposition method*is*STL decomposition*. The number of points skipped between the Loess smoothing. Has to be larger than 0 and defaults to 10% of the*trend width*(ceiled). - lowpass smoothing settings
This parameter is only visible if

*decomposition method*is*STL decomposition*. This parameter defines which settings of the lowpass smoothing are set by the user and which are set to default values by the operator. The lowpass smoothing has 3 parameters, the*lowpass width*, the*lowpass degree*and the*lowpass jump*. See the description of the individual parameters on their effects and their default settings.- default: For all three parameters the default values are used.
- width:
Only
*lowpass width*has to be specified. - degree:
Only
*lowpass degree*has to be specified. - jump:
Only
*lowpass jump*has to be specified. - width and degree:
*lowpass width*and*lowpass degree*have to be specified,*lowpass jump*is set to the default value. - width and jump:
*lowpass width*and*lowpass jump*have to be specified,*lowpass degree*is set to the default value. - degree and jump:
*lowpass degree*and*lowpass jump*have to be specified,*lowpass width*is set to the default value. - all: All three parameters have to be specified.

- lowpass width
This parameter is only visible if

*decomposition method*is*STL decomposition*. The width of the Loess smoother to smooth (and with that remove) the seasonal components from the time series data. Has to be larger than 2 and uneven. If*lowpass width*is even, it is automatically increased by one. If it is not specified by the user, the*lowpass width*defaults to*seasonality*. - lowpass degree
This parameter is only visible if

*decomposition method*is*STL decomposition*. The degree of the polynomial used in the Loess smoothing. Has to be 0, 1, or 2 and defaults to 1. - lowpass jump
This parameter is only visible if

*decomposition method*is*STL decomposition*. The number of points skipped between the Loess smoothing. Has to be larger than 0 and defaults to 10% of the*lowpass width*(ceiled).

## Tutorial Processes

### Function and Seasonal Component Forecast on monthly milk production

This tutorial process shows the basic usage of the *Function and Seasonal Component Forecast* operator, by training a *Function and Seasonal Component* model on the Monthly Milk Production data.