Function forecasting::ExponentialSmoothing(dataValues, estimates, noObservations, alpha, ErrorMeasures, Residuals)

forecasting::ExponentialSmoothing

The exponential smoothing procedure is a time series forecasting procedure. This procedure forecasts by weighted average of an observation and a previous forecast.

Mathematical Formulation

Using the notation in this table Time Series Forecasting Notation, the estimates are defined as:

\[e_t = \alpha y_{t-1} + ( 1 - \alpha ) e_{t-1}\]

To initialize this sequence, we take

\[\begin{split}\begin{array}{l} e_0 = y_1 \\ y_0 = y_1 \end{array}\end{split}\]

To calculate the forecasts for \(t\geq T+2\), we take \(y_t\) for all \(t \in \{T+1 \ldots T+H \}\) to be equal to \(e_t\). This results in \(y_t = y_{t-1}\) for all \(t \in \{T+2 \ldots T+H \}\); which is graphically depicted as a horizontal line. The weighting factor \(\alpha\) is a parameter in the range \((0,1)\); high values of \(\alpha\) give more weight to recent observations.

Function Prototype

To provide the error measures and residuals only when you need them, there are three flavors of the ExponentialSmoothing procedure provided:

forecasting::ExponentialSmoothing(
! Provides the estimates, but not the error measures nor the residuals
        dataValues,      ! Input, parameter indexed over time set
        estimates,       ! Output, parameter indexed over time set
        noObservations,  ! Scalar input, length history
        alpha)           ! Scalar input, weight of observation
forecasting::ExponentialSmoothingEM(
! Provides estimates and error measures, but not the residuals
        dataValues,      ! Input, parameter indexed over time set
        estimates,       ! Output, parameter indexed over time set
        noObservations,  ! Scalar input, length history
        alpha,           ! Scalar input, weight of observation
        ErrorMeasures)   ! Output, indexed over forecasting::ems
forecasting::ExponentialSmoothingEMR(
! Provides estimates, error measures, and residuals
        dataValues,      ! Input, parameter indexed over time set
        estimates,       ! Output, parameter indexed over time set
        noObservations,  ! Scalar input, length history
        alpha,           ! Scalar input, weight of observation
        ErrorMeasures,   ! Output, indexed over forecasting::ems
        Residuals)       ! Output, parameter indexed over time set

Arguments

dataValues

A one dimensional parameter containing the observations for the first \(T\) elements of the time set.

estimates

A one dimensional parameter containing the estimates for all elements in the time set.

noObservations

Specifies the number of elements that belong to the history of the time set. This parameter corresponds to \(T\) in the notation presented in Time Series Forecasting Notation.

alpha

Specifies the weighting factor for the observation. This parameter corresponds to \(\alpha\) in the mathematical notation above.

ErrorMeasures

The error measures as presented in Time Series Forecasting Notation.

Residuals

The residuals as presented in Time Series Forecasting Notation.

Note

In order to use this function, the Forecasting system library needs to be added to the application.

Example

To further understand about this procedure and library, please use the Demand Forecasting example.