LESMTH - (Brown's) Linear Exponential Smoothing

Returns the linear (aka Brown Double) exponential smoothing out-of-sample forecast estimate.

Syntax

LESMTH(X, Order, alpha, Optimize, 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 smoothing factor (alpha should be between zero(0) and one(1) (exclusive)). If missing or omitted, 0.333 value is used.
Optimize
is a flag (True/False) for searching and using optimal value of the smoothing factor. If missing or omitted, optimize 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 Type
is a number that determines the type of return value: 0 (or missing) = Forecast, 1=Alpha, 2=level component (series), 3=trend component (series), 4=one-step forecasts (series).
RETURN TYPE NUMBER RETURNED
0 or omitted Forecast value
1 Smoothing parameter (alpha)
2 level component (series)
3 trend component (series)
4 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 linear exponential smoothing is best applied to time series that exhibit prevalent trend, but do not exhibit seasonality.
  4. The recursive form of the Brown’s double exponential smoothing equation is expressed as follows:

    $$ \begin{array}{l} S_{t\succ 1}^{'} = \alpha\times X_t+(1-\alpha)\times S_{t-1}^{'} \\ S_{t\succ 1}^{''} = \alpha\times S_t^{'}+(1-\alpha)\times S_{t-1}^{''} \\ S_t = 2\times S_{t}^{'} - S_{t}^{''} \\ b_t = \frac{\alpha}{1-\alpha} (S_{t}^{'} - S_{t}^{''})\\ \\ \hat{F}_t(m)=S_t + m\times b_t \end{array} $$
    Where:
    • $X_t$ is the value of the time series at time t.
    • $S_{t}^{'}$ is the simple exponential smoothing value of X.
    • $S_{t}^{''}$ is the double exponential smoothing value.
    • $S_{t}$ is the level estimate.
    • $b_{t}$ is the slope (aka trend) estimate.
    • $\alpha$ is the smoothing factor/coefficient for level.
    • $\hat{F}_t(m)$ is the m-step-ahead forecast values for $X$ from time t.
  5. For the LESMTH, we are applying the simple exponential smoothing twice, and compute level and slope from those two series:
    • Use $X_t$ as input and $\alpha$ as smoothing coefficient, generate $S_{t}^{'}$.
    • Use $S_{t}^{'}$ as input and $\alpha$ as smoothing coefficient, generate $S_{t}^{''}$.
  6. For $\alpha = 1$, the double exponential smoothing is equivalent to the naïve no change extrapolation (NCE) method, or simply a random walk. I this case, division by zero occurs when we compute slope, and forecast is undefined.
  7. For $\alpha = 0$, the forecast will be a constant taking its values from the starting value for $S_{t}^{'}$ and $S_{t}^{''}$:
    $$ \hat{F}_t(m) = 2\times S_{1}^{'} - S_{1}^{''} $$
  8. LESMTH calculates 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.
  9. 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.
  10. This method requires two starting values ($S_{1}^{'},S_{1}^{''}$) to start the recursive updating of the equation. In NumXL, we set those values as follows:
    • $S_{1}^{'}$ is set to the mean of the first four observations, and for a short time series, it is set as the value of the first observation.

      $$ S_{1}^{'}=\left\{\begin{array}{l} X_1\\ \frac{\sum_{t=1}^4 X_t}{4} \end{array}\right. \begin{array}{r} N \leq 4\\ N \gt 4 \end{array} $$
    • $S_{1}^{''}$ is set to the mean of the first four observations of $S_{t}^{'}$, and for a short time series, it is set as the value of the first observation.

      $$ S_{1}^{''}=\left\{\begin{array}{l} S_{1}^{'}\\ \frac{\sum_{t=1}^4 S_{t}^{'}}{4} \end{array}\right. \begin{array}{r} N \leq 4\\ N \gt 4 \end{array} $$
  11. Starting from NumXL version 1.63, the SESMTH has a built-in optimizer to find the best value of $\alpha$ that minimize the SSE (loss function ($U(.)$) for the one-step forecast calculated in-sample.

    $$ \begin{array}{l} U(\alpha)=\mathrm{SSE}=\sum_{t=1}^{N-1}(X_{t+1}-\hat{F}_t(1))^2\\ \min_{\alpha \in (0,1)} U(\alpha) \end{array} $$
  12. For initial values, the NumXL optimizer will use the input value of alpha (if available) in the minimization problem, and the initial values for the two-smoothing series ($S_{1}^{'},S_{1}^{''}$) are computed from the input data.
  13. Starting from NumXL version 1.65. the SESMTH function return the found optimal value for alpha, and the corresponding one-step smoothing series of level, trend and forecast calculated in-sample.
  14. The time series must have at least three (4) observation with non-missing values to use the built-in optimizer.
  15. NumXL implements the spectral projected gradient (SPG) method for finding the minima with a boxed boundary.
    • The SPG requires loss function value and the 1st derivative. NumXL implements the exact derivative formula (vs. numerical approximation) for performance purposes.

      $$ \begin{array}{l} \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 \hat{F}_t}{\partial \alpha}=\frac{\partial S_t}{\partial \alpha}+\frac{\partial b_t}{\partial \alpha}\\ \\ \frac{\partial S_t}{\partial \alpha}= 2\times \frac{\partial S_t^{'}}{\partial \alpha}-\frac{\partial S_t^{''}}{\partial \alpha}\\ \frac{\partial b_t}{\partial \alpha} = \frac{S_t^{'}-S_t^{''}}{(1-\alpha)^2}+\frac{\alpha}{1-\alpha}\times(\frac{\partial S_t^{'}}{\partial \alpha}-\frac{\partial S_t^{''}}{\partial \alpha}) \\ \frac{\partial S_t^{'}}{\partial \alpha}=X_{t+1}+(1-\alpha)\times \frac{\partial S_{t-1}^{'}}{\partial \alpha}-S_{t-1}^{'}\\ \frac{\partial S_t^{''}}{\partial \alpha}=S_t^{'}+\alpha\frac{\partial S_t^{'}}{\partial \alpha} +(1-\alpha)\times \frac{\partial S_{t-1}^{''}}{\partial \alpha}-S_{t-1}^{''}\\ \\ \end{array} $$
    • Internally, during the optimization, NumXL computes recursively both the smoothed time series, levels, trends, and 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.
  16. In general, the SSE function in LESMTH yields a continuous smooth convex monotone curve, that SPG minimizer almost always finds an optimal solution in a very few iterations

Examples

Example 1:

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
A B C
Date Data LESMTH
January 10, 2008 -0.30 #N/A
January 11, 2008 -1.28 -0.3
January 12, 2008 0.24 -0.89
January 13, 2008 1.28 -0.30
January 14, 2008 1.20 0.66
January 15, 2008 1.73 1.14
January 16, 2008 -2.18 1.70
January 17, 2008 -0.23 -0.37
January 18, 2008 1.10 -0.38
January 19, 2008 -1.09 0.43
January 20, 2008 -0.69 -0.43
January 21, 2008 -1.69 -0.67
January 22, 2008 -1.85 -1.39
January 23, 2008 -0.98 -1.86
January 24, 2008 -0.77 -1.57
January 25, 2008 -0.30 -1.25
January 26, 2008 -1.28 -0.77
January 27, 2008 0.24 -1.08
January 28, 2008 1.28 -0.34
January 29, 2008 1.20 0.70
January 30, 2008 1.73 1.22
January 31, 2008 -2.18 1.79
February 1, 2008 -0.23 -0.29
February 2, 2008 1.10 -0.30
February 3, 2008 -1.09 0.49
February 4, 2008 -0.69 -0.38
February 5, 2008 -1.69 -0.63
February 6, 2008 -1.85 -1.35
February 7, 2008 -0.98 -1.84

 

Files Examples

References

Comments

Article is closed for comments.

Was this article helpful?
0 out of 0 found this helpful