Techno Blender
Digitally Yours.

Forecasting with Holt’s Linear Trend Exponential Smoothing | by Egor Howell | Dec, 2022

0 40


Photo by Jeremy Thomas on Unsplash

In my previous post, we introduced the idea of exponential smoothing for building forecasting models. The gist of exponential smoothing is to put more weight on recent observations and less weight, exponentially, on more historical ones.

The first model we introduced was simple exponential smoothing. The ‘simple’ part refers to the model not taking into account trend or seasonality, and only forecasting the level. This leads to this particular model to often deliver inadequate forecasts for most time series. Therefore, we need to further iterate from this simple approach.

In comes Holt’s linear trend method (also known as double exponential smoothing), which like its name suggests, adds a (linear) trend component to the simple exponential smoothing model. In this post we will cover the theory and practical implementation of Holt’s linear trend model.

Simple Exponential Smoothing

Let’s begin by recapping over the simple exponential smoothing equation:

Equation generated by author in LaTeX.

Here ŷ_{t+1} is the time step we are forecasting, y_t is the most recent observed value of the time series, ŷ_{t-1} is the previous forecast and α is the smoothing factor that takes on values 0 ≤ α ≤ 1. We see that the forecast is simply a weighted average of the previously observed values, this is the essence of exponential smoothing.

The above equation can be re-written in component form:

Equation generated by author in LaTeX.

Where h is the future time step we are forecasting and we let l_t = ŷ_{t+1} to explicitly demonstrate that this is the level component. If you to learn more about simple exponential smoothing, refer to my previous article here:

Adding Trend

As stated earlier, this model has no trend or seasonal component and leads to a flat forecast (all forecasts will be same and equal to the most recently observed value). Therefore, in 1957 Charles Holt extended this model to include a trend component, b_t:

Equation generated by author in LaTeX.

Where b_t is the forecasted trend component, b_{t-1} is the previous forecasted trend and β is the trend smoothing factor that can take on values 0 ≤ β ≤ 1.

The trend equation is computed from the step per step change in the level component. Additionally, from the overall equation, the trend component is now being multiplied by the time step, h, therefore the forecasts are no longer flat but are a linear function of h. Hence, the model’s name is Holt’s linear trend method.

For this model, we need to set an initial value for the trend component, a common choice is:

Equation generated by author in LaTeX.

Where t is some arbitrary time step in the time series. This is basically just an average forecast model.

Dampening

One issue with this current formulation is that the forecasts will increase or decrease arbitrarily into the future. In reality, nothing grows nor decays indefinitely. Therefore, there is often a dampening term, ϕ, added to curtail the forecasts at long horizons:

Equation generated by author in LaTeX.

Where the value of ϕ can be 0 < ϕ < 1. The reason it cannot be 0 or 1 is to ensure some dampening indeed occurs. If ϕ=1 then the model would just be the vanilla Holt’s linear trend method.

Let’s now implement this new exponential smoothing model in Python!

Below is a snippet of code implementing Holt’s linear trend method using the stastmodels package on a very simple dataset:

The Data is the US airline passenger dataset and is sourced from Kaggle with a CC0 licence.

GitHub Gist by author.
Plot generated by author in Python

We observe that Holt’s method has captured the trend, whereas the simple exponential smoothing model is just a flat forecast like we expected. However, there is still an elephant in the room. Our time series has quite a high and obvious seasonality, which this Holt’s model doesn’t capture. I will go over in my next post on how to handle seasonality, however for now we can conclude that Holt’s method is only suitable for data with no seasonality.

The fitted Holt’s model can further be diagnosed by calling the following method on the fitted model object:

model_holt.summary()
Image generated by author in Python.

Here the smoothing_level refers to the smoothing level parameter, α, and is very large indicating the level changes very frequently. However, the smoothing_trend, which refers to the smoothing trend parameter, β, is very low meaning the trend barely changes that much. Finally, the damping_trend, which is ϕ, is large indicating that we need to forecast a long time in the future before we can observe the increasing trend decaying.

In this article we have shown the mathematics of Holt’s linear trend method in incorporating trend to exponential smoothing and how to implement this model in Python. Holt’s method produces its best forecasts when the data has a trend but no seasonality component. In future articles we will go over the Holt Winters model which adds seasonality to the model.

The full code used in this article can be found at my GitHub here:


Photo by Jeremy Thomas on Unsplash

In my previous post, we introduced the idea of exponential smoothing for building forecasting models. The gist of exponential smoothing is to put more weight on recent observations and less weight, exponentially, on more historical ones.

The first model we introduced was simple exponential smoothing. The ‘simple’ part refers to the model not taking into account trend or seasonality, and only forecasting the level. This leads to this particular model to often deliver inadequate forecasts for most time series. Therefore, we need to further iterate from this simple approach.

In comes Holt’s linear trend method (also known as double exponential smoothing), which like its name suggests, adds a (linear) trend component to the simple exponential smoothing model. In this post we will cover the theory and practical implementation of Holt’s linear trend model.

Simple Exponential Smoothing

Let’s begin by recapping over the simple exponential smoothing equation:

Equation generated by author in LaTeX.

Here ŷ_{t+1} is the time step we are forecasting, y_t is the most recent observed value of the time series, ŷ_{t-1} is the previous forecast and α is the smoothing factor that takes on values 0 ≤ α ≤ 1. We see that the forecast is simply a weighted average of the previously observed values, this is the essence of exponential smoothing.

The above equation can be re-written in component form:

Equation generated by author in LaTeX.

Where h is the future time step we are forecasting and we let l_t = ŷ_{t+1} to explicitly demonstrate that this is the level component. If you to learn more about simple exponential smoothing, refer to my previous article here:

Adding Trend

As stated earlier, this model has no trend or seasonal component and leads to a flat forecast (all forecasts will be same and equal to the most recently observed value). Therefore, in 1957 Charles Holt extended this model to include a trend component, b_t:

Equation generated by author in LaTeX.

Where b_t is the forecasted trend component, b_{t-1} is the previous forecasted trend and β is the trend smoothing factor that can take on values 0 ≤ β ≤ 1.

The trend equation is computed from the step per step change in the level component. Additionally, from the overall equation, the trend component is now being multiplied by the time step, h, therefore the forecasts are no longer flat but are a linear function of h. Hence, the model’s name is Holt’s linear trend method.

For this model, we need to set an initial value for the trend component, a common choice is:

Equation generated by author in LaTeX.

Where t is some arbitrary time step in the time series. This is basically just an average forecast model.

Dampening

One issue with this current formulation is that the forecasts will increase or decrease arbitrarily into the future. In reality, nothing grows nor decays indefinitely. Therefore, there is often a dampening term, ϕ, added to curtail the forecasts at long horizons:

Equation generated by author in LaTeX.

Where the value of ϕ can be 0 < ϕ < 1. The reason it cannot be 0 or 1 is to ensure some dampening indeed occurs. If ϕ=1 then the model would just be the vanilla Holt’s linear trend method.

Let’s now implement this new exponential smoothing model in Python!

Below is a snippet of code implementing Holt’s linear trend method using the stastmodels package on a very simple dataset:

The Data is the US airline passenger dataset and is sourced from Kaggle with a CC0 licence.

GitHub Gist by author.
Plot generated by author in Python

We observe that Holt’s method has captured the trend, whereas the simple exponential smoothing model is just a flat forecast like we expected. However, there is still an elephant in the room. Our time series has quite a high and obvious seasonality, which this Holt’s model doesn’t capture. I will go over in my next post on how to handle seasonality, however for now we can conclude that Holt’s method is only suitable for data with no seasonality.

The fitted Holt’s model can further be diagnosed by calling the following method on the fitted model object:

model_holt.summary()
Image generated by author in Python.

Here the smoothing_level refers to the smoothing level parameter, α, and is very large indicating the level changes very frequently. However, the smoothing_trend, which refers to the smoothing trend parameter, β, is very low meaning the trend barely changes that much. Finally, the damping_trend, which is ϕ, is large indicating that we need to forecast a long time in the future before we can observe the increasing trend decaying.

In this article we have shown the mathematics of Holt’s linear trend method in incorporating trend to exponential smoothing and how to implement this model in Python. Holt’s method produces its best forecasts when the data has a trend but no seasonality component. In future articles we will go over the Holt Winters model which adds seasonality to the model.

The full code used in this article can be found at my GitHub here:

FOLLOW US ON GOOGLE NEWS

Read original article here

Denial of responsibility! Techno Blender is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – [email protected]. The content will be deleted within 24 hours.
Leave a comment