# GESMTH - General Exponential Smoothing Function

Returns the general-form exponential smoothing (out-of-sample) forecast estimate.

## Syntax

GESMTH(X, Order, Alpha, Beta, Gamma, Phi, Lambda, Trend Type, Seasonality Type, L, Optimize, Adjust, Log, T, Return Type)

X is the univariate time series data (a one-dimensional array of cells (e.g. rows or columns)).

Order is the time order in the data series (i.e. the first data point's corresponding date (earliest date=1 (default), latest date=0)).

Order Description
1 ascending (the first data point corresponds to the earliest date) (default)
0 descending (the first data point corresponds to the latest date)

Alpha is the level smoothing factor (alpha should be between zero(0) and one(1) (exclusive)). If missing or omitted, 0.333 value is used.

Beta is the trend smoothing factor (beta should be between zero(0) and one(1) (exclusive)). If missing or omitted, 0.333 value is used.

Gamma is the seasonal change smoothing factor (gamma should be between zero(0) and One(1) (exclusive)). If missing or omitted, 0.50 value is used.

Phi is the damping coefficient of the (Pegel) trend component (phi should be between zero(0) and one(1) (inclusive)). If missing or omitted, 1.0 value is used.

Lambda is the coefficient value for the residuals autocorrelation adjustment term (lambda should be between negative one(-1) and one(1) (exclusive)). If missing or omitted, 0 value is used.

Trend Type is a number that specify the trend component in the model: 0 (or missing) =None, 1=Additive, 2=Additive damped, 3=Multiplicative, 4=Multiplicative damped trend.

Value Description
0 None (default)
3 Multiplicative trend
4 Multiplicative damped trend

Seasonality Type is a number that specify the seasonality component in the model: 0 (or missing) =None, 1= Additive Seasonality, 2=Multiplicative Seasonality.

Value Description
0 None (default)
2 Multiplicative seasonality

L is the season Length or duration in units of steps.

Optimize is a flag (True/False) for searching and using optimal value of the smoothing factor. If missing or omitted, optimize is assumed False.

Adjust is a flag (True/False) for adjusting for the autocorrelation (Chatfield) in forecast errors. If missing or omitted, Adjust is assumed False.

Log Is a flag (True/False) for taking the natural logarithm of the input data prior to smoothing. If missing or omitted, Log is assumed False.

T is the forecast time/horizon beyond the end of X. If missing, a default value of 0 (Latest or end of X) is assumed.

Return Typeis a number that determines the type of return value:0(or missing)=Forecast,1=Alpha,2=Beta,3=Gamma,4=phi,5=lambda,6=level component(series),7=trend component(series),8=seasonal component(series),9=adjustments (series),10=one-step forecasts(series).

Return Type Description
0 or omitted Forecast value
1 Level smoothing parameter (alpha)
2 Trend smoothing parameter (beta)
3 Seaonal smoothing parameter (gamma)
4 damping coefficient (phi)
5 autocorrelation correction coefficient (lambda)
6 level component (series)
7 trend component (series)
8 seasonal component (series)
9 error autocorrelation (Chatfield) adjustment component (series)
10 one-step forecasts (series)

## Remarks

1. The time series is homogeneous or equally spaced.
2. The time series may include missing values (e.g. #N/A) at either end.
3. The GESMTH is a generalization of the triple exponential smoothing model. The recursive form of the single-seasonality general exponential smoothing equation is expressed as follows:

$$\begin{array}{l} \hat{F}_t(m)=f(S_t,b_t,C_{t-L+m})+\lambda e_{t-1}\\ \\ S_t=\alpha\times F_1(X_t,C_{t-L})+(1-\alpha)F_2(S_{t-1},b_{t-1})\\ b_t=\beta\times G_1(S_t,S_{t-1})+(1-\beta)G_2(b_{t-1})\\ C_t=\gamma\times H_1(X_t,S_t)+(1-\gamma)C_{t-L}\\ \\ e_t=X_t-f(S_t,b_t,C_{t-L+m}) \end{array}$$
4. The functional form of $F_2(.),G_1(.), \mathrm{and}\, G_2(.)$ are defined by the type of the trend in the model:
 No Trend $\begin{array}{l} F_2(S_{t-1},b_{t-1})=S_{t-1}\\ G_1(S_t,S_{t-1})=0\\ G_2(b_{t-1})=0 \end{array}$ Additive Trend $\begin{array}{l} F_2(S_{t-1},b_{t-1})=S_{t-1}+b_{t-1}\\ G_1(S_t,S_{t-1})=S_t - S_{t-1}\\ G_2(b_{t-1})=b_{t-1} \end{array}$ Damped Additive Trend $\begin{array}{l} F_2(S_{t-1},b_{t-1})=S_{t-1}+\phi b_{t-1}\\ G_1(S_t,S_{t-1})=S_t - S_{t-1}\\ G_2(b_{t-1})=\phi b_{t-1} \end{array}$ Multiplicative Trend $\begin{array}{l} F_2(S_{t-1},b_{t-1})=S_{t-1}\times b_{t-1}\\ G_1(S_t,S_{t-1})=S_t / S_{t-1}\\ G_2(b_{t-1})= b_{t-1} \end{array}$ Damped Multiplicative Trend $\begin{array}{l} F_2(S_{t-1},b_{t-1})=S_{t-1}\times b_{t-1}^\phi\\ G_1(S_t,S_{t-1})=S_t / S_{t-1}\\ G_2(b_{t-1})= b_{t-1}^\phi \end{array}$
5. The functional form of $F_1(.)$ and $H(.)$ are defined by the type of the seasonality type:
 No Seasonality $\begin{array}{l} F_1(X_t, C_{t-L})=X_t\\ H(X_t, S_t)=0 \end{array}$ Additive Seasonality $\begin{array}{l} F_1(X_t, C_{t-L})=X_t - C_{t-L}\\ H(X_t, S_t)=X_t - S_t \end{array}$ Multiplicative Seasonality $\begin{array}{l} F_1(X_t, C_{t-L})=X_t / C_{t-L}\\ H(X_t, S_t)=X_t / S_t \end{array}$
6. The functional form of the m-step (out-of-sample) forecast ($f(S_t,b_t,C_{t-L+m})$) is determined by the trend type and the seasonality type:
No Trend $S_t$ $S_t + C_{t-L+m}$ $S_t \times C_{t-L+m}$
Additive Trend $S_t+ m\times b_t$ $S_t + m\times b_t+C_{t-L+m}$ $(S_t +m\times b_t) \times C_{t-L+m}$
Damped Additive Trend $S_t+ (\phi+\cdots+\phi^m)b_t$ $S_t + (\phi+\cdots+\phi^m)b_t + C_{t-L+m}$ $(S_t + (\phi+\cdots+\phi^m) b_t) \times C_{t-L+m}$
Multiplicative Trend $S_t \times b_t^m$ $S_t \times b_t^m + C_{t-L+m}$ $S_t \times b_t^m \times C_{t-L+m}$
Damped Multiplicative Trend $S_t \times b_t^{\phi+\cdots+\phi^m}$ $S_t \times b_t^{\phi+\cdots+\phi^m} + C_{t-L+m}$ $S_t \times b_t^{\phi+\cdots+\phi^m} \times C_{t-L+m}$
7. The last term in the forecast function ($\hat{F}_t(m)$)is the forecast error 1st order autocorrelation adjustment term ($\lambda e_{t-1}$),but this remains the same for all trend and seasonality types.
8. In sum, the GESMTH function captures the 15-different models for the single seasonality exponential smoothing, and the Bown’s simple exponential, holt’s double exponential and Holt-Winters triple exponential are merely 3-special cases in GESMTH.
9. The (damped) multiplicative trend can only be used with positive valued input time series.
10. The three components equations in GESMTH are interdependent in sense that three components must be updated each period
11. Similar to Holt-Winters smoothing, the smoothing coefficient $\alpha$ is again used to control speed of adaptation to local level, a second smoothing constant $\beta$ is used to control the degree of a local trend, a third smoothing constant $\gamma$ is introduced to control the degree of local seasonal Indices, and finally, a fourth constant $\phi$ to dampen the trend carried through to multi-step-ahead forecast periods.
12. The GESMTH calculate a point forecast. There is no probabilistic model assumed for the simple exponential smoothing, so we can’t derive a statistical confidence interval for the computed values.
13. In practice, the Mean Squared Error (MSE) for prior out-of-sample forecast values are often used as a proxy for the uncertainty (i.e. variance) in the most recent forecast value.
14. Similar to other recursive exponential smoothing models, the GESMTH method requires a set of starting values. The nature of value and how we calculate them depend on the specified trend and seasonality types
• For non-seasonal time series (Seasonality type = None), we need starting value for level ($S_1$) and trend ($b_1$), if trend is chosen. The calculation of the initial value depends on the trend type (none, vs. additive vs. multiplicative).
• For seasonal time series (additive and multiplicative), we need starting values for the seasonal indices ($C_{1\cdots L}$), initial level ($S_1$), and initial trend ($b_1$), if trend is chosen.
• The actual calculation of the initial values can be summarized in 3 steps
1. Seasonally-adjust the data to estimate trend series.
2. Detrend the data to estimate the seasonal indices.
3. Average over multiple seasons to improve the estimate.
15. Starting from NumXL version 1.65, the GESMTH has a built-in optimizer to find the best value of ($\alpha,\beta,\phi,\gamma$, and $\lambda$) that minimize the SSE (loss function ($U(.)$)) for the one-step forecast calculated in-sample.

$$\begin{array}{l} U(\alpha,\beta,\phi,\gamma,\lambda)=\mathrm{SSE}=\sum_{t=1}^{N-1}(X_{t+1}-\hat{F}_t(1))^2\\ \\ \min_{\alpha,\beta,\phi,\gamma \in (0,1)} U(\alpha,\beta,\phi,\gamma,\lambda) \end{array}$$
16. For initial values, the NumXL optimizer will use the input value of ($\alpha,\beta,\phi,\gamma$, and $\lambda$) (if available) in the minimization problem, and the initial values for the level, trend and seasonal indices series ($S_1,b_1,C_{1\cdots L}$) are computed from the input data.
17. The GESMTH function return the found optimal value for $\alpha,\beta,\phi,\gamma$, and $\lambda$, and the corresponding one-step smoothing series of level, trend, seasonal indices, adjustment terms and the one-step (in-sample) forecast series.
18. For seasonal model, the input time series must have at least two full seasons of observations to use the built-in optimizer.
19. NumXL implements the spectral projected gradient (SPG) method for finding the minima with a boxed boundary
• The SPG requires loss function value and the gradient ($\nabla$). NumXL implements the exact derivative formula (vs. numerical approximation) for performance purposes.

$$\begin{array}{l} \nabla U = \frac{\partial U}{\partial \alpha} \vec{e_\alpha} + \frac{\partial U}{\partial \beta} \vec{e_\beta} + \frac{\partial U}{\partial \phi} \vec{e_\phi} \frac{\partial U}{\partial \gamma} \vec{e_\gamma} \frac{\partial U}{\partial \lambda} \vec{e_\lambda}\\ \\ \frac{\partial U}{\partial \alpha} = -2\times\sum_{t=1}^{N-1}(X_{t+1}-\hat{F}_t(1))\times \frac{\partial \hat{F}_t}{\partial \alpha}\\ \frac{\partial U}{\partial \beta} = -2\times\sum_{t=1}^{N-1}(X_{t+1}-\hat{F}_t(1))\times \frac{\partial \hat{F}_t}{\partial \beta}\\ \frac{\partial U}{\partial \phi} = -2\times\sum_{t=1}^{N-1}(X_{t+1}-\hat{F}_t(1))\times \frac{\partial \hat{F}_t}{\partial \phi}\\ \frac{\partial U}{\partial \gamma} = -2\times\sum_{t=1}^{N-1}(X_{t+1}-\hat{F}_t(1))\times \frac{\partial \hat{F}_t}{\partial \gamma}\\ \frac{\partial U}{\partial \lambda} = -2\times\sum_{t=1}^{N-1}(X_{t+1}-\hat{F}_t(1))\times e_{t-1} \end{array}$$
• Internally, during the optimization, NumXL computes recursively both the smoothed time series, levels, trends, seasonal indices and all the in-sample derivatives, which are used for the loss function and its derivative.
• The SPG is an iterative (recursive) method, and it is possible that the minima can’t be found the within allowed number of iterations and/or tolerance. In this case, NumXL will not fail, instead NumXL uses the best alpha found so far.
• The SPG has no provision to detect or avoid local minima trap. There is no guarantee of global minima.
20. In general, the SSE function in GESMTH yields a continuous smooth non-monotone curve, that SPG minimizer almost always finds an optimal solution in a very few iterations
21. The GMSE function is available starting with version 1.65 HAMMOCK.

## References

0 out of 0 found this helpful
Have more questions? Submit a request