Exponential Smoothing with Trend

Time Series
Exponential Smoothing
Forecasting
Statsmodels
Learn how to use Exponential Smoothing to forecast time series that have an upward or downward trend
Published

November 24, 2026

In our last article, we explored the key concepts of Simple Exponential Smoothing and built a basic model in Python. What a simple Exponential Smoothing model, sometimes called “Single Exponential Smoothing”, does not account for is trend and seasonality.

In this article, we explore how to account for a trend in our Exponential Smoothing models. We’ll first look at the basic idea behind this type of model, without getting too much into the math, and then walk through a simple example in Python using the statsmodels library.

Let’s get started!

The Basic Idea (Minimal Math Needed)

We discussed previously how Exponential Smoothing, in its most basic form, produces forecasts that are “weighted averages of past observations, with the weights decaying exponentially as the observations get older” (Hyndman and Athanasopoulos, Forecasting: Principles and Practice). The alpha parameter determines how much weight is given to the most recent past instance. Each value prior to that receives a weight that exponentially decreases the further back in time you get. The resulting smoothing value is called the “level”.

Holt’s Method, also called Double Exponential Smoothing follows a similar logic: at each step a trend element is included that is a weighted average of estimated previous slope values. In practical terms, this means that more recent shifts in the trend carry more weight than shifts further in the past. The parameter that controls how much weight is given to the most recent trend estimate is the beta value \(\beta\). Just like with alpha, the remaining weights are distributed across all previous estimates of the slope - exponentially decaying at each subsequent step. A third parameter, phi \(\phi\), can be added to dampen the trend so it flattens out over time rather than continuing indefinitely.

How to Use Exponential Smoothing with Trend (Holt) in Python - A Basic Example

To demonstrate how this works, we will use a dataset that has the annual population of Frankfort, KY, USA from 1950-2025. You can access this dataset yourself by downloading the CSV and walking through the code in your notebook.

Import Packages and Load Data

We will start by importing necessary packages, loading our data, and preparing it for analysis.

#Necessary imports
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.holtwinters import ExponentialSmoothing

#Load data using pandas' `read_csv()` function
frankfort_pop = pd.read_csv('frankfort_ky_pop.csv')

#Set year column as the index
frankfort_pop = frankfort_pop.set_index('year')

Split Data into Training and Testing Sets

Now that we have our data loaded, let’s set aside a portion of our data as a test set, so we can see how well our model performs on data it has not seen. For more information on how to split time series data into train and test sets, check out our article on splitting time series into train and test sets.

from sklearn.model_selection import train_test_split

y_train, y_test = train_test_split(frankfort_pop, shuffle=False, train_size=.9) #Note, we set shuffle to False to maintain the order of our test set

print('Train Set Size: ', y_train.shape[0])
print('Test Set Size: ', y_test.shape[0])
Train Set Size:  68
Test Set Size:  8

Plot the Data to Observe Structure

Let’s plot our data using a simple line plot to get a view of its structure and direction.

y_train.plot(figsize=(8, 6))
plt.title('Frankfort, KY, USA Population')
plt.ylabel('Population')
plt.xlabel('Year')
plt.show()

We clearly see an upward trend in this data, though it has lost some of its intensity after its sharpest increase from 1950-1980. Simple Exponential Smoothing would not properly account for this trend.

Create Exponential Smoothing Model

Let’s now walk through how to include trend in our Exponential Smoothing model using statsmodels ExponentialSmoothing() function. More information about this function is available in the official statsmodels documentation.

A few notes on the parameters used here:

  • We set the trend parameter to “add” to represent the additive nature of our trend. If our trend seemed to be accelerating as the underlying data increased, “mul” or “multiplicative” would be appropriate.
  • We set damped_trend to True. This allows our trend to fade off as it goes into the future. This aligns with what we found during our visualization of the training set. The population of Frankfort, KY was rapidly rising in the 1950s, 1960s, and 1970s, but the trend has grown less extreme as we moved into the 1980s and beyond. We do not want to assume that the strong trend will continue well into the future in this case.
exp_smooth_model_with_trend = ExponentialSmoothing(
    y_train, #Your data goes here
    trend='add',
    damped_trend=True
).fit(optimized=True) #Usually you can fit the model in the same command that you create it with
#optimized=True is the default, it finds the optimal smoothing parameters for you. If you want to specify them yourself, you can set it to False.

We have successfully trained our exp_smooth_model_with_trend. Let’s briefly inspect the alpha, beta, and phi parameters the function found for us.

exp_smooth_model_with_trend.params
{'smoothing_level': np.float64(0.9332163628602765),
 'smoothing_trend': np.float64(0.0),
 'smoothing_seasonal': np.float64(nan),
 'damping_trend': np.float64(0.9573944340123244),
 'initial_level': np.float64(11286.059413506946),
 'initial_trend': np.float64(796.0180424423511),
 'initial_seasons': array([], dtype=float64),
 'use_boxcox': False,
 'lamda': None,
 'remove_bias': False}

The smoothing_level (alpha) is approximately 0.93, so the level is heavily weighted toward the most recent observation. The smoothing_trend (beta) is 0, which means the model never updates its trend from new data. Instead, the trend starts at its initial estimate (about 796 people per year) and fades at a constant rate set by damping_trend (phi), approximately 0.96, shrinking by about 4% each year. In other words, the model has learned a growth curve that started steep and has steadily flattened, which matches what we saw in the plot. A beta of exactly 0 is not an error, but it does mean the trend can’t respond to a sudden change in growth.

Analyze Results

Now let’s retrieve fitted values and create our forecasts for the duration of the test set.

#Save fitted values
fitted_values = exp_smooth_model_with_trend.fittedvalues

#Generate forecasts for test period using `.forecast()` method.
forecasts = exp_smooth_model_with_trend.forecast(steps=len(y_test))
forecasts.index = y_test.index

#Combine fitted values, forecasts, and actuals for easier visualization
combined_fitted_and_forecasts = pd.concat([fitted_values, forecasts], axis=0)

combined_fitted_fcsts_actuals = pd.concat([frankfort_pop, combined_fitted_and_forecasts], axis=1)

combined_fitted_fcsts_actuals = combined_fitted_fcsts_actuals.rename(columns={'population':'Actuals', 0: 'Fitted/Forecast'})

We will plot the values our model predicted against the actual values to get an idea of how well our model performs.

combined_fitted_fcsts_actuals.plot(figsize=(8, 6))
plt.axvline(x=y_test.index[0], c='red', linestyle='--', label='Start of Test Set')
plt.title('Population of Frankfort, KY, USA: Forecast vs. Actuals')
plt.legend()
plt.xlabel('Year')
plt.ylabel('Population')
plt.show()

Based on this visual alone, we have reason to be optimistic about this model. Not only do the fitted values track the training set values well, but the damped trend we set does well at tracking the test set values closely and approximating the trend there.

In a real-world project, we would explore residuals, compare different models using cross-validation, and look at metrics like Mean Absolute Error (MAE) or Root Mean Squared Error (RMSE) for our chosen model against the test set.

Conclusion

In this article, we focused exclusively on the basics of how Exponential Smoothing models can include trend. As our coding example demonstrates, these types of models can be effective, especially if you are thoughtful about setting up the correct parameters.

In the next article, we will learn how to also include seasonality in Exponential Smoothing models when we explore Triple Exponential Smoothing, also known as the Holt-Winters Method.