Fundamentals 5 min read

Mastering Holt-Winters: Additive Model Explained with Python Code

This article introduces the Holt‑Winters additive exponential smoothing model, explains its mathematical formulation and when to use additive versus multiplicative versions, and provides Python examples using statsmodels to fit both exponential and linear trend variations, illustrated with plots.

Model Perspective
Model Perspective
Model Perspective
Mastering Holt-Winters: Additive Model Explained with Python Code

The Holt‑Winters model is a common forecasting model originally proposed by Winters (1960) and subsequently refined by researchers such as Hyndman et al. (2002), Cipra and Romera (1997), and Cipra et al. (1995), resulting in its current form. The Holt exponential smoothing method adds a trend component and has been validated across many fields, demonstrating strong predictive ability (Holt, 2004; Eddie & Everette, 2010; Luis, 2011). The Holt‑Winters model is usually divided into additive and multiplicative versions, suitable for series with roughly constant seasonal variation and series where the long‑term trend is roughly proportional, respectively.

Time‑series forecasting methods are widely applied in many domains; for example, some studies use them to predict Yellow River runoff to aid flood control, while others apply them to forecast vending‑machine sales, enabling rapid sales planning and reducing unnecessary resource consumption.

Principle of the Holt‑Winters Three‑Parameter Exponential Smoothing Method

Exponential smoothing is an improvement of moving‑average methods. The Holt‑Winters three‑parameter exponential smoothing model is an advanced form that can simultaneously handle trend and seasonal variations, effectively filtering random fluctuations and forecasting data that exhibit both long‑term trends and seasonal patterns.

When the seasonal variation in the series is roughly constant, the additive model should be used; when the long‑term trend is roughly proportional, the multiplicative model is appropriate. This article introduces the additive model.

Assume the series to be smoothed is \(y_t\). The Holt‑Winters model is constructed as follows:

where m is the length of the seasonal period (e.g., 12 months), \(\gamma_t\) is the seasonal adjustment factor, \(l_t\) is the level (current value), \(b_t\) is the trend, \(s_t\) is the seasonal component, \(\alpha, \beta, \gamma\) are smoothing parameters, and \(h\) is the forecast horizon.

The first equation smooths the observed data \(y_t\) using \(\alpha\) to obtain the level \(l_t\); similarly, the trend \(b_t\) and seasonal component \(s_t\) are updated using \(\beta\) and \(\gamma\). The forecast for \(h\) steps ahead is computed as:

Python Implementation

Using the following simulated data:

<code># HWES example
from statsmodels.tsa.holtwinters import Holt
from statsmodels.graphics.tsaplots import plot_predict
import numpy as np
# contrived dataset
data = 2*np.linspace(0,10,20)+5+np.random.uniform(5,10,20)
</code>

Using exponential trend:

<code># fit model
model = Holt(data, exponential=True).fit()
plt.plot(model.predict(0, len(data)+10), label='Predicted')
plt.plot(data, label='Actual')
plt.legend()
</code>

Using linear trend:

<code># fit model
model = Holt(data, exponential=False).fit()
plt.plot(model.predict(0, len(data)+10), label='Predicted')
plt.plot(data, label='Actual')
plt.legend()
</code>

林海 康宝忠 基于Holt-Winters 时间序列的图书选题预测模型

动手实战 | Statsmodels 中经典的11种时间序列预测方法 https://zhuanlan.zhihu.com/p/410812961

Pythonforecastingtime seriesHolt-Wintersexponential smoothing
Model Perspective
Written by

Model Perspective

Insights, knowledge, and enjoyment from a mathematical modeling researcher and educator. Hosted by Haihua Wang, a modeling instructor and author of "Clever Use of Chat for Mathematical Modeling", "Modeling: The Mathematics of Thinking", "Mathematical Modeling Practice: A Hands‑On Guide to Competitions", and co‑author of "Mathematical Modeling: Teaching Design and Cases".

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.