SES_FORECAST

This function fits a level-only exponential smoothing model and returns point forecasts for future periods.

Simple exponential smoothing updates the level recursively using a smoothing parameter \alpha:

\ell_t = \alpha y_t + (1-\alpha)\ell_{t-1}

Forecasts at future horizons use the final estimated level value.

Excel Usage

=SES_FORECAST(endog, steps, initialization_method)
  • endog (list[list], required): Time-series observations as a 2D range (data points).
  • steps (int, optional, default: 1): Number of future periods to forecast (periods).
  • initialization_method (str, optional, default: “estimated”): Initialization method such as estimated, heuristic, known, or legacy-heuristic (option).

Returns (list[list]): Row vector containing forecasted values for the requested forecast horizon.

Example 1: One-step SES forecast

Inputs:

endog steps
10 11 12 13 14 15 1

Excel formula:

=SES_FORECAST({10,11,12,13,14,15}, 1)

Expected output:

15

Example 2: Three-step SES forecast

Inputs:

endog steps
20 19 21 22 23 24 3

Excel formula:

=SES_FORECAST({20,19,21,22,23,24}, 3)

Expected output:

Result
24 24 24
Example 3: SES with heuristic initialization

Inputs:

endog initialization_method steps
5 6 8 9 10 11 12 13 14 15 heuristic 2

Excel formula:

=SES_FORECAST({5,6,8,9,10,11,12,13,14,15}, "heuristic", 2)

Expected output:

Result
15 15
Example 4: SES from single-row range input

Inputs:

endog steps
2 3 3 4 5 1

Excel formula:

=SES_FORECAST({2,3,3,4,5}, 1)

Expected output:

5

Python Code

import numpy as np
from statsmodels.tsa.holtwinters import SimpleExpSmoothing as sm_SimpleExpSmoothing

def ses_forecast(endog, steps=1, initialization_method='estimated'):
    """
    Fit simple exponential smoothing and return forecasts.

    See: https://www.statsmodels.org/stable/generated/statsmodels.tsa.holtwinters.SimpleExpSmoothing.html

    This example function is provided as-is without any representation of accuracy.

    Args:
        endog (list[list]): Time-series observations as a 2D range (data points).
        steps (int, optional): Number of future periods to forecast (periods). Default is 1.
        initialization_method (str, optional): Initialization method such as estimated, heuristic, known, or legacy-heuristic (option). Default is 'estimated'.

    Returns:
        list[list]: Row vector containing forecasted values for the requested forecast horizon.
    """
    try:
        def to2d(x):
            return [[x]] if not isinstance(x, list) else x

        endog = to2d(endog)

        if not isinstance(endog, list) or not all(isinstance(row, list) for row in endog):
            return "Error: Invalid input - endog must be a 2D list"

        series = []
        for row in endog:
            for value in row:
                try:
                    series.append(float(value))
                except (TypeError, ValueError):
                    continue

        if len(series) < 2:
            return "Error: endog must contain at least 2 numeric values"

        if steps < 1:
            return "Error: steps must be at least 1"

        model = sm_SimpleExpSmoothing(series, initialization_method=initialization_method)
        fitted = model.fit()
        forecast = np.asarray(fitted.forecast(int(steps)), dtype=float).reshape(1, -1)
        return forecast.tolist()
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

Time-series observations as a 2D range (data points).
Number of future periods to forecast (periods).
Initialization method such as estimated, heuristic, known, or legacy-heuristic (option).