-
Notifications
You must be signed in to change notification settings - Fork 22
ES (Exponential Smoothing) is a wrapper around ADAM that provides a simplified interface for pure ETS (Error-Trend-Seasonal) models without ARIMA components.
es(y, model = "ZXZ", lags = c(frequency(y)),
persistence = NULL, phi = NULL,
initial = c("backcasting", "optimal", "two-stage", "complete"),
initialSeason = NULL,
ic = c("AICc", "AIC", "BIC", "BICc"),
loss = c("likelihood", "MSE", "MAE", "HAM",
"MSEh", "TMSE", "GTMSE", "MSCE", "GPL"),
h = 0, holdout = FALSE,
bounds = c("usual", "admissible", "none"),
silent = TRUE,
xreg = NULL, regressors = c("use", "select"),
initialX = NULL, ...)class ES(ADAM):
def __init__(
self,
model: str | list[str] = "ZXZ",
lags: list[int] | None = None,
persistence: dict | None = None,
phi: float | None = None,
initial: str | dict | None = "backcasting",
initial_season: NDArray | None = None,
ic: Literal["AIC", "AICc", "BIC", "BICc"] = "AICc",
loss: str = "likelihood",
h: int | None = None,
holdout: bool = False,
bounds: Literal["usual", "admissible", "none"] = "usual",
verbose: int = 0,
regressors: Literal["use", "select"] = "use",
initial_X: NDArray | None = None,
**kwargs,
) -> None: ...ES rejects ADAM-only kwargs (ar_order, i_order, ma_order, orders, arima_select, constant, ets) with a ValueError. Use ADAM for models with ARIMA components or a constant term.
The ES class implements the classical taxonomy of 30 ETS models in Single Source of Error (SSOE) state-space form. It uses normal distribution for errors by default and provides automatic model selection.
ES always uses the conventional ETS formulation (Hyndman et al. 2008) — the ets parameter is not exposed. If you need the "adam" ETS reformulation, use ADAM(ets="adam") directly.
See ADAM for more details.
All 30 ETS models are supported:
| Trend \ Seasonal | N (None) | A (Additive) | M (Multiplicative) |
|---|---|---|---|
| N (None) | ANN, MNN | ANA, MNA | ANM, MNM |
| A (Additive) | AAN, MAN | AAA, MAA | AAM, MAM |
| Ad (Additive Damped) | AAdN, MAdN | AAdA, MAdA | AAdM, MAdM |
| M (Multiplicative) | AMN, MMN | AMA, MMA | AMM, MMM |
| Md (Multiplicative Damped) | AMdN, MMdN | AMdA, MMdA | AMdM, MMdM |
See ADAM for more details.
from smooth import ES
import numpy as np
y = np.array([112, 118, 132, 129, 121, 135, 148, 148, 136, 119, 104, 118])
# Simple Exponential Smoothing
model = ES(model="ANN")
model.fit(y)
forecasts = model.predict(h=6)
# Holt-Winters with automatic selection
model = ES(model="ZXZ", lags=[12])
model.fit(y)
print(f"Selected model: {model.model_name}") # e.g., "ETS(AAA)"
print(f"ETS type: {model.model_type}") # e.g., "AAA"
# Damped trend model
model = ES(model="AAdN")
model.fit(y)
print(f"Damping parameter: {model.phi_:.3f}")
# Select best from a pool of models
model = ES(model=["ANN", "AAN", "AAA"], lags=[12])
model.fit(y)
# Model combination
model = ES(model="CCC", lags=[12])
model.fit(y)library(smooth)
# Simple Exponential Smoothing
model <- es(y, model="ANN")
# Automatic model selection
model <- es(y, model="ZZZ", lags=12)
# Holt-Winters additive
model <- es(AirPassengers, model="AAA", h=18, holdout=TRUE)
forecast(model, h=18)
# With holdout for validation
model <- es(y, model="ZXZ", h=12, holdout=TRUE)Note: Not yet supported in Python
# ETSX model
es(y, model="ZXZ", xreg=X)
# ETSX with regressors selection
es(y, model="ZXZ", xreg=X, regressors="select")| Parameter | Type (R) | Type (Python) | Default | Description |
|---|---|---|---|---|
model |
character/vector | str/List[str] | "ZXZ" | ETS model specification |
lags |
numeric vector | List[int]/None | frequency(y) |
Seasonal period(s) |
persistence |
list/vector | Dict[str, float]/None | NULL | Fixed smoothing parameters |
phi |
numeric | float/None | NULL | Damping parameter |
initial |
character/list | str/Dict/None | "backcasting" | Initialization method |
ic |
character | str | "AICc" | Information criterion |
loss |
character | str | "likelihood" | Loss function |
bounds |
character | str | "usual" | Parameter bounds |
h |
integer | int/None | 0 | Forecast horizon |
holdout |
logical | bool | FALSE | Use holdout validation |
| Element (R) | Element (Python) | Type (R) | Type (Python) | Description |
|---|---|---|---|---|
modelName() |
model_name |
character | str | Full model name (e.g., "ETS(AAN)") |
modelType() |
model_type |
character | str | ETS type code only (e.g., "AAN") |
persistence |
persistence_vector |
vector | Dict | Smoothing parameters dict with keys persistence_level (α), persistence_trend (β), persistence_seasonal (γ) |
phi |
phi_ |
numeric | float/None | Dampening parameter (φ), None if no dampening |
initial |
initial_value |
list | Dict | Initial state values |
states |
states |
matrix | NDArray | State matrix over time |
transition |
transition |
matrix | NDArray | Transition matrix F |
measurement |
measurement |
matrix | NDArray | Measurement matrix W |
fitted |
fitted |
vector | NDArray | Fitted values |
residuals |
residuals |
vector | NDArray | Residuals |
forecast |
predict() result |
vector | NDArray | Point forecasts |
logLik |
loglik |
numeric | float | Log-likelihood value |
AICc |
aicc |
numeric | float | Corrected AIC |
B |
coef |
vector | NDArray | All estimated parameters |
distribution |
distribution_ |
character | str | Error distribution used |
loss |
loss_ |
character | str | Loss function used |
scale |
scale or sigma
|
numeric | float | Scale parameter |
See ADAM for complete list of fitted attributes.
ES is a simplified interface to ADAM with:
- No ARIMA components (
orders=NULL) - Normal distribution for errors (
distribution="dnorm") - Focus on pure ETS models
For models combining ETS and ARIMA, use ADAM directly.
- Svetunkov, I. (2023). Forecasting and Analytics with the Augmented Dynamic Adaptive Model (ADAM). Online book: https://openforecast.org/adam/
- Svetunkov, I. (2023). Smooth forecasting with the smooth package in R. arXiv:2301.01790
- Hyndman, R.J., et al. (2008). Forecasting with Exponential Smoothing: The State Space Approach. Springer.
- ADAM - Full ADAM model with ARIMA support
- CES - Complex Exponential Smoothing
- SMA - Simple Moving Average
- Model-Specification - Model string notation and selection
- Loss-Functions - Loss function options
- Initialisation - State initialization methods
- Persistence - Smoothing parameters
- Bounds - Parameter restrictions