smooth.ES

class smooth.ES(model='ZXZ', lags=None, persistence=None, phi=None, initial='backcasting', initial_season=None, ic='AICc', loss='likelihood', h=None, holdout=False, bounds='usual', verbose=0, regressors='use', initial_X=None, **kwargs)

Exponential Smoothing in Single Source of Error (SSOE) state space model.

This class is a wrapper around ADAM that provides a simplified interface for pure ETS (Error, Trend, Seasonal) models without ARIMA components. It uses normal distribution for errors and conventional ETS formulation.

The model is specified in state-space form as:

\[ \begin{align}\begin{aligned}y_t &= o_t(w(v_{t-l}) + h(x_t, a_{t-1}) + r(v_{t-l})\epsilon_t)\\v_t &= f(v_{t-l}) + g(v_{t-l})\epsilon_t\end{aligned}\end{align} \]

where:

  • \(y_t\): Observed value at time t

  • \(o_t\): Occurrence indicator (Bernoulli variable for intermittent data)

  • \(v_t\): State vector (level, trend, seasonal components)

  • \(l\): Vector of lags

  • \(w(\cdot)\): Measurement function

  • \(r(\cdot)\): Error function (additive or multiplicative)

  • \(f(\cdot)\): Transition function

  • \(g(\cdot)\): Persistence function

  • \(\epsilon_t\): Error term (normal distribution)

Parameters:
  • model (Union[str, List[str]], default="ZXZ") –

    The type of ETS model. The first letter stands for the type of error (“A” or “M”), the second for trend (“N”, “A”, “Ad”, “M” or “Md”), and the third for seasonality (“N”, “A” or “M”).

    Examples: “ANN”, “AAN”, “AAdN”, “AAA”, “AAdA”, “MAdM”

    Special codes: - “ZZZ”: Automatic selection using information criteria - “XXX”: Select only additive components - “YYY”: Select only multiplicative components - “ZXZ”: Auto-select error and seasonal, additive trend only (default) - “CCC”: Combination of all models using AIC weights

    Can also be a list of model names for custom model pool.

  • lags (Optional[Union[int, List[int]]], default=None) – Seasonal period(s). Can be a single integer or a list of integers. E.g., lags=12 is equivalent to lags=[12]. For monthly data with annual seasonality: lags=12 or lags=[1, 12]. If None, defaults to [1] (no seasonality).

  • persistence (Optional[Dict[str, float]], default=None) – Fixed persistence (smoothing) parameters. If None, estimated. Keys: “alpha” (level), “beta” (trend), “gamma” (seasonal).

  • phi (Optional[float], default=None) – Damping parameter for damped trend models. If None, estimated when applicable.

  • initial (Union[str, Dict[str, Any]], default="backcasting") – Method for initializing states or dictionary of fixed initial values. String options: “backcasting”, “optimal”, “complete”, “two-stage”

  • initial_season (Optional[NDArray], default=None) – Initial values for seasonal components. If None, estimated. Length should be (seasonal_period - 1) for each seasonal component.

  • ic (Literal["AIC", "AICc", "BIC", "BICc"], default="AICc") – Information criterion for model selection.

  • loss (LOSS_OPTIONS, default="likelihood") – Loss function for parameter estimation.

  • h (Optional[int], default=None) – Forecast horizon. Can also be set in predict().

  • holdout (bool, default=False) – Whether to use holdout sample for validation.

  • bounds (Literal["usual", "admissible", "none"], default="usual") – Parameter bounds type: - “usual”: Standard smoothing parameter constraints - “admissible”: Stability constraints - “none”: No constraints

  • verbose (int, default=0) – Verbosity level. 0 = silent.

  • regressors (Literal["use", "select"], default="use") – How to handle external regressors.

  • initial_X (Optional[NDArray], default=None) – Initial values for regressor coefficients.

  • **kwargs – Additional arguments passed to ADAM.

See also

ADAM

Parent class with full attribute documentation including persistence_vector, states, fitted, residuals, phi_, coef, and all other properties.

Examples

Simple exponential smoothing:

>>> from smooth.adam_general.core.es import ES
>>> import numpy as np
>>> y = np.array([112, 118, 132, 129, 121, 135, 148, 148, 136, 119, 104, 118])
>>> model = ES(model="ANN")
>>> model.fit(y)
>>> forecasts = model.predict(h=6)

Holt-Winters with automatic model selection:

>>> model = ES(model="ZZZ", lags=[12])
>>> model.fit(y)
>>> print(f"Selected model: {model.model_type}")

Damped trend model:

>>> model = ES(model="AAdN")
>>> model.fit(y)
>>> print(f"Damping parameter: {model.phi_:.3f}")

With external regressors:

>>> X = np.random.randn(len(y), 2)
>>> model = ES(model="AAN", regressors="use")
>>> model.fit(y, X=X)

References

  • Svetunkov, I. (2023). Forecasting and Analytics with the Augmented Dynamic Adaptive Model. https://openforecast.org/adam/

  • Hyndman, R.J., et al. (2008). “Forecasting with Exponential Smoothing”

See also

ADAM

Full ADAM model with ETS and ARIMA components

Methods

fit(y[, X])

Fit the ADAM model to time series data.

predict(h[, X, calculate_intervals, ...])

Generate point forecasts using the fitted ADAM model.

predict_intervals(h[, X, levels, side])

Generate prediction intervals using the fitted ADAM model.

select_best_model()

Select the best model based on information criteria and update model parameters.

summary([digits])

Generate a formatted summary of the fitted model.

Attributes

actuals

Return original in-sample data.

aic

Return Akaike Information Criterion.

aicc

Return corrected Akaike Information Criterion.

b_value

$B).

bic

Return Bayesian Information Criterion.

bicc

Return corrected Bayesian Information Criterion.

coef

Return estimated coefficients (parameter vector B).

constant_value

$constant).

data

$data).

distribution_

$distribution).

error_type

'A' (additive) or 'M' (multiplicative).

fitted

Return in-sample fitted values.

holdout_data

$holdout).

ic_weights

$ICw).

initial_type

$initialType).

initial_value

$initial).

is_combined

Return True if model is a combination of multiple models.

lags_used

Return the vector of lags used in the model.

loglik

Return log-likelihood of the fitted model.

loss_

$loss).

loss_value

$lossValue).

measurement

$measurement).

model_name

modelName()).

model_type

Return ETS model type code (e.g., 'AAN', 'AAA', 'MAdM').

models

$models).

n_param

$nParam).

nobs

Return number of observations used for fitting.

nparam

Return number of estimated parameters.

orders

Return ARIMA orders as dict with 'ar', 'i', 'ma' keys.

persistence_vector

$persistence).

phi_

$phi).

profile

$profile).

residuals

Return model residuals (errors from fitting).

scale

$scale).

sigma

Return scale/standard error estimate.

states

$states).

time_elapsed

Time taken to fit the model in seconds.

transition

$transition).